Loading simple_oauth.module +0 −55 Original line number Diff line number Diff line Loading @@ -5,25 +5,6 @@ * Contains simple_oauth.module.. */ use Drupal\Core\Routing\RouteMatchInterface; use \Drupal\Core\Render\Element; /** * Implements hook_help(). */ function simple_oauth_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { // Main module help for the simple_oauth module. case 'help.page.simple_oauth': $output = ''; $output .= '<h3>' . t('About') . '</h3>'; $output .= '<p>' . t('The OAuth 2.0 Authorization Framework: Bearer Token Usage') . '</p>'; return $output; default: } } /** * Implements hook_cron(). */ Loading @@ -32,39 +13,3 @@ function simple_oauth_cron() { $collector = \Drupal::service('simple_oauth.expired_collector'); $collector->deleteMultipleTokens($collector->collect()); } /** * Implements hook_theme(). */ function simple_oauth_theme($existing, $type, $theme, $path) { return array( 'oauth2_client' => [ 'render element' => 'elements', ] ); } /** * Prepares variables for oauth2_client templates. * * Default template: oauth2-client.html.twig. * * @param array $variables * An associative array containing: * - elements: An array of elements to display in view mode. * - node: The node object. * - view_mode: View mode; e.g., 'full', 'teaser', etc. */ function template_preprocess_oauth2_client(&$variables) { $variables['client'] = $variables['elements']['#oauth2_client']; $variables['view_mode'] = $variables['elements']['#view_mode']; $variables['label'] = $variables['elements']['label']; $variables['description'] = $variables['elements']['description']; $variables['image'] = $variables['elements']['image']; // Helpful $content variable for templates. $variables += array('content' => array()); foreach (Element::children($variables['elements']) as $key) { $variables['content'][$key] = $variables['elements'][$key]; } } simple_oauth.routing.yml +0 −12 Original line number Diff line number Diff line Loading @@ -99,15 +99,3 @@ oauth2_token.token: methods: [POST] requirements: _access: 'TRUE' oauth2_token.user_debug: path: '/oauth/debug' defaults: _controller: 'Drupal\simple_oauth\Controller\Oauth2Token::debug' methods: [GET] requirements: _access: 'TRUE' _format: 'json' options: _auth: ['oauth2'] no_cache: TRUE simple_oauth_3p/simple_oauth_3p.moduledeleted 100644 → 0 +0 −34 Original line number Diff line number Diff line <?php /** * @file * * Module implementation file. */ /** * Implements hook_form_FORM_ID_alter(). */ function simple_oauth_3p_form_oauth2_token_settings_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { $form['use_implicit'] = [ '#type' => 'checkbox', '#title' => t('Enable the implicit grant?'), '#description' => t('The implicit grant has the potential to be used in an insecure way. Only enable this if you understand the risks. See https://tools.ietf.org/html/rfc6819#section-4.4.2 for more information.'), '#default_value' => \Drupal::config('simple_oauth_3p.settings')->get('use_implicit'), ]; $form['#submit'][] = 'simple_oauth_3p_form_oauth2_token_settings_submit'; } /** * Form submission handler. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */ function simple_oauth_3p_form_oauth2_token_settings_submit(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) { $settings = \Drupal::configFactory()->getEditable('simple_oauth_3p.settings'); $settings->set('use_implicit', $form_state->getValue('use_implicit')); $settings->save(); } simple_oauth_3p/config/install/simple_oauth_3p.settings.yml→simple_oauth_extras/config/install/simple_oauth_extras.settings.yml +0 −0 File moved. View file simple_oauth_3p/config/schema/simple_oauth_3p.schema.yml→simple_oauth_extras/config/schema/simple_oauth_extras.schema.yml +1 −1 Original line number Diff line number Diff line simple_oauth_3p.settings: simple_oauth_extras.settings: type: config_object label: 'Simple OAuth 3rd Party Settings' mapping: Loading Loading
simple_oauth.module +0 −55 Original line number Diff line number Diff line Loading @@ -5,25 +5,6 @@ * Contains simple_oauth.module.. */ use Drupal\Core\Routing\RouteMatchInterface; use \Drupal\Core\Render\Element; /** * Implements hook_help(). */ function simple_oauth_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { // Main module help for the simple_oauth module. case 'help.page.simple_oauth': $output = ''; $output .= '<h3>' . t('About') . '</h3>'; $output .= '<p>' . t('The OAuth 2.0 Authorization Framework: Bearer Token Usage') . '</p>'; return $output; default: } } /** * Implements hook_cron(). */ Loading @@ -32,39 +13,3 @@ function simple_oauth_cron() { $collector = \Drupal::service('simple_oauth.expired_collector'); $collector->deleteMultipleTokens($collector->collect()); } /** * Implements hook_theme(). */ function simple_oauth_theme($existing, $type, $theme, $path) { return array( 'oauth2_client' => [ 'render element' => 'elements', ] ); } /** * Prepares variables for oauth2_client templates. * * Default template: oauth2-client.html.twig. * * @param array $variables * An associative array containing: * - elements: An array of elements to display in view mode. * - node: The node object. * - view_mode: View mode; e.g., 'full', 'teaser', etc. */ function template_preprocess_oauth2_client(&$variables) { $variables['client'] = $variables['elements']['#oauth2_client']; $variables['view_mode'] = $variables['elements']['#view_mode']; $variables['label'] = $variables['elements']['label']; $variables['description'] = $variables['elements']['description']; $variables['image'] = $variables['elements']['image']; // Helpful $content variable for templates. $variables += array('content' => array()); foreach (Element::children($variables['elements']) as $key) { $variables['content'][$key] = $variables['elements'][$key]; } }
simple_oauth.routing.yml +0 −12 Original line number Diff line number Diff line Loading @@ -99,15 +99,3 @@ oauth2_token.token: methods: [POST] requirements: _access: 'TRUE' oauth2_token.user_debug: path: '/oauth/debug' defaults: _controller: 'Drupal\simple_oauth\Controller\Oauth2Token::debug' methods: [GET] requirements: _access: 'TRUE' _format: 'json' options: _auth: ['oauth2'] no_cache: TRUE
simple_oauth_3p/simple_oauth_3p.moduledeleted 100644 → 0 +0 −34 Original line number Diff line number Diff line <?php /** * @file * * Module implementation file. */ /** * Implements hook_form_FORM_ID_alter(). */ function simple_oauth_3p_form_oauth2_token_settings_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { $form['use_implicit'] = [ '#type' => 'checkbox', '#title' => t('Enable the implicit grant?'), '#description' => t('The implicit grant has the potential to be used in an insecure way. Only enable this if you understand the risks. See https://tools.ietf.org/html/rfc6819#section-4.4.2 for more information.'), '#default_value' => \Drupal::config('simple_oauth_3p.settings')->get('use_implicit'), ]; $form['#submit'][] = 'simple_oauth_3p_form_oauth2_token_settings_submit'; } /** * Form submission handler. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */ function simple_oauth_3p_form_oauth2_token_settings_submit(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) { $settings = \Drupal::configFactory()->getEditable('simple_oauth_3p.settings'); $settings->set('use_implicit', $form_state->getValue('use_implicit')); $settings->save(); }
simple_oauth_3p/config/install/simple_oauth_3p.settings.yml→simple_oauth_extras/config/install/simple_oauth_extras.settings.yml +0 −0 File moved. View file
simple_oauth_3p/config/schema/simple_oauth_3p.schema.yml→simple_oauth_extras/config/schema/simple_oauth_extras.schema.yml +1 −1 Original line number Diff line number Diff line simple_oauth_3p.settings: simple_oauth_extras.settings: type: config_object label: 'Simple OAuth 3rd Party Settings' mapping: Loading