tkhamez/eve-sso
Composer 安装命令:
composer require tkhamez/eve-sso
包简介
Library supporting EVE Online SSO
README 文档
README
EVE SSO for PHP
A PHP library supporting EVE Online SSO v2 for web applications including JWT signature verification.
Install
To install the library via Composer, execute:
composer require tkhamez/eve-sso
Example Usage
These examples do not include error handling. Most methods throw exceptions which should be caught.
// Initiate the provider object. $provider = new Eve\Sso\AuthenticationProvider( [ // Required. 'clientId' => 'your-EVE-app-client-ID', 'clientSecret' => 'your-EVE-app-secret-key', 'redirectUri' => 'https://your-callback.url', // Optional. If you do not provide all URLs, a request will be made // to the metadata URL to get them. 'urlAuthorize' => 'https://login.eveonline.com/v2/oauth/authorize', 'urlAccessToken' => 'https://login.eveonline.com/v2/oauth/token', 'urlRevoke' => 'https://login.eveonline.com/v2/oauth/revoke', 'urlKeySet' => 'https://login.eveonline.com/oauth/jwks', 'issuer' => 'https://login.eveonline.com', 'urlMetadata' => 'https://login.eveonline.com/.well-known/oauth-authorization-server', ], // Optionally, add all required scopes. ['esi-mail.read_mail.v1', 'esi-skills.read_skills.v1'], // Optionally, use your own HTTP client. httpClient: new GuzzleHttp\Client(), // Optionally add a logger to log exceptions that are caught from libraries // (any class implementing Psr\Log\LoggerInterface, the example uses monolog/monolog // which is not included in this package). logger: new Monolog\Logger('SSO', [new Monolog\Handler\StreamHandler('/path/to/logfile')]) ); // Optionally disable signature verification. $provider->setSignatureVerification(false);
// Login URL session_start(); $_SESSION['state'] = $provider->generateState(); $loginUrl = $provider->buildLoginUrl($_SESSION['state']); header("Location: $loginUrl");
// Callback URL session_start(); $eveAuthentication = $provider->validateAuthenticationV2( $_GET['state'] ?? '', $_SESSION['state'] ?? '', $_GET['code'] ?? '', ); unset($_SESSION['state']); $characterId = $eveAuthentication->getCharacterId(); $refreshToken = $eveAuthentication->getToken()->getRefreshToken(); $accessToken = $eveAuthentication->getToken()->getToken(); $expires = $eveAuthentication->getToken()->getExpires(); // ... store the token data somewhere together with the character ID.
// Refreshes access token, if necessary. $existingToken = new League\OAuth2\Client\Token\AccessToken([ 'refresh_token' => $refreshToken, 'access_token' => $accessToken, 'expires' => $expires, ]); $validToken = $provider->refreshAccessToken($existingToken);
Development Environment
docker build --tag eve-sso . docker run -it --mount type=bind,source="$(pwd)",target=/app --workdir /app eve-sso /bin/sh
tkhamez/eve-sso 适用场景与选型建议
tkhamez/eve-sso 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.84k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2020 年 06 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tkhamez/eve-sso 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tkhamez/eve-sso 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-22