You are here

auth0.module in Auth0 Single Sign On 8.2

Same filename and directory in other branches
  1. 8 auth0.module
  2. 7.2 auth0.module

Module definition

File

auth0.module
View source
<?php

/**
 * @file
 * Module definition
 */
define('AUTH0_DEFAULT_SCOPES', 'openid email profile');
define('AUTH0_DEFAULT_SIGNING_ALGORITHM', 'RS256');
define('AUTH0_DEFAULT_USERNAME_CLAIM', 'nickname');
define('AUTH0_MODULE_VERSION', '8.x-2.4');

/**
 * Replace a form with the lock widget.
 */
function auth0_theme() {
  return [
    'auth0_login' => [
      'template' => 'auth0-login',
      'variables' => [
        'loginCSS' => NULL,
      ],
    ],
  ];
}

/**
 * Handle users deletion, it should delete the Auth0 profile.
 */
function auth0_user_delete($account) {
  db_delete('auth0_user')
    ->condition('drupal_id', $account->uid->value)
    ->execute();
}

/**
 * Use Refresh Token.
 */
function auth0_signin_with_refresh_token($token) {
  $helper = \Drupal::service('auth0.helper');
  return $helper
    ->getUserUsingRefreshToken($token);
}

/**
 * Implements hook_library_info_build().
 */
function auth0_library_info_build() {
  $config = \Drupal::service('config.factory')
    ->get('auth0.settings');
  return [
    'auth0.widget' => [
      'js' => [
        $config
          ->get('auth0_widget_cdn') => [
          'type' => 'external',
        ],
      ],
    ],
  ];
}

Functions

Namesort descending Description
auth0_library_info_build Implements hook_library_info_build().
auth0_signin_with_refresh_token Use Refresh Token.
auth0_theme Replace a form with the lock widget.
auth0_user_delete Handle users deletion, it should delete the Auth0 profile.

Constants