定制 alancting/php-adfs-jwt 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alancting/php-adfs-jwt

Composer 安装命令:

composer require alancting/php-adfs-jwt

包简介

A simple library to encode and decode Microsoft Active Directory Federation Services (ADFS) JSON Web Tokens (JWT) in PHP, conforming to RFC 7519

README 文档

README

Packagist GitHub Test Coverage Status GitHub license
firebase/php-jwt Version

PHP-ADFS-JWT

No longer maintained.
Please moved to https://github.com/alancting/php-microsoft-jwt

A simple library to encode and decode Microsoft Active Directory Federation Services (ADFS) JSON Web Tokens (JWT) in PHP, conforming to RFC 7519.

Forked From firebase/php-jwt

Installation

Use composer to manage your dependencies and download PHP-ADFS-JWT:

composer require alancting/php-adfs-jwt

Example

<?php

use Alancting\Adfs\JWT\Adfs\AdfsConfiguration;
use Alancting\Adfs\JWT\Adfs\AdfsAccessTokenJWT;
use Alancting\Adfs\JWT\Adfs\AdfsIdTokenJWT;

$openid_configuration_url = 'https://[Your ADFS hostname]/adfs/.well-known/openid-configuration';
$client_id = 'your_client_id';

/**
 * AdfsConfiguration will fetch the issuers, audiences and jwks for jwt validation
 */
$adfs_configs = new AdfsConfiguration($openid_configuration_url, $client_id);

$id_token_jwt = 'id.token.jwt';
$access_token_jwt = 'access.token.jwt';

/**
 * If the jwt is invalid, exception will be thrown.
 */
$access_token = new AdfsAccessTokenJWT($adfs_configs, $access_token_jwt);
echo "\n";
// Getting the payload from access token
print_r($access_token->getPayload());
echo "\n";

$id_token = new AdfsIdTokenJWT($adfs_configs, $id_token_jwt);
echo "\n";
// Getting the unique_name(username) from id token
echo $id_token->getUsername();
echo "\n";
// Getting the payload from id token
print_r($id_token->getPayload());
echo "\n";

/**
 * You might want to 'cache' the tokens for expire validation
 * To check whether the access token and id token are expired, simply call
 */
echo ($access_token->isExpired()) ? 'Access token is expired' : 'Access token is valid';
echo ($id_token->isExpired()) ? 'Id token is expired' : 'Id token is valid';

Tests

Run the tests using phpunit:

$ composer run test

License

3-Clause BSD.

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-10-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固