nl.idaas/openid-server 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

nl.idaas/openid-server

最新稳定版本:v0.4.2

Composer 安装命令:

composer require nl.idaas/openid-server

包简介

OpenID Connect server for PHP

README 文档

README

Latest Stable Version Total Downloads

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

统计信息

  • 总下载量: 118.88k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 46
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 46
  • Watchers: 5
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固