discovery)) { $plugin = plugin_load('helper', 'oauthkeycloak'); $json = file_get_contents($plugin->getConf('openidurl')); if (!$json) throw new \Exception('Failed accessing ' . $plugin->getConf('openidurl')); $this->discovery = json_decode($json, true); } if (!isset($this->discovery[$endpoint])) return ''; return $this->discovery[$endpoint]; } /** @inheritdoc */ public function getAuthorizationEndpoint() { return new Uri($this->getEndpoint(self::ENDPOINT_AUTH)); } /** @inheritdoc */ public function getAccessTokenEndpoint() { return new Uri($this->getEndpoint(self::ENDPOINT_TOKEN)); } /** @inheritdoc */ protected function getAuthorizationMethod() { return static::AUTHORIZATION_METHOD_HEADER_BEARER; } /** * Logout from Keycloak * * @return void * @throws \OAuth\Common\Exception\Exception */ public function logout() { $token = $this->getStorage()->retrieveAccessToken($this->service()); $refreshToken = $token->getRefreshToken(); if (!$refreshToken) { return; } $parameters = [ 'client_id' => $this->credentials->getConsumerId(), 'client_secret' => $this->credentials->getConsumerSecret(), 'refresh_token' => $refreshToken, ]; $this->httpClient->retrieveResponse( new Uri($this->getEndpoint(self::ENDPOINT_LOGOUT)), $parameters, $this->getExtraOAuthHeaders() ); } }