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
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
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-10-07