implements |
Storable |
|---|
An OAuth authorisation.
An OAuth authorisation permits an OAuth client to access resources with a specified scope owned by the resource owner. Authorisation codes, access and refresh tokens are issued based on this authorisation.
Within SimpleID, the owner (usually a user, but can sometimes be the client object itself) and the client must be Storable .
Each authorisation in SimpleID contains a randomly generated authorisation state. The authorisation state is stored permanently along with the authorisation. An authorisation state changes when:
Authorisation codes, access and refresh tokens are issued based on a particular authorisation state. Therefore, if the authorisation state changes, all of these credentials are automatically revoked.
The authorisation ID is a hash of the client and owner IDs. The fully qualified authorisation ID is the authorisation ID along with the current authorisation state.
| Methods | ||
|---|---|---|
public
|
__construct(
Storable $owner,
Storable $client,
string|array<string> $scope = '',
bool $issue_refresh_token = true,
string|null $auth_state = null,
)
|
# |
public
|
getOwner(): Storable
|
# |
public
|
getClient(): Storable
|
# |
protected
|
getStorable(string $ref, array<mixed> $args = []): Storable
|
# |
public
|
getScope(): array<string>
|
# |
public
|
setScope(string|array<string> $scope): void
|
# |
public
|
hasScope(string|array<string> $scope): bool
|
# |
public
|
filterScope(string|array<string> $scope): array<string>
|
# |
public
|
getAuthState(): string
|
# |
public
|
resetAuthState(): string
|
# |
public
|
getIssueRefreshToken(): bool
|
# |
public
|
issueCode(string $redirect_uri, string|array<string> $scope = null, array<string, mixed> $additional = []): string
|
# |
public
|
issueTokens(
array<string> $scope = [],
int $expires_in = Token::TTL_PERPETUAL,
TokenGrantType $grant = null,
array<string, mixed> $additional = [],
): array<string, string>
|
# |
public
|
issueAccessToken(
array<string> $scope = [],
int $expires_in = Token::TTL_PERPETUAL,
TokenGrantType $grant = null,
array<string, mixed> $additional = [],
): array<string, string>
|
# |
protected
|
issueRefreshToken(
array<string> $scope = [],
TokenGrantType $grant = null,
array<string, mixed> $additional = [],
): array<string, string>
|
# |
public
|
revokeTokensFromGrant(TokenGrantType $grant): void
|
# |
public
|
revokeAllTokens(): void
|
# |
public
|
getFullyQualifiedID(): string
|
# |
public
|
getStoreType()
|
# |
public
|
getStoreID()
|
# |
public
|
setStoreID($id)
|
# |
public
static
|
buildID(Storable $owner, Storable $client): string
|
# |
| Constants | |||
|---|---|---|---|
public
|
AUTH_STATE_SEPARATOR = '.'
|
# | |
| Properties | |||
|---|---|---|---|
protected
|
string
|
$owner_ref
|
# |
protected
|
string
|
$client_ref
|
# |
protected
|
array<string>
|
$available_scope
|
# |
protected
|
bool
|
$issue_refresh_token = true
|
# |
public
|
array<string, mixed>
|
$additional = []
|
# |