Properties

$responseTypes

$responseTypes : array

Type

array

$config

$config : array

Type

array

$scope

$scope : string

Type

string

$state

$state : integer

Type

integer

$client_id

$client_id : mixed

Type

mixed

$redirect_uri

$redirect_uri : string

Type

string

$response_type

$response_type : string

The response type

Type

string

$nonce

$nonce : mixed

Type

mixed

Methods

__construct()

__construct(\OAuth2\Storage\ClientInterface  $clientStorage, array  $responseTypes = array(), array  $config = array(), \OAuth2\ScopeInterface  $scopeUtil = null) 

Constructor

Parameters

\OAuth2\Storage\ClientInterface $clientStorage

REQUIRED Instance of OAuth2\Storage\ClientInterface to retrieve client information

array $responseTypes

OPTIONAL Array of OAuth2\ResponseType\ResponseTypeInterface objects. Valid array keys are "code" and "token"

array $config

OPTIONAL Configuration options for the server:

\OAuth2\ScopeInterface $scopeUtil

OPTIONAL Instance of OAuth2\ScopeInterface to validate the requested scope

handleAuthorizeRequest()

handleAuthorizeRequest(\OAuth2\RequestInterface  $request, \OAuth2\ResponseInterface  $response, boolean  $is_authorized, mixed  $user_id = null) : mixed|void

Handle the authorization request

Parameters

\OAuth2\RequestInterface $request
\OAuth2\ResponseInterface $response
boolean $is_authorized
mixed $user_id

Throws

\InvalidArgumentException

Returns

mixed|void

validateAuthorizeRequest()

validateAuthorizeRequest(\OAuth2\RequestInterface  $request, \OAuth2\ResponseInterface  $response) : boolean

Validate the OAuth request

Parameters

\OAuth2\RequestInterface $request
\OAuth2\ResponseInterface $response

Returns

boolean

getScope()

getScope() : string

Convenience method to access the scope

Returns

string

getState()

getState() : integer

Convenience method to access the state

Returns

integer

getClientId()

getClientId() : mixed

Convenience method to access the client id

Returns

mixed

getRedirectUri()

getRedirectUri() : string

Convenience method to access the redirect url

Returns

string

getResponseType()

getResponseType() : string

Convenience method to access the response type

Returns

string

needsIdToken()

needsIdToken(string  $request_scope) : boolean

Returns whether the current request needs to generate an id token.

ID Tokens are a part of the OpenID Connect specification, so this method checks whether OpenID Connect is enabled in the server settings and whether the openid scope was requested.

Parameters

string $request_scope
  • A space-separated string of scopes.

Returns

boolean —
  • TRUE if an id token is needed, FALSE otherwise.

getNonce()

getNonce() : mixed

Returns

mixed

setNotAuthorizedResponse()

setNotAuthorizedResponse(\OAuth2\RequestInterface  $request, \OAuth2\ResponseInterface  $response, string  $redirect_uri, null  $user_id = null) 

Set not authorized response

Parameters

\OAuth2\RequestInterface $request
\OAuth2\ResponseInterface $response
string $redirect_uri
null $user_id

buildAuthorizeParameters()

buildAuthorizeParameters(\OAuth2\RequestInterface  $request, \OAuth2\ResponseInterface  $response, mixed  $user_id) : array

We have made this protected so this class can be extended to add/modify these parameters

Parameters

\OAuth2\RequestInterface $request
\OAuth2\ResponseInterface $response
mixed $user_id

Returns

array

getValidResponseTypes()

getValidResponseTypes() : array

Array of valid response types

Returns

array

validateRedirectUri()

validateRedirectUri(string  $inputUri, string  $registeredUriString) : boolean

Internal method for validating redirect URI supplied

Parameters

string $inputUri

The submitted URI to be validated

string $registeredUriString

The allowed URI(s) to validate against. Can be a space-delimited string of URIs to allow for multiple URIs

Returns

boolean

buildUri()

buildUri(string  $uri, array  $params) : string

Build the absolute URI based on supplied URI and parameters.

Parameters

string $uri

An absolute URI.

array $params

Parameters to be append as GET.

Returns

string —

An absolute URI with supplied parameters.