You are here

public static function Utility::getGrantTypes in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/Utility.php \Drupal\oauth2_server\Utility::getGrantTypes()

Returns an array of supported grant types and related data.

3 calls to Utility::getGrantTypes()
ClientForm::form in src/Form/ClientForm.php
Gets the actual form array to be built.
ServerForm::form in src/Form/ServerForm.php
Gets the actual form array to be built.
Utility::startServer in src/Utility.php
Initializes and returns an OAuth2 server.

File

src/Utility.php, line 26

Class

Utility
Contains utility methods for the OAuth2 Server.

Namespace

Drupal\oauth2_server

Code

public static function getGrantTypes() {
  return [
    'authorization_code' => [
      'name' => t('Authorization code'),
      'class' => '\\OAuth2\\OpenID\\GrantType\\AuthorizationCode',
    ],
    'client_credentials' => [
      'name' => t('Client credentials'),
      'class' => '\\OAuth2\\GrantType\\ClientCredentials',
    ],
    'urn:ietf:params:oauth:grant-type:jwt-bearer' => [
      'name' => t('JWT bearer'),
      'class' => '\\OAuth2\\GrantType\\JwtBearer',
    ],
    'refresh_token' => [
      'name' => t('Refresh token'),
      'class' => '\\OAuth2\\GrantType\\RefreshToken',
      'settings callback' => [
        __NAMESPACE__ . '\\Form\\ServerForm',
        'refreshTokenSettings',
      ],
      'default settings' => [
        'always_issue_new_refresh_token' => FALSE,
        'unset_refresh_token_after_use' => TRUE,
      ],
    ],
    'password' => [
      'name' => t('User credentials'),
      'class' => '\\OAuth2\\GrantType\\UserCredentials',
    ],
  ];
}