Skip to content
Snippets Groups Projects
Commit b5d24594 authored by Julian's avatar Julian
Browse files

Added Uffd service

parent 8c4b6783
No related branches found
No related tags found
No related merge requests found
<?php
namespace OAuth\Plugin;
/**
* Class UffdAdapter
*
* @link https://git.cccv.de/infra/uffd/uffd
* @package OAuth\Plugin
*/
class UffdAdapter 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() {
$JSON = new \JSON(JSON_LOOSE_TYPE);
$data = array();
/** var OAuth\OAuth2\Service\Generic $this->oAuth */
$result = $JSON->decode($this->oAuth->request($this->hlp->getUserInfoEndpoint('Uffd')));
$data['user'] = $result['nickname'];
$data['name'] = $result['name'];
$data['mail'] = $result['email'];
//$data['grps'] = $result['groups'];
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';
}
}
......@@ -28,6 +28,11 @@ $conf['doorkeeper-key'] = '';
$conf['doorkeeper-secret'] = '';
$conf['doorkeeper-authurl'] = 'https://doorkeeper-provider.herokuapp.com/oauth/authorize';
$conf['doorkeeper-tokenurl'] = 'https://doorkeeper-provider.herokuapp.com/oauth/token';
$conf['uffd-key'] = '';
$conf['uffd-secret'] = '';
$conf['uffd-authurl'] = 'https://uffd.example.com/oauth2/authorize';
$conf['uffd-tokenurl'] = 'https://uffd.example.com/oauth2/token';
$conf['uffd-userinfourl'] = 'https://uffd.example.com/oauth2/userinfo';
$conf['mailRestriction'] = '';
$conf['singleService'] = '';
$conf['register-on-auth'] = 0;
......@@ -49,6 +49,11 @@ $meta['doorkeeper-key'] = array('string');
$meta['doorkeeper-secret'] = array('string');
$meta['doorkeeper-authurl'] = array('string');
$meta['doorkeeper-tokenurl'] = array('string');
$meta['uffd-key'] = array('string');
$meta['uffd-secret'] = array('string');
$meta['uffd-authurl'] = array('string');
$meta['uffd-tokenurl'] = array('string');
$meta['uffd-userinfourl'] = array('string');
$meta['mailRestriction'] = array('string','_pattern' => '!^(@[^,@]+(\.[^,@]+)+(,|$))*$!'); // https://regex101.com/r/mG4aL5/3
$meta['singleService'] = array('multichoice',
'_choices' => array(
......@@ -60,5 +65,6 @@ $meta['singleService'] = array('multichoice',
'Github',
'Yahoo',
'Doorkeeper',
'Uffd',
'Keycloak'));
$meta['register-on-auth'] = array('onoff','_caution' => 'security');
......@@ -31,6 +31,11 @@ $lang['doorkeeper-key'] = '(Example) The Application ID of your registered
$lang['doorkeeper-secret'] = '(Example) The Secret of your registered Doorkeeper Application.';
$lang['doorkeeper-authurl'] = '(Example) The authorization endpoint URL of your Doorkeeper setup.';
$lang['doorkeeper-tokenurl'] = '(Example) The access token endpoint URL of your Doorkeeper setup.';
$lang['uffd-key'] = 'The app id registered in uffd.';
$lang['uffd-secret'] = 'The app secret registered in uffd.';
$lang['uffd-authurl'] = 'The authorization endpoint URL of your uffd setup.';
$lang['uffd-tokenurl'] = 'The access token endpoint URL of your uffd setup.';
$lang['uffd-userinfourl'] = 'The userinfo endpoint URL of your uffd setup.';
$lang['singleService'] = 'Login with single oAuth service only (disables local logins!)';
$lang['singleService_o_'] = 'Allow all services';
$lang['register-on-auth'] = 'Register authenticated users even if self-registration is disabled in main configuration';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment