| Methods |
protected
|
__construct()
Creates an authorization code. This is used by this class's static
methods to create an instance of this class.
Creates an authorization code. This is used by this class's static
methods to create an instance of this class.
|
#
|
public
static
|
decode(string $code): Code|null
Decodes an existing authorization code.
Decodes an existing authorization code.
Note that this method does not check whether the authorization
code is valid issued or has not been revoked. You should always
use the isValid() method to check the validity of the
authorization code before using it to issue tokens.
Parameters
| $code |
the authorization code
|
Returns
the authorization code object
|
#
|
protected
static
|
load(string $code): Code|null
Loads an existing authorization code.
Loads an existing authorization code.
Parameters
| $code |
the authorization code
|
Returns
the authorization code object
|
#
|
public
static
|
create(
Authorization $authorization,
string|null $redirect_uri,
array<string>|string $scope,
array<string, mixed> $additional = [],
): Code
Creates an authorization code.
Creates an authorization code.
Once the authorization code object has been created, the code can be retrieved using
the getCode() method.
Parameters
| $authorization |
the authorization that wishes to generate
this code
|
| $redirect_uri |
the redirect_uri parameter in the authorisation request, if
present
|
| $scope |
the allowed scope - this should be a subset of the scope provided by the
authorization
|
| $additional |
additional data to be stored in the authorization code
|
Returns
the authorization code object
|
#
|
public
|
isValid(): bool
Determine whether an authorization code is valid.
Determine whether an authorization code is valid.
An authorization code is valid if:
- it is created directly by the create() static method; or
- it has been decoded using the decode() static method, and
has been validated by SimpleID.
Returns
true if the authorization code is valid
Implements
|
#
|
public
|
getCode(): string
Returns the authorization code.
Returns the authorization code.
Returns
|
#
|
public
|
getAuthorization(): Authorization|null
Returns the OAuth authorization that generated this code.
Returns the OAuth authorization that generated this code.
If the authorization has been revoked, or is otherwise invalid, since
the authorization code has been issued, this function will return
null.
Returns
the OAuth authorization or null.
|
#
|
public
|
getRedirectURI(): string
Returns the redirect_uri bound to this authorization code.
Returns the redirect_uri bound to this authorization code.
If a redirect_uri parameter is present in the authorization request,
then the authorization code is bound to that redirect_uri. This
redirect_uri, if present, must be checked against the token request
before an access token can be issued.
If a redirect_uri parameter is not present in the authorization request,
i.e. the pre-registered redirect URI is used, then this function will
return null.
Returns
|
#
|
public
|
getScope(): array<string>
Returns the scope authorised by this authorization code. Access tokens
issued from this authorization code must have this scope.
Returns the scope authorised by this authorization code. Access tokens
issued from this authorization code must have this scope.
Returns
|
#
|
public
|
getAdditional(): array<string, mixed>
Returns additional data associated with this authorization code.
Returns additional data associated with this authorization code.
Returns
|
#
|
public
|
clear(): void
Deletes the authorization code from the cache, rendering it invalid.
Deletes the authorization code from the cache, rendering it invalid.
|
#
|
public
|
getGrantRef()
Returns a reference to the identifier of the artefact that
granted the token.
Returns a reference to the identifier of the artefact that
granted the token.
Normally the reference is simply a substring of the artefact's
ID.
Returns
the reference of the grant identifier
Implements
|
#
|