class DeviceAuthorizationController

Traits

Methods

mixed
withErrorHandling(Closure $callback)

Perform the given callback with exception handling.

mixed
withAuthorizationErrorHandling(Closure $callback, array $pending, AuthorizationResponse $responses)

Render authorization errors after rollback using the validated interaction context.

getApprovingGuard()

Resolve the guard authorizing the current request.

string
getApprovingGuardName()

Get the name of the guard authorizing the current request.

string|null
getApprovingProvider()

Get the approving guard's user provider.

array
authorizationState(Request $request, array $parameters, Authenticatable $user, Client $client, array $scopes, AuthorizationRequestInterface|DeviceCodeEntityInterface $authorization, Dispatcher $events)

Capture the approving identity and synchronous extension decisions.

void
ensureApprovingUser(array $pending)

Ensure the consent belongs to the current user and provider.

array
getPendingAuthorization(Request $request)

Get the pending interaction selected by a browser decision.

getClientForApproval(string $identifier, string $grantType, array $scopes)

Recheck the client and scopes saved with the consent request.

__construct(AuthManager $auth, DeviceCodeRepository $deviceCodes, ClientRepository $clients, Repository $config, PendingAuthorizationRepository $pending, Dispatcher $events)

Create a new controller instance.

__invoke(Request $request, DeviceAuthorizationViewResponse $viewResponse)

Authorize a device to access the user's account.

array
parseScopes(DeviceCodeEntityInterface $deviceCode)

Transform the device code entity's scopes into Scope instances.

Details

in HandlesOAuthErrors at line 25
protected mixed withErrorHandling(Closure $callback)

Perform the given callback with exception handling.

Parameters

Closure $callback

Return Value

mixed

Exceptions

OAuthServerException

in HandlesOAuthErrors at line 42
protected mixed withAuthorizationErrorHandling(Closure $callback, array $pending, AuthorizationResponse $responses)

Render authorization errors after rollback using the validated interaction context.

Parameters

Closure $callback
array $pending
AuthorizationResponse $responses

Return Value

mixed

protected StatefulGuard getApprovingGuard()

Resolve the guard authorizing the current request.

Return Value

StatefulGuard

protected string getApprovingGuardName()

Get the name of the guard authorizing the current request.

Return Value

string

protected string|null getApprovingProvider()

Get the approving guard's user provider.

Return Value

string|null

protected array authorizationState(Request $request, array $parameters, Authenticatable $user, Client $client, array $scopes, AuthorizationRequestInterface|DeviceCodeEntityInterface $authorization, Dispatcher $events)

Capture the approving identity and synchronous extension decisions.

Parameters

Request $request
array $parameters
Authenticatable $user
Client $client
array $scopes
AuthorizationRequestInterface|DeviceCodeEntityInterface $authorization
Dispatcher $events

Return Value

array

protected void ensureApprovingUser(array $pending)

Ensure the consent belongs to the current user and provider.

Parameters

array $pending

Return Value

void

protected array getPendingAuthorization(Request $request)

Get the pending interaction selected by a browser decision.

Parameters

Request $request

Return Value

array

protected Client getClientForApproval(string $identifier, string $grantType, array $scopes)

Recheck the client and scopes saved with the consent request.

Parameters

string $identifier
string $grantType
array $scopes

Return Value

Client

at line 33
__construct(AuthManager $auth, DeviceCodeRepository $deviceCodes, ClientRepository $clients, Repository $config, PendingAuthorizationRepository $pending, Dispatcher $events)

Create a new controller instance.

Parameters

AuthManager $auth
DeviceCodeRepository $deviceCodes
ClientRepository $clients
Repository $config
PendingAuthorizationRepository $pending
Dispatcher $events

at line 46
RedirectResponse|DeviceAuthorizationViewResponse __invoke(Request $request, DeviceAuthorizationViewResponse $viewResponse)

Authorize a device to access the user's account.

at line 103
protected array parseScopes(DeviceCodeEntityInterface $deviceCode)

Transform the device code entity's scopes into Scope instances.

Parameters

DeviceCodeEntityInterface $deviceCode

Return Value

array