You are here

function oauth2_server_grant_types in OAuth2 Server 7

Returns an array of supported grant types and related data.

3 calls to oauth2_server_grant_types()
oauth2_server_client_form in includes/oauth2_server.client_admin.inc
Generates the client editing form.
oauth2_server_form in includes/oauth2_server.server_admin.inc
Generates the server editing form.
oauth2_server_start in ./oauth2_server.module
Initializes and returns an OAuth2 server.

File

./oauth2_server.module, line 1127
Provides OAuth2 server functionality.

Code

function oauth2_server_grant_types() {
  $grant_types = array(
    'authorization_code' => array(
      'name' => t('Authorization code'),
      'class' => 'OAuth2\\OpenID\\GrantType\\AuthorizationCode',
    ),
    'client_credentials' => array(
      'name' => t('Client credentials'),
      'class' => 'OAuth2\\GrantType\\ClientCredentials',
    ),
    'urn:ietf:params:oauth:grant-type:jwt-bearer' => array(
      'name' => t('JWT bearer'),
      'class' => 'OAuth2\\GrantType\\JwtBearer',
    ),
    'refresh_token' => array(
      'name' => t('Refresh token'),
      'class' => 'OAuth2\\GrantType\\RefreshToken',
      'settings callback' => 'oauth2_server_refresh_token_settings',
      'default settings' => array(
        'always_issue_new_refresh_token' => FALSE,
        'unset_refresh_token_after_use' => TRUE,
      ),
    ),
    'password' => array(
      'name' => t('User credentials'),
      'class' => 'OAuth2\\GrantType\\UserCredentials',
    ),
  );
  drupal_alter(__FUNCTION__, $grant_types);
  return $grant_types;
}