forked from identitysolutions/auth0-drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth0.module
52 lines (47 loc) · 1.05 KB
/
auth0.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* @file
* Module definition.
*/
const AUTH0_DEFAULT_SCOPES = 'openid email profile';
const AUTH0_DEFAULT_SIGNING_ALGORITHM = 'RS256';
const AUTH0_DEFAULT_USERNAME_CLAIM = 'nickname';
const AUTH0_MODULE_VERSION = '8.x-2.4';
/**
* Implements hook_theme().
*/
function auth0_theme() {
// Replaces a form with the lock widget.
return [
'auth0_login' => [
'template' => 'auth0-login',
'variables' => [
'loginCSS' => NULL,
],
],
];
}
/**
* Implements hook_ENTITY_TYPE_delete().
*/
function auth0_user_delete($account) {
// Handle users deletion, it should delete the Auth0 profile.
\Drupal::database()->delete('auth0_user')
->condition('drupal_id', $account->uid->value)
->execute();
}
/**
* 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',
],
],
],
];
}