PHP Class Authorizer, someline-starter

Inheritance: extends Menu
Exibir arquivo Open project: someline/someline-starter Class Usage Examples

Public Methods

Method Description
authCodeRequestDeniedRedirectUri ( ) : string Generate a redirect uri when the auth code request is denied by the user.
checkAuthCodeRequest ( ) : null Check the validity of the auth code request.
getAccessToken ( ) : League\OAuth2\Server\Entity\AccessTokenEntity Get the current access token for the session.
getAuthCodeRequestParam ( $key, null $default = null ) : mixed Get a single parameter from the auth code request parameters.
getAuthCodeRequestParams ( ) : array Get the Auth Code request parameters.
getChecker ( ) : League\OAuth2\Server\ResourceServer Get the checker.
getClientId ( ) : string Get the client id of the current request.
getIssuer ( ) : League\OAuth2\Server\AuthorizationServer Get the issuer.
getRedirectUriGenerator ( ) : LucaDegasperi\OAuth2Server\RedirectUri Get the RedirectUri generator instance.
getResourceOwnerId ( ) : string Get the resource owner ID of the current request.
getResourceOwnerType ( ) : string Get the resource owner type of the current request (client or user).
getScopes ( ) : array get the scopes associated with the current request.
hasScope ( string | array $scope ) : boolean Check if the current request has all the scopes passed.
issueAccessToken ( ) : array Issue an access token if the request parameters are valid.
issueAuthCode ( string $ownerType, string $ownerId, array $params = [] ) : string Issue an auth code.
setRedirectUriGenerator ( $redirectUri ) Set the RedirectUri generator instance.
setRequest ( Request $request ) Set the request to use on the issuer and checker.
setTokenType ( League\OAuth2\Server\TokenType\TokenTypeInterface $tokenType ) Set the token type to use.
validateAccessToken ( boolean $httpHeadersOnly = false, string | null $accessToken = null ) : mixed Validate a request with an access token in it.

Method Details

authCodeRequestDeniedRedirectUri() public static method

Generate a redirect uri when the auth code request is denied by the user.
public static authCodeRequestDeniedRedirectUri ( ) : string
return string a correctly formed url to redirect back to

checkAuthCodeRequest() public static method

Check the validity of the auth code request.
public static checkAuthCodeRequest ( ) : null
return null a response appropriate for the protocol in use

getAccessToken() public static method

If the session does not have an active access token, an exception will be thrown.
public static getAccessToken ( ) : League\OAuth2\Server\Entity\AccessTokenEntity
return League\OAuth2\Server\Entity\AccessTokenEntity

getAuthCodeRequestParam() public static method

Get a single parameter from the auth code request parameters.
public static getAuthCodeRequestParam ( $key, null $default = null ) : mixed
$key
$default null
return mixed

getAuthCodeRequestParams() public static method

Get the Auth Code request parameters.
public static getAuthCodeRequestParams ( ) : array
return array

getChecker() public static method

Get the checker.
public static getChecker ( ) : League\OAuth2\Server\ResourceServer
return League\OAuth2\Server\ResourceServer

getClientId() public static method

Get the client id of the current request.
public static getClientId ( ) : string
return string

getIssuer() public static method

Get the issuer.
public static getIssuer ( ) : League\OAuth2\Server\AuthorizationServer
return League\OAuth2\Server\AuthorizationServer

getRedirectUriGenerator() public static method

Get the RedirectUri generator instance.
public static getRedirectUriGenerator ( ) : LucaDegasperi\OAuth2Server\RedirectUri
return LucaDegasperi\OAuth2Server\RedirectUri

getResourceOwnerId() public static method

Get the resource owner ID of the current request.
public static getResourceOwnerId ( ) : string
return string

getResourceOwnerType() public static method

Get the resource owner type of the current request (client or user).
public static getResourceOwnerType ( ) : string
return string

getScopes() public static method

get the scopes associated with the current request.
public static getScopes ( ) : array
return array

hasScope() public static method

Check if the current request has all the scopes passed.
public static hasScope ( string | array $scope ) : boolean
$scope string | array the scope(s) to check for existence
return boolean

issueAccessToken() public static method

Issue an access token if the request parameters are valid.
public static issueAccessToken ( ) : array
return array a response object for the protocol in use

issueAuthCode() public static method

Issue an auth code.
public static issueAuthCode ( string $ownerType, string $ownerId, array $params = [] ) : string
$ownerType string the auth code owner type
$ownerId string the auth code owner id
$params array additional parameters to merge
return string the auth code redirect url

setRedirectUriGenerator() public static method

Set the RedirectUri generator instance.
public static setRedirectUriGenerator ( $redirectUri )
$redirectUri

setRequest() public static method

Set the request to use on the issuer and checker.
public static setRequest ( Request $request )
$request Symfony\Component\HttpFoundation\Request

setTokenType() public static method

Set the token type to use.
public static setTokenType ( League\OAuth2\Server\TokenType\TokenTypeInterface $tokenType )
$tokenType League\OAuth2\Server\TokenType\TokenTypeInterface

validateAccessToken() public static method

Validate a request with an access token in it.
public static validateAccessToken ( boolean $httpHeadersOnly = false, string | null $accessToken = null ) : mixed
$httpHeadersOnly boolean whether or not to check only the http headers of the request
$accessToken string | null an access token to validate
return mixed