AccessToken

AccessToken extension to the User interface

package

Default

Methods

__construct

__construct() 

The Access Token if present parsed as a JsonObject

accessToken() : array

Response

array

JSON

The User object will cache any authorities that it knows it has to avoid hitting the underlying auth provider each time. Use this method if you want to clear this cache.

clearCache() : $this

Response

$this

the User to enable fluent use

Check if the access token is expired or not.

expired() : boolean

Response

boolean

Fetches a JSON resource using this Access Token.

fetch( $arg0,  $arg1,  $arg2 = null,  $arg3 = null,  $arg4 = null) : $this

param $resource [string] - the resource to fetch. param $callback [callable] - The callback function returning the results. fetch($resource, $callback)

Fetches a JSON resource using this Access Token.

param $method [string] - the HTTP method to user. param $resource [string] - the resource to fetch. param $headers [array] - extra headers to pass to the request. param $payload [Buffer] - payload to send to the server. param $callback [callable] - The callback function returning the results. fetch($method, $resource, $headers, $payload, $callback)

Arguments

$arg0

string

$arg1

callable | string

$arg2

array

$arg3

Buffer

$arg4

callable

Response

$this

The Id Token if present parsed as a JsonObject

idToken() : array

Response

array

JSON

Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid.

introspect( $arg0,  $arg1 = null) : $this

param $callback [callable] - The callback function returning the results. introspect($callback)

Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid.

param $tokenType [string] - A String containing the type of token to revoke. Should be either "access_token" or "refresh_token". param $callback [callable] - The callback function returning the results. introspect($tokenType, $callback)

Arguments

$arg0

callable | string

$arg1

callable

Response

$this

isAuthorised

isAuthorised( $arg0,  $arg1) : $this
deprecated

Arguments

$arg0

string

$arg1

callable

Response

$this

Is the user authorised to

isAuthorized( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

the User to enable fluent use

Revoke refresh token and calls the logout endpoint. This is a openid-connect extension and might not be available on all providers.

logout( $arg0) : $this

Arguments

$arg0

callable

Response

$this

The RAW String if available for the Access Token

opaqueAccessToken() : string

Response

string

String

The RAW String if available for the Id Token

opaqueIdToken() : string

Response

string

String

The RAW String if available for the Refresh Token

opaqueRefreshToken() : string

Response

string

String

Get the underlying principal for the User. What this actually returns depends on the implementation.

principal() : array

For a simple user/password based auth, it's likely to contain a JSON object with the following structure:

  {
    "username", "tim"
  }

Response

array

JSON representation of the Principal

Refresh the access token

refresh( $arg0) : $this

Arguments

$arg0

callable

Response

$this

The Refresh Token if present parsed as a JsonObject

refreshToken() : array

Response

array

JSON

Revoke access or refresh token

revoke( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Set the auth provider for the User. This is typically used to reattach a detached User with an AuthProvider, e.g.

setAuthProvider( $arg0) : void

after it has been deserialized.

Arguments

$arg0

AuthProvider

setTrustJWT

setTrustJWT( $arg0) : $this

Arguments

$arg0

boolean

Response

$this

tokenType

tokenType() : string

Response

string

Load the user info as per OIDC spec.

userInfo( $arg0) : $this

Arguments

$arg0

callable

Response

$this