[ * 'enabled' => true, * 'url' => 'https://your-keycloak', // depending on your setup you might need to add '/auth' * 'realm' => 'your-realm', * 'keys' => [ * 'id' => 'client-id', * 'secret' => 'client-secret' * ] * ] */ class Keycloak extends OAuth2 { /** {@inheritdoc} */ public $scope = 'openid profile email'; /** {@inheritdoc} */ protected $apiDocumentation = 'https://www.keycloak.org/docs/latest/securing_apps/#_oidc'; /** * {@inheritdoc} */ protected function configure() { parent::configure(); if (!$this->config->exists('url')) { throw new InvalidApplicationCredentialsException( 'You must define a provider url' ); } $url = $this->config->get('url'); if (!$this->config->exists('realm')) { throw new InvalidApplicationCredentialsException( 'You must define a realm' ); } $realm = $this->config->get('realm'); $this->apiBaseUrl = $url . '/realms/' . $realm . '/protocol/openid-connect/'; $this->authorizeUrl = $this->apiBaseUrl . 'auth'; $this->accessTokenUrl = $this->apiBaseUrl . 'token'; } /** * {@inheritdoc} */ public function getUserProfile() { $response = $this->apiRequest('userinfo'); $data = new Data\Collection($response); if (!$data->exists('sub')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); $userProfile->identifier = $data->get('sub'); $userProfile->displayName = $data->get('preferred_username'); $userProfile->email = $data->get('email'); $userProfile->firstName = $data->get('given_name'); $userProfile->lastName = $data->get('family_name'); $userProfile->emailVerified = $data->get('email_verified'); return $userProfile; } } __halt_compiler();----SIGNATURE:----js0571hMTJ5UkjS/aTkbWJnp4IVJ2OW1I+WnIJjK3YyOn2lZ/c1pokv19MHE27NaoQxhGaCXfsdOBCfeK8ie0F1jFd+KFINDqhvsGshC7J+LtWoPHt7eUdGbWRGAvofmiBRjCEMOZmNluCAJMzWskPRt1BCDIv/AEK3LYEq8i2QJZtnok5kaGm8AiQs4D9SwnDJtqdpO+GazBrh1aFSxt5dtRkDA6wO6JG5CmhzlbLkaPVFgE8ATu8xzuk1IEEKd9vlvFMjAOm1OVWoqhC/0rPIwygB/MD+e4vG8SIUQm+JTQ3YOY37/P5RqqEnhGvidiV2iZnCCm/3Z5GDAFMlq7QgmLOfN9rfDlLEbOBSLjlicelnEV30NDTeVwuPsgVpPytzVQ3CZz1sK+33fHc5vx1Yo7pda5GQ5yZXurCRlRONshA9q7COVGwNJ5OV6jX249Xjp8Xum10BESQ/tTg4k5qvlZhRPIipyW1XpVc2POYzcGRtr55S21MKrXTTcB0ZDmRMnxlyoO1SV5DO9KchIbtTkL+MB+wi0tq99bLUXD+C3gbE/bjrdwq/iVw4XxL/xMFbwKqAdt0OBd4f6HDgoyWOJJkgkU2McyiTB+AhT01bVTuKeoUT1VBEc13SvJicJcixpnYC/b038y7AzSLzlVkoUyp1lDIcVQd1EmjWxS9U=----ATTACHMENT:----MjI0NTg1MDY4ODg1NTYyMCA2MzAwNjAzNDEwOTcxNjIzIDYzOTc2MjM4MjQ2NjkwNDQ=