Add KeksAccount Stuff and hack
parent
53b823bb29
commit
e47b9dee5e
@ -0,0 +1 @@
|
||||
.idea
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace OAuth\Plugin;
|
||||
|
||||
/**
|
||||
* Class DoorkeeperAdapter
|
||||
*
|
||||
* This is an example on how to implement your own adapter for making DokuWiki login against
|
||||
* a custom oAuth provider. The used Generic Service backend expects the authorization and
|
||||
* token endpoints to be configured in the DokuWiki backend.
|
||||
*
|
||||
* Your custom API to access user data has to be implemented in the getUser function. The one here
|
||||
* is setup to work with the demo setup of the "Doorkeeper" ruby gem.
|
||||
*
|
||||
* @link https://github.com/doorkeeper-gem/doorkeeper
|
||||
* @package OAuth\Plugin
|
||||
*/
|
||||
class KeksAccountAdapter extends AbstractAdapter {
|
||||
|
||||
/**
|
||||
* Retrieve the user's data
|
||||
*
|
||||
* The array needs to contain at least 'user', 'mail', 'name' and optional 'grps'
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUser() {
|
||||
global $conf;
|
||||
|
||||
$JSON = new \JSON(JSON_LOOSE_TYPE);
|
||||
$data = array();
|
||||
|
||||
/** var OAuth\OAuth2\Service\Generic $this->oAuth */
|
||||
#var_dump($conf["plugin"]["oauth"]);exit();
|
||||
$result = $JSON->decode($this->oAuth->request($conf["plugin"]["oauth"]["keksaccount-userprofile"]));
|
||||
|
||||
|
||||
$data['user'] = $result["username"];
|
||||
$data['name'] = $result["username"];
|
||||
$data['mail'] = $result['email'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* We make use of the "Generic" oAuth 2 Service as defined in
|
||||
* phpoauthlib/src/OAuth/OAuth2/Service/Generic.php
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServiceName() {
|
||||
return 'Generic';
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue