OpenIDClientInterface
interface OpenIDClientInterface implements OAuthClientInterface
This interface completes the OAuthClient interface for the OpenID protocol.
Methods
Initialize the class variables and internal state. It must be called before calling other class functions.
Checks if the user is authenticated with the current OAuth provider.
Process the OAuth protocol interaction with the OAuth provider.
Send a HTTP request to the Web services API using a previously obtained access token via OAuth.
Returns the information about the resource owner using a previously obtained access token via OAuth.
Returns the information about the resource owner.
Cleanup any resources that may have been used during the OAuth protocol processing or execution of API calls.
Check if the access token was retrieved and if it is valid.
Reset the access token to a state back when the user has not yet authorized the access to the OAuth provider API.
Determines whether the revokeToken function can be called.
Revoke a previously obtained token so it becomes invalid.
Calls the end-session endpoint to notify the provider that the end-user has logged out of the relying party site.
Returns the obtained access token upon successful OAuth authentication.
Returns the obtained refresh token upon successful OAuth authentication.
Returns the obtained ID token upon successful OpenID authentication.
Returns the current instance of the OAuthProvider class.
Returns the current instance of the OAuthClientStrategy class.
Determines the active state of a token and the meta-information about this token.
Details
in OAuthClientInterface at line 30
bool
initialize(array $options = [])
Initialize the class variables and internal state. It must be called before calling other class functions.
Set the provider variable before calling this function to let it initialize the class variables to work with the specified provider. Alternatively, you can set other class variables manually to make it work with providers that are not yet built-in supported.
in OAuthClientInterface at line 40
bool
isAuthenticated()
Checks if the user is authenticated with the current OAuth provider.
Call this function if you want to know if the user needs to log in to access the resources he owns without doing so.
in OAuthClientInterface at line 51
bool
authenticate()
Process the OAuth protocol interaction with the OAuth provider.
Call this function when you need to retrieve the OAuth access token. Check the access_token to determine if the access token was obtained successfully.
in OAuthClientInterface at line 125
mixed
callAPI(string $url, string $method, array $parameters, array $options)
Send a HTTP request to the Web services API using a previously obtained access token via OAuth.
This function can be used to call an API after having previously obtained an access token through the OAuth protocol using the authenticate function, or by directly setting the variables access_token, as well as access_token_secret in case of using OAuth 1.0 or 1.0a services. The response_status variable returns the HTTP response status of the request. The responseHeaders variable returns the HTTP response headers. The responseBody variable returns the HTTP response body.
in OAuthClientInterface at line 140
ResourceOwner
getResourceOwner(string $endpoint = null)
Returns the information about the resource owner using a previously obtained access token via OAuth.
This function must be called after having previously obtained an access token through the OAuth protocol using the authenticate function, or by directly setting the variables access_token, as well as access_token_secret in case of using OAuth 1.0 or 1.0a services.
in OAuthClientInterface at line 153
ResourceOwner
fetchResourceOwner(array $options)
Returns the information about the resource owner.
This function is a high-level function that perform all the necessary actions (initalization, authentication, ...) before requesting the information about the resource owner.
in OAuthClientInterface at line 162
finalize()
Cleanup any resources that may have been used during the OAuth protocol processing or execution of API calls.
Always call this function as the last step after calling the functions authenticate() or callAPI(...).
in OAuthClientInterface at line 181
string|bool
checkAccessToken(string $redirectUrl)
Check if the access token was retrieved and if it is valid.
Call this function when you need to check of an access token is valid without forcing to redirect the user to the OAuth provider authorization page.
If a previously retrieved access token has expired, this function may renew it automatically.
in OAuthClientInterface at line 205
bool
resetAccessToken()
Reset the access token to a state back when the user has not yet authorized the access to the OAuth provider API.
Call this function if for some reason the token to access the API was revoked and you need to ask the user to authorize the access again.
By default the class stores and retrieves access tokens in a session variable named 'OAUTH_ACCESS_TOKEN'.
This function must be called when the user is accessing your site pages, so it can reset the information stored in session variables that cache the state of a previously retrieved access token.
Actual implementations should create a sub-class and override this function to reset the access token state when it is stored in other types of containers, like for instance databases.
in OAuthClientInterface at line 213
bool
canRevokeToken()
Determines whether the revokeToken function can be called.
in OAuthClientInterface at line 226
bool
revokeToken(string $tokenTypeHint = 'access_token')
Revoke a previously obtained token so it becomes invalid.
Call this function when you need to invalidate a token that you no longer need to use, so it is not used by any other application.
in OAuthClientInterface at line 235
bool
canLogOut()
Determines whether the logOut function can be called.
in OAuthClientInterface at line 247
logOut(string $redirect = null)
Calls the end-session endpoint to notify the provider that the end-user has logged out of the relying party site.
in OAuthClientInterface at line 259
bool
shouldExit()
Determine if the current script should be exited.
Call this function after calling the authenticate function and exit your script immediately if this function returns true.
in OAuthClientInterface at line 270
string
getAccessToken()
Returns the obtained access token upon successful OAuth authentication.
Call this function to get the obtained access token upon successful OAuth authorization.
in OAuthClientInterface at line 281
string
getRefreshToken()
Returns the obtained refresh token upon successful OAuth authentication.
Call this function to get the obtained refresh token upon successful OAuth authorization.
in OAuthClientInterface at line 291
IdToken
getIdToken()
Returns the obtained ID token upon successful OpenID authentication.
Call this function if the OAuth provider returns id_token values.
in OAuthClientInterface at line 300
OAuthProvider
getProvider()
Returns the current instance of the OAuthProvider class.
in OAuthClientInterface at line 309
OAuthClientStrategy
getStrategy()
Returns the current instance of the OAuthClientStrategy class.
at line 29
object|false
introspectToken(string $token, string $tokenTypeHint = '')
Determines the active state of a token and the meta-information about this token.