nl.idaas/openid-server
Composer 安装命令:
composer require nl.idaas/openid-server
包简介
OpenID Connect server for PHP
README 文档
README
PHP OpenID Connect Server
This is an OpenID Connect Server written in PHP, built on top of thephpleague/oauth2-server.
It is used by idaas.nl: (not) yet another identity as a service platform.
This library supports everything that is supported by thephpleague/oauth2-server, plus the following specifications
This library was created by Arie Timmerman.
Installation
composer require nl.idaas/openid-server
Example
This example implements show how to implement an authorization server with support for an authorization grant, including OpenID Connect support.
// Init our repositories $scopeRepository = new ScopeRepository(); // instance of ScopeRepositoryInterface $authCodeRepository = new AuthCodeRepository(); // instance of AuthCodeRepositoryInterface $refreshTokenRepository = new RefreshTokenRepository(); // instance of RefreshTokenRepositoryInterface // Specific to this module $clientRepository = new ClientRepository(); // instance of \Idaas\OpenID\Repositories\ClientRepositoryInterface $accessTokenRepository = new AccessTokenRepository(); // instance of \Idaas\OpenID\Repositories\AccessTokenRepositoryInterface $claimRepository = new ClaimRepository(); // instance of ClaimRepositoryInterface $privateKey = 'file://path/to/private.key'; //$privateKey = new CryptKey('file://path/to/private.key', 'passphrase'); // if private key has a pass phrase $encryptionKey = 'lxZFUEsBCJ2Yb14IF2ygAHI5N4+ZAUXXaSeeJm6+twsUmIen'; // generate using base64_encode(random_bytes(32)) // Setup the authorization server $server = new \League\OAuth2\Server\AuthorizationServer( $clientRepository, $accessTokenRepository, $scopeRepository, $privateKey, $encryptionKey ); // OpenID Connect Authorization Code Grant $grant = new \Idaas\OpenID\Grant\AuthCodeGrant( $authCodeRepository, $refreshTokenRepository, $claimRepository, new \Idaas\OpenID\Session, new DateInterval('PT10M'), // authorization codes will expire after 10 minutes new DateInterval('PT10M') // ID Token will expire after 10 minutes ); $grant->setRefreshTokenTTL(new \DateInterval('P1M')); // refresh tokens will expire after 1 month // Enable the authentication code grant on the server $server->enableGrantType( $grant, new \DateInterval('PT1H') // access tokens will expire after 1 hour );
Usages
nl.idaas/openid-server 适用场景与选型建议
nl.idaas/openid-server 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 138.67k 次下载、GitHub Stars 达 47, 最近一次更新时间为 2020 年 02 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 nl.idaas/openid-server 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nl.idaas/openid-server 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 138.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 47
- 点击次数: 31
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-only
- 更新时间: 2020-02-08