From b08af13872a698c85bb2cf9abd6651bc5c98f7bd Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 3 May 2017 22:37:06 -0700 Subject: oauth2/oidc testing (please do not port - this requires several extra DB tables to work) --- include/oauth2.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/oauth2.php (limited to 'include/oauth2.php') diff --git a/include/oauth2.php b/include/oauth2.php new file mode 100644 index 000000000..a0d65a995 --- /dev/null +++ b/include/oauth2.php @@ -0,0 +1,21 @@ +db); + $config = [ + 'use_openid_connect'] => true, + 'issuer' => \Zotlabs\Lib\System::get_site_name() + ]; + + $oauth2_server = new OAuth2\Server($storage,$config); + + $oauth2_server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage)); + $oauth2_server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage)); + + $keyStorage = new OAuth2\Storage\Memory( [ + 'keys' => [ + 'public_key' => get_config('system','pubkey'), + 'private_key' => get_config('system','prvkey') + ] + ]); + + $oauth2_server->addStorage($keyStorage,'public_key'); -- cgit v1.2.3