Cookie authentication plugin

Created on 8 February 2018, over 7 years ago
Updated 7 July 2025, about 15 hours ago

In case you want to use migration from one Drupal 8 to another Drupal 8 site it could be handy to have the cookie auth.

Here is the plugin that provides cookie authentication against another Drupal 8 site with rest session token support.

Please review, I hope it would be needed.

Feature request
Status

Needs work

Version

6.0

Component

Plugins

Created by

🇩🇪Germany a.dmitriiev

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • heddn Nicaragua

    Some comments posted below on the code. As far as tests, we are constantly attempting to increase test coverage. Functional tests can mock guzzle responses or work with real test endpoints. Meaning, you could create a test controller/form in a test module that returns all the expected outputs.

    1. +++ b/src/Plugin/migrate_plus/authentication/Cookie.php
      @@ -0,0 +1,106 @@
      + * Provides cookie authentication for the HTTP resource to another Drupal 8 site.
      

      Let's not put versions in comments. Makes maintenance easier if we don't have to keep abreast of versions in the code.

    2. +++ b/src/Plugin/migrate_plus/authentication/Cookie.php
      @@ -0,0 +1,106 @@
      +      'base_url' => $this->configuration['domain'],
      

      if we make this a "url" config option, then we can divine the domain name from it.

    3. +++ b/src/Plugin/migrate_plus/authentication/Cookie.php
      @@ -0,0 +1,106 @@
      +    $loginClient->post($this->configuration['domain'] . '/user/login', [
      

      can we make this more drupal agnostic and have the url be to the login URL?

    4. +++ b/src/Plugin/migrate_plus/authentication/Cookie.php
      @@ -0,0 +1,106 @@
      +    if ($this->configuration['rest']) {
      

      this is very tied to drupal paths. more generic is better as it become more usable across different scenarios.

Production build 0.71.5 2024