You are here

public function AuthCodeAccessExample::codeRouteAccess in OAuth2 Client 8.3

Override the default access with this method.

The sole route that checks this method is `oauth2_client.code` which captures the returned authorization code from the remote service for plugins that implement the grant type of the same name. If you are implementing the authorization_code grant and the default, permission controlled access meets your use case, then you can simply implement Oauth2ClientPluginInterface.

Parameters

\Drupal\Core\Session\AccountInterface $account: Access is checked against this account.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

Overrides Oauth2ClientPluginAccessInterface::codeRouteAccess

File

examples/oauth2_client_example_plugins/src/Plugin/Oauth2Client/AuthCodeAccessExample.php, line 45

Class

AuthCodeAccessExample
Auth code with access example.

Namespace

Drupal\oauth2_client_example_plugins\Plugin\Oauth2Client

Code

public function codeRouteAccess(AccountInterface $account) {
  return AccessResult::allowedIfHasPermissions($account, [
    'access content',
  ]);
}