一步一步的演练

以下说明提供详细的演练,以帮助您启动并运行OAuth2服务器。要查看实现此库的现有OAuth2服务器的代码库,请查看OAuth2 Demo

初始化您的项目

为您的项目创建一个目录,并拉入这个库

文本
  1. mkdir my-oauth2-walkthrough
  2. cd my-oauth2-walkthrough
  3. git clone https://github.com/bshaffer/oauth2-server-php.git -b master

定义你的模式

现在使用以下模式创建默认数据库:

MySQL / SQLite / PostgreSQL / MS SQL Server

sql
  1. CREATE TABLE oauth_clients (
  2. client_id VARCHAR(80) NOT NULL,
  3. client_secret VARCHAR(80),
  4. redirect_uri VARCHAR(2000),
  5. grant_types VARCHAR(80),
  6. scope VARCHAR(4000),
  7. user_id VARCHAR(80),
  8. PRIMARY KEY (client_id)
  9. );
  10. CREATE TABLE oauth_access_tokens (
  11. access_token VARCHAR(40) NOT NULL,
  12. client_id VARCHAR(80) NOT NULL,
  13. user_id VARCHAR(80),
  14. expires TIMESTAMP NOT NULL,
  15. scope VARCHAR(4000),
  16. PRIMARY KEY (access_token)
  17. );
  18. CREATE TABLE oauth_authorization_codes (
  19. authorization_code VARCHAR(40) NOT NULL,
  20. client_id VARCHAR(80) NOT NULL,
  21. user_id VARCHAR(80),
  22. redirect_uri VARCHAR(2000),
  23. expires TIMESTAMP NOT NULL,
  24. scope VARCHAR(4000),
  25. id_token VARCHAR(1000),
  26. PRIMARY KEY (authorization_code)
  27. );
  28. CREATE TABLE oauth_refresh_tokens (
  29. refresh_token VARCHAR(40) NOT NULL,
  30. client_id VARCHAR(80) NOT NULL,
  31. user_id VARCHAR(80),
  32. expires TIMESTAMP NOT NULL,
  33. scope VARCHAR(4000),
  34. PRIMARY KEY (refresh_token)
  35. );
  36. CREATE TABLE oauth_users (
  37. username VARCHAR(80),
  38. password VARCHAR(80),
  39. first_name VARCHAR(80),
  40. last_name VARCHAR(80),
  41. email VARCHAR(80),
  42. email_verified BOOLEAN,
  43. scope VARCHAR(4000)
  44. );
  45. CREATE TABLE oauth_scopes (
  46. scope VARCHAR(80) NOT NULL,
  47. is_default BOOLEAN,
  48. PRIMARY KEY (scope)
  49. );
  50. CREATE TABLE oauth_jwt (
  51. client_id VARCHAR(80) NOT NULL,
  52. subject VARCHAR(80),
  53. public_key VARCHAR(2000) NOT NULL
  54. );

##引导您的OAuth2服务器

我们需要创建和配置我们的OAuth2服务器对象。这将被我们的应用程序中的所有端点使用。命名这个文件server.php

  1. $dsn = 'mysql:dbname=my_oauth2_db;host=localhost';
  2. $username = 'root';
  3. $password = '';
  4. // error reporting (this is a demo, after all!)
  5. ini_set('display_errors',1);error_reporting(E_ALL);
  6. // Autoloading (composer is preferred, but for this example let's just do this)
  7. require_once('oauth2-server-php/src/OAuth2/Autoloader.php');
  8. OAuth2\Autoloader::register();
  9. // $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
  10. $storage = new OAuth2\Storage\Pdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password));
  11. // Pass a storage object or array of storage objects to the OAuth2 server class
  12. $server = new OAuth2\Server($storage);
  13. // Add the "Client Credentials" grant type (it is the simplest of the grant types)
  14. $server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
  15. // Add the "Authorization Code" grant type (this is where the oauth magic happens)
  16. $server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage));

注意:一定要定义$dsn$username$password变量是数据库的相应值。

创建一个令牌控制器

接下来,我们将创建令牌控制器。这是将OAuth2.0令牌返回给客户端的URI。以下是文件中令牌控制器的示例token.php

  1. // include our OAuth2 Server object
  2. require_once __DIR__.'/server.php';
  3. // Handle a request for an OAuth2.0 Access Token and send the response to the client
  4. $server->handleTokenRequest(OAuth2\Request::createFromGlobals())->send();

Congratulatons!你已经创建了一个令牌控制器!你想看到它的行动?运行以下SQL来创建一个OAuth客户端:

sql
  1. INSERT INTO oauth_clients (client_id, client_secret, redirect_uri) VALUES ("testclient", "testpass", "http://fake/");

现在从命令行运行以下命令:

文本
  1. curl -u testclient:testpass http://localhost/token.php -d 'grant_type=client_credentials'

注意:http://localhost/token.php假设你token.php在本地机器上有文件,并且你已经设置了“localhost”虚拟主机来指向它。这可能会因您的应用程序而异。

如果一切正常,你应该收到这样的回应:

json
  1. {"access_token":"03807cb390319329bdf6c777d4dfae9c0d3b3c35","expires_in":3600,"token_type":"bearer","scope":null}

创建一个资源控制器

现在您正在创建令牌,您将需要在API中验证它们。以下是文件中资源控制器的示例resource.php

  1. // include our OAuth2 Server object
  2. require_once __DIR__.'/server.php';
  3. // Handle a request to a resource and authenticate the access token
  4. if (!$server->verifyResourceRequest(OAuth2\Request::createFromGlobals())) {
  5. $server->getResponse()->send();
  6. die;
  7. }
  8. echo json_encode(array('success' => true, 'message' => 'You accessed my APIs!'));

现在从命令行运行以下命令:

文本
  1. curl http://localhost/resource.php -d 'access_token=YOUR_TOKEN'

注意:使用上一步中的“access_token”中返回的值代替YOUR_TOKEN

如果一切顺利的话,你应该会收到这样的回复:

json
  1. {"success":true,"message":"You accessed my APIs!"}

创建一个授权控制器

授权控制器是OAuth2的“杀手级功能”,允许您的用户授权第三方应用程序。与第一个令牌控制器示例中发生的直接发送访问令牌不同,在本示例中,授权控制器用于在用户授权请求后才发布令牌。创建authorize.php

  1. // include our OAuth2 Server object
  2. require_once __DIR__.'/server.php';
  3. $request = OAuth2\Request::createFromGlobals();
  4. $response = new OAuth2\Response();
  5. // validate the authorize request
  6. if (!$server->validateAuthorizeRequest($request, $response)) {
  7. $response->send();
  8. die;
  9. }
  10. // display an authorization form
  11. if (empty($_POST)) {
  12. exit('
  13. <form method="post">
  14. <label>Do You Authorize TestClient?</label><br />
  15. <input type="submit" name="authorized" value="yes">
  16. <input type="submit" name="authorized" value="no">
  17. </form>');
  18. }
  19. // print the authorization code if the user has authorized your client
  20. $is_authorized = ($_POST['authorized'] === 'yes');
  21. $server->handleAuthorizeRequest($request, $response, $is_authorized);
  22. if ($is_authorized) {
  23. // this is only here so that you get to see your code in the cURL request. Otherwise, we'd redirect back to the client
  24. $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
  25. exit("SUCCESS! Authorization Code: $code");
  26. }
  27. $response->send();

现在将以下URL粘贴到您的浏览器中

文本
  1. http://localhost/authorize.php?response_type=code&client_id=testclient&state=xyz

系统会提示您使用授权表单,并在点击“是”时收到授权码

授权码现在可以用来从您以前创建的token.php端点接收访问令牌。只需使用返回的授权码调用此端点:

文本
  1. curl -u testclient:testpass http://localhost/token.php -d 'grant_type=authorization_code&code=YOUR_CODE'

和以前一样,您将收到一个访问令牌:

json
  1. {"access_token":"6f05ad622a3d32a5a81aee5d73a5826adb8cbf63","expires_in":3600,"token_type":"bearer","scope":null}

注意:请务必迅速执行此操作,因为授权码会在30秒内过期!

将本地用户与访问令牌关联起来

一旦你对一个用户进行了身份验证并发布了一个访问令牌(比如上面的Authorize Controller示例),那么当你使用访问令牌时,你可能会想知道哪个用户是访问令牌的。请查看 用户标识文档以获取有关如何执行此操作的信息。

使用外部客户端测试您的授权控制器

如果您想使用“真实”客户端来测试授权控制器,请查看 Google OAuth2 Playground示例

Google Playground

使用Google OAuth 2.0 Playground测试您的服务器

一旦你在野外的互联网上建立你的服务器,你会想检查它与独立的客户端。一种方法是使用Google OAuth 2.0 Playground

假设你已经设置了一个授权控制器,你可以按如下方式进行测试:

  1. 使用上面的链接导航到游乐场。

  2. 点击右上角的设置按钮。

  3. 选择“服务器端”作为“OAuth流程”,选择“自定义”作为“OAuth端点”。

  4. 在授权端点中,输入授权控制器的URL(例如https://domain.com/authorize.php)。

  5. 在令牌端点中,输入令牌控制器的URL(例如https://domain.com/token.php)。

  6. 为访问令牌位置选择“授权标头w /承载前缀”。

  7. 输入客户端ID和密码(如果使用以前的文档示例,则使用testclient和testpass)。

  8. 在左侧的文本框中输入“basic”,然后单击“授权API”。你应该被带到你的网站,你可以授权请求,之后你应该返回到游乐场。

  9. 点击“兑换令牌授权码”即可接收令牌(您需要在30秒内完成)。

  10. 在右边的回应应该显示访问令牌。输入资源页面的URL(例如https://domain.com/resource.php)。

  11. 添加你想要的任何可选参数,然后点击“发送请求”。如果您以前使用过相同的代码,则应该看到相同的响应:

json
  1. {"success":true,"message":"You accessed my APIs!"}

Drupal的

对于drupal集成,请参阅bojanzOAuth2服务器模块。

Zend框架

为了这个库与Zend框架2整合,你可以使用这些模块之一:* OAuth2Provider由弗兰茨·德利恩* ZF2-的oauth2提供商由格伦·施密特

  1.  

Laravel

在Laravel 4中查看这个Laravel演示应用程序来实现这个库。

一步一步的演练

  1. 创建你的Laravel项目(例如composer create-project laravel/laravel --prefer-dist
  2. 使用Composer:composer require bshaffer/oauth2-server-php和安装OAuth2服务器和HTTPFoundation网桥依赖关系composer require bshaffer/oauth2-server-httpfoundation-bridge
  3. 设置您的数据库并运行提供的迁移(请参阅https://github.com/julien-c/laravel-oauth2-server/commit/b290d4f699b9758696444e2d62dd82f0eeedcb7d):

    php artisan db:migrate

  4. 使用提供的脚本对数据库进行种子处理:https//github.com/julien-c/laravel-oauth2-server/commit/8895c54cbf8ea8ba78aafab53a5a0409ce2f1ba2

    php artisan db:seed

  5. 设置您的OAuth2服务器。为了能够访问Laravel应用程序中任何位置的单个实例,可以将其作为单例添加:
  1. App::singleton('oauth2', function() {
  2. $storage = new OAuth2\Storage\Pdo(App::make('db')->getPdo());
  3. $server = new OAuth2\Server($storage);
  4. $server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
  5. $server->addGrantType(new OAuth2\GrantType\UserCredentials($storage));
  6. return $server;
  7. });
  1. 实施您希望实施的实际OAuth2控制器。例如令牌控制器和资源控制器:请参阅app/routes.php

你甚至可以单元测试你的整合!下面是一个使用Guzzle的例子:https//github.com/julien-c/laravel-oauth2-server/blob/master/app/tests/OAuthTest.php

  1.  

教义

创建客户端和访问令牌存储

要把学说融入到你的项目中,首先要建立你的模型。我们先从客户端和访问令牌模型开始:

yaml
  1. OAuthClient:
  2. tableName: oauth_client
  3. columns:
  4. client_identifier:
  5. type: string(50)
  6. notnull: true
  7. client_secret:
  8. type: char(20)
  9. notnull: false
  10. redirect_uri:
  11. type: string(255)
  12. notnull: true
  13. default: ""
  14. OAuthAccessToken:
  15. tableName: oauth_access_token
  16. columns:
  17. token:
  18. type: char(40)
  19. notnull: true
  20. unique: true
  21. client_identifier:
  22. type: string(50)
  23. notnull: true
  24. user_identifier:
  25. type: string(100)
  26. notnull: true
  27. expires:
  28. type: timestamp
  29. notnull: true
  30. scope:
  31. type: string(50)
  32. notnull: false
  33. relations:
  34. Client:
  35. local: client_identifier
  36. foreign: client_identifier
  37. class: OAuthClient
  38. foreignAlias: AccessTokens
  39. onDelete: CASCADE
  40. onUpdate: CASCADE

一旦你从这个模式中生成模型,你将有一个OAuthClientOAuthCleintTable类文件,以及一个OAuthAccessTokenOAuthAccessTokenTable对象。

OAuth2\Storage\ClientCredentialsInterfaceOAuthClientTable课堂上实施:

  1. class OAuthClientTable extends Doctrine_Table implements OAuth2\Storage\ClientCredentialsInterface
  2. {
  3. public function getClientDetails($client_id)
  4. {
  5. $client = $this->createQuery()
  6. ->where('client_identifier = ?', $client_id)
  7. ->fetchOne(array(), Doctrine::HYDRATE_ARRAY);
  8. return $client;
  9. }
  10. public function checkClientCredentials($client_id, $client_secret = NULL)
  11. {
  12. $client = $this->getClientDetails($client_id);
  13. if ($client) {
  14. return $client['client_secret'] === sha1($client_secret);
  15. }
  16. return false;
  17. }
  18. public function checkRestrictedGrantType($client_id, $grant_type)
  19. {
  20. // we do not support different grant types per client in this example
  21. return true;
  22. }
  23. }

现在OAuth2\Storage\AccessTokenInterfaceOAuthAccessTokenTable课堂上实施:

  1. class OAuthAccessTokenTable extends Doctrine_Table implements OAuth2\Storage\AccessTokenInterface
  2. {
  3. public function getAccessToken($oauth_token)
  4. {
  5. $token = $this->createQuery()
  6. ->where('token = ?', $oauth_token)
  7. ->fetchOne(array(), Doctrine_Core::HYDRATE_ARRAY);
  8. if ($token) {
  9. return array(
  10. 'token' => $token['token'],
  11. 'client_id' => $token['client_identifier'],
  12. 'expires' => strtotime($token['expires']),
  13. 'scope' => $token['scope'],
  14. 'user_id' => $token['user_identifier'],
  15. );
  16. }
  17. }
  18. public function setAccessToken($oauth_token, $client_id, $user_id, $expires, $scope = null)
  19. {
  20. $token = new OAuthAccessToken();
  21. $token->fromArray(array(
  22. 'token' => $oauth_token,
  23. 'client_identifier' => $client_id,
  24. 'user_identifier' => $user_id,
  25. 'expires' => date('Y-m-d H:i:s', $expires),
  26. 'scope' => $scope,
  27. ));
  28. $token->save();
  29. }
  30. }

做得好!现在,当你创建你的OAuth\Server对象的时候,把这些表传递给:

  1. $clientStore = Doctrine::getTable('OAuthClient');
  2. $tokenStore = Doctrine::getTable('OAuthAccessToken');
  3. // Pass the doctrine storage objects to the OAuth2 server class
  4. $server = new OAuth2\Server(array('client_credentials' => $clientStore, 'access_token' => $tokenStore));

你做到了!你已经把你的服务器与主义联系起来了!你可以去镇使用它,但因为你只通过它client_credentialsaccess_token存储对象,你只能用client_credentials批类型:

  1. // will only be able to handle token requests when "grant_type=client_credentials".
  2. $server->addGrantType(new OAuth2\GrantType\ClientCredentials($clientStore));
  3. // handle the request
  4. $server->handleTokenRequest(OAuth2\Request::createFromGlobals())->send();

添加授权码和刷新令牌存储----------------

所以让我们的应用程序更加精彩一点。将以下内容添加到您的模式并生成类文件:

yaml
  1. OAuthAuthorizationCode:
  2. tableName: oauth_authorization_code
  3. columns:
  4. code:
  5. type: char(40)
  6. notnull: true
  7. unique: true
  8. client_identifier:
  9. type: string(50)
  10. notnull: true
  11. expires:
  12. type: timestamp
  13. notnull: true
  14. user_identifier:
  15. type: string(100)
  16. notnull: true
  17. redirect_uri:
  18. type: string(200)
  19. notnull: true
  20. scope:
  21. type: string(50)
  22. notnull: false
  23. relations:
  24. Client:
  25. local: client_identifier
  26. foreign: client_identifier
  27. class: OAuthClient
  28. foreignAlias: AuthorizationCodes
  29. onDelete: CASCADE
  30. onUpdate: CASCADE
  31. OAuthRefreshToken:
  32. tableName: oauth_refresh_token
  33. columns:
  34. refresh_token:
  35. type: char(40)
  36. notnull: true
  37. unique: true
  38. client_identifier:
  39. type: string(50)
  40. notnull: true
  41. user_identifier:
  42. type: string(100)
  43. notnull: true
  44. expires:
  45. type: timestamp
  46. notnull: true
  47. scope:
  48. type: string(50)
  49. notnull: false
  50. relations:
  51. Client:
  52. local: client_identifier
  53. foreign: client_identifier
  54. class: OAuthClient
  55. foreignAlias: RefreshTokens
  56. onDelete: CASCADE
  57. onUpdate: CASCADE

现在,我们可以实现两个接口,OAuth2\Storage\AuthorizationCodeInterfaceOAuth2\Storage\RefreshTokenInterface。这将允许我们使用他们的对应授权类型。

OAuth2\Storage\AuthorizationCodeInterfaceOAuthAuthorizationCodeTable课堂上实施:

  1. class OAuthAuthorizationCodeTable extends Doctrine_Table implements OAuth2\Storage\AuthorizationCodeInterface
  2. {
  3. public function getAuthorizationCode($code)
  4. {
  5. $auth_code = $this->createQuery()
  6. ->where('code = ?', $code)
  7. ->fetchOne(array(), Doctrine_Core::HYDRATE_ARRAY);
  8. if ($auth_code) {
  9. return array(
  10. 'code' => $auth_code['code'],
  11. 'client_id' => $auth_code['client_identifier'],
  12. 'user_id' => $auth_code['web_service_username'],
  13. 'redirect_uri' => $auth_code['redirect_uri'],
  14. 'expires' => strtotime($auth_code['expires']),
  15. 'scope' => $auth_code['scope'],
  16. );
  17. }
  18. return null;
  19. }
  20. public function setAuthorizationCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = null)
  21. {
  22. $auth_code = new OAuthAuthorizationCode();
  23. $auth_code->fromArray(array(
  24. 'code' => $code,
  25. 'client_identifier' => $client_id,
  26. 'web_service_username' => $user_id,
  27. 'redirect_uri' => $redirect_uri,
  28. 'expires' => date('Y-m-d H:i:s', $expires),
  29. 'scope' => $scope,
  30. ));
  31. $auth_code->save();
  32. }
  33. public function expireAuthorizationCode($code)
  34. {
  35. return $this->createQuery()
  36. ->delete()
  37. ->where('code = ?', $code)
  38. ->execute();
  39. }
  40. }

OAuth2\Storage\RefreshTokenInterfaceOAuthRefreshTokenTable课堂上实施:

  1. class OAuthRefreshTokenTable extends Doctrine_Table implements OAuth2\Storage\RefreshTokenInterface
  2. {
  3. public function getRefreshToken($refresh_token)
  4. {
  5. $refresh_token = $this->createQuery()
  6. ->where('refresh_token = ?', $refresh_token)
  7. ->fetchOne(array(), Doctrine_Core::HYDRATE_ARRAY);
  8. if ($auth_code) {
  9. return array(
  10. 'refresh_token' => $refresh_token['refresh_token'],
  11. 'client_id' => $refresh_token['client_identifier'],
  12. 'user_id' => $refresh_token['user_identifier'],
  13. 'expires' => strtotime($refresh_token['expires']),
  14. 'scope' => $refresh_token['scope'],
  15. );
  16. }
  17. }
  18. public function setRefreshToken($refresh_token, $client_id, $user_id, $expires, $scope = null)
  19. {
  20. $refresh_token = new OAuthRefreshToken();
  21. $refresh_token->fromArray(array(
  22. 'code' => $code,
  23. 'client_identifier' => $client_id,
  24. 'user_identifier' => $user_id,
  25. 'expires' => date('Y-m-d H:i:s', $expires),
  26. 'scope' => $scope,
  27. ));
  28. $refresh_token->save();
  29. }
  30. public function unsetRefreshToken($refresh_token)
  31. {
  32. return $this->createQuery()
  33. ->delete()
  34. ->where('refresh_token = ?', $refresh_token)
  35. ->execute();
  36. }
  37. }

现在我们可以在我们的服务器上添加两个授权类型:

  1. $clientStore = Doctrine::getTable('OAuthClient');
  2. $tokenStore = Doctrine::getTable('OAuthAccessToken');
  3. $codeStore = Doctrine::getTable('OAuthAuthorizationCode');
  4. $refreshStore = Doctrine::getTable('OAuthRefreshToken');
  5. // Pass the doctrine storage objects to the OAuth2 server class
  6. $server = new OAuth2\Server(array(
  7. 'client_credentials' => $clientStore,
  8. 'access_token' => $tokenStore,
  9. 'authorization_code' => $codeStore,
  10. 'refresh_token' => $refreshStore,
  11. ));
  12. $server->addGrantType(new OAuth2\GrantType\ClientCredentials($clientStorage));
  13. $server->addGrantType(new OAuth2\GrantType\AuthorizationCode($codeStorage));
  14. $server->addGrantType(new OAuth2\GrantType\RefreshToken($refreshStorage));
  15. // handle the request
  16. $server->handleTokenRequest(OAuth2\Request::createFromGlobals())->send();

你做到了!好吧,几乎所有的。唯一剩下的就是添加你的用户!那么,请参阅symfony文档以了解如何与之集成sfGuardUser

  1.  

oauth2-server-php-docs 食谱的更多相关文章

  1. 使用 OAuth2-Server-php 在 Yii 框架上搭建 OAuth2 Server

    原文转自 http://www.cnblogs.com/ldms/p/4565547.html Yii 有很多 extension 可以使用,在查看了 Yii 官网上提供的与 OAuth 相关的扩展后 ...

  2. 使用 OAuth2-Server-php 搭建 OAuth2 Server

    Yii 有很多 extension 可以使用,在查看了 Yii 官网上提供的与 OAuth 相关的扩展后,发现了几个 OAuth2 的客户端扩展,但是并没有找到可以作为 OAuth2 Server 的 ...

  3. CAS3.5.x(x>1)支持OAuth2 server

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  4. 开始使用 Docker (Linux 上运行 SQL Server) 上的 SQL Server 容器 - SQL Server | Microsoft Docs

    原文:开始使用 Docker (Linux 上运行 SQL Server) 上的 SQL Server 容器 - SQL Server | Microsoft Docs 快速入门:使用 Docker ...

  5. 使用ms owin 搭建oauth2 server

    http://www.asp.net/aspnet/overview/owin-and-katana/owin-oauth-20-authorization-server 有示例代码 关于token的 ...

  6. PHP OAuth2 Server库

    想找比较正宗的库,查了蛮久的.最后在 oauth官方站上,看到PHP版本的相关链接. 发现都是php 5.3版本以上的环境,基于命名空间的写法编写的. 访问下面这个页面,难得,发现文档给出了5.2版本 ...

  7. 微服务下前后端分离的统一认证授权服务,基于Spring Security OAuth2 + Spring Cloud Gateway实现单点登录

    1.  整体架构 在这种结构中,网关就是一个资源服务器,它负责统一授权(鉴权).路由转发.保护下游微服务. 后端微服务应用完全不用考虑权限问题,也不需要引入spring security依赖,就正常的 ...

  8. 每周开源项目分享-年轻人的第一个OAuth2.0 Server:hydra

    年轻人的第一个OAuth2.0 Server:hydra hydra 是什么呢? OpenID Connect certified OAuth2 Server - cloud native, secu ...

  9. 使用OAuth Server PHP实现OAuth2服务

    在现在的网络服务中,OAuth2.0服务已经很普遍了,无论是facebook或者微博的第三方登录,还是手机APP登录,都有很广泛的应用.它主要的目的如下:如果用户的照片在A网站,他想要在B网站使用A网 ...

  10. OAuth2实现单点登录SSO

    1.  前言 技术这东西吧,看别人写的好像很简单似的,到自己去写的时候就各种问题,“一看就会,一做就错”.网上关于实现SSO的文章一大堆,但是当你真的照着写的时候就会发现根本不是那么回事儿,简直让人抓 ...

随机推荐

  1. 使用filezilla server搭建FTP服务器

    参考文献 http://www.pc6.com/infoview/Article_51961_all.html 背景 需要在内网环境下搭建一个FTP服务器,查阅相关资料发现使用filezilla se ...

  2. python及扩展程序安装

    安装 从官方网站下载python程序,我下载的是python-3.3.2.msi 然后下载python扩展程序,我下载的是pywin32-218.win32-py3.3.exe 最后下载wmi插件,我 ...

  3. 微软为何选择在 Github 上开源 .NET 核心?

    本文来自微软开源.NET 的一篇公告 ,文中阐述了微软为何选择在 Github 开源.NET,以及微软对开源和开源社区方面的认识的变迁. 对于.NET来说,今天(2014/11/12)是个大日子! 我 ...

  4. 报错:TargetException, 非静态方法需要一个目标

    如果实例为null,调用实例方法会报如上错. 解决办法: 检查实例是否为null,考虑什么情况下实例为null,然后排除实例为null的情况.

  5. CLR如何加载程序集以及程序集版本策略

    在项目的配置文件Web.config中,会看到<runtime>节点,以及包含在其中的<assemblyBinding>节点,这显然与程序集有关,这些节点到底何时被用到呢? 在 ...

  6. h股和L股

  7. firedac数据集和字符串之间相互转换

    firedac数据集和字符串之间相互转换 /// <author>cxg 2018-12-20</author> unit DatasetString; interface u ...

  8. iOS-如何让xcode自动检查内存泄露

    在project-setting中找到 “Run Static Analyzer” 键,然后把值修改为“YES”.这样在编码的时候,xcode就可以自动为我们检查内存泄露了.

  9. DotNetty的通道处理细节

    第一,客户端如何向服务器主动发送消息: 第二,服务器如何向指定客户端发送消息: 第三,在哪里做报文的拆包和组包. public partial class FrmMain : Form { publi ...

  10. SpringBoot扫描包提示找不到mapper的问题

    SpringBoot扫描包问题 报错信息:Consider defining a bean of type in your configuration 方法一: 使用注解 @ComponentScan ...