PHP Interface Webiny\Component\OAuth2\Bridge\OAuth2Interface

All of OAuth2 bridges must implement this interface in order to be compliant with WebinyFramework.
Show file Open project: Webiny/Framework

Public Methods

Method Description
__construct ( string $clientId, string $clientSecret, string $redirectUri ) Base constructor.
getAccessToken ( ) : string Get access token.
getAccessTokenName ( ) : string Returns the name of access token param. Its usually either 'access_token' or 'token' based on the OAuth2 server.
getCertificate ( ) : string Returns the path to certificate.
getClientId ( ) : string Get client id.
getClientSecret ( ) : string Get client secret.
getRedirectURI ( ) : string Get the defined redirect URI.
getScope ( ) : string Get the defined scope.
getState ( ) : string Get the state parameter.
requestAccessToken ( string $tokenUrl ) : string Requests the access token from the OAuth server.
setAccessToken ( string $accessToken ) : void Set the access token.
setCertificate ( string $pathToCertificate ) : void Set the certificate used by OAuth2 requests.
setScope ( string $scope ) : void Set the request scope.
setState ( string $state ) : void. Set the state parameter.

Method Details

__construct() public method

Base constructor.
public __construct ( string $clientId, string $clientSecret, string $redirectUri )
$clientId string Client id.
$clientSecret string Client secret.
$redirectUri string Target url where to redirect after authentication.

getAccessToken() public method

Get access token.
public getAccessToken ( ) : string
return string Access token.

getAccessTokenName() public method

Returns the name of access token param. Its usually either 'access_token' or 'token' based on the OAuth2 server.
public getAccessTokenName ( ) : string
return string

getCertificate() public method

Returns the path to certificate.
public getCertificate ( ) : string
return string Path to certificate.

getClientId() public method

Get client id.
public getClientId ( ) : string
return string Client id.

getClientSecret() public method

Get client secret.
public getClientSecret ( ) : string
return string Client secret.

getRedirectURI() public method

Get the defined redirect URI.
public getRedirectURI ( ) : string
return string Redirect URI.

getScope() public method

Get the defined scope.
public getScope ( ) : string
return string A comma separated list of parameters.

getState() public method

Get the state parameter.
public getState ( ) : string
return string State parameter

requestAccessToken() public method

You can call this method only on the OAuth redirect_uri page or else the request will fail.
public requestAccessToken ( string $tokenUrl ) : string
$tokenUrl string Url to the page where we can get the access token.
return string Access token.

setAccessToken() public method

Set the access token.
public setAccessToken ( string $accessToken ) : void
$accessToken string Access token.
return void

setCertificate() public method

Set the certificate used by OAuth2 requests.
public setCertificate ( string $pathToCertificate ) : void
$pathToCertificate string Absolute path to the certificate file.
return void

setScope() public method

Set the request scope.
public setScope ( string $scope ) : void
$scope string A comma-separated list of parameters. Example: email,extender_permissions
return void

setState() public method

Set the state parameter.
public setState ( string $state ) : void.
$state string State name.
return void.