allow access after the shield authentication, in the case is the core module basic_auth enabled

Issue fork shield-2923801

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dfarouk created an issue. See original summary.

dfarouk’s picture

StatusFileSize
new27.11 KB
dfarouk’s picture

StatusFileSize
new913 bytes
dfarouk’s picture

dakku’s picture

dfarouk’s picture

StatusFileSize
new7.76 KB

this patche allows use endpoint rest and web service calls

dfarouk’s picture

Category: Bug report » Feature request
Priority: Major » Critical
dfarouk’s picture

Status: Active » Patch (to be ported)
Mike Dodd’s picture

StatusFileSize
new7.7 KB

composer did not like that patch file, new one attached

Mike Dodd’s picture

StatusFileSize
new7.6 KB

try that again, no contrib

Mike Dodd’s picture

not working correct, there is a race condition that is causing intermittent problems

dfarouk’s picture

Mike Dodd : In composer.json you use the patch that way

"patches": {
  "drupal/shield": {
    "allows use endpoint rest and web service calls": "https://www.drupal.org/files/issues/shield-basic-auth_2923801_8.x_1.patch"
  },

And it works ;)

douggreen’s picture

Please restore the spacing in this patch. It's difficult to review as-is. I suspect a lot less has changed than is showing here.

R Lodhia’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new4.32 KB

Ported this same patch to the newest dev version of Shield. Tested with Shield 8.x-1.2.

geek-merlin’s picture

Title: fix allow access shield authentication and basic auth » Make shield work with D8 core basic_auth (2)
Status: Needs review » Needs work
Related issues: +#2815945: Make shield work with D8 core basic_auth (1)

This looks similar to the related issue. Please consolidate.
Also going to commit patches touching this code, so probably needs reroll.

naveenvalecha made their first commit to this issue’s fork.

damienmckenna made their first commit to this issue’s fork.

damienmckenna’s picture

Title: Make shield work with D8 core basic_auth (2) » Make shield work with core basic_auth
Status: Needs work » Needs review
Issue tags: -shield

I rerolled the patch as the MR.

damienmckenna’s picture

With the latest fixes the last issue is this test failure:

  public function testShieldWithBasicAuth() {
    // Configure shield, so it is enabled and basic_auth headers are kept.
    // We don't need to test the case with unset_basic_auth_headers to TRUE
    // as it is the default value, it is tested by testShieldCred().
    $this->config('shield.settings')
      ->set('shield_enable', TRUE)
      ->set('unset_basic_auth_headers', FALSE)
      ->save();

    $this->drupalGet('user', [], ['Authorization' => 'Basic ' . base64_encode('user:password')]);
    $this->assertSession()->statusCodeEquals(403);
  }

The problem here is that it suggests the changes aren't working at all?

damienmckenna’s picture

Assigned: dfarouk » Unassigned
damienmckenna’s picture

I just realized that there's no way of controlling the "unset_basic_auth_headers" setting, so it might be worth adding a separate issue for that.

japerry made their first commit to this issue’s fork.

japerry’s picture

Priority: Critical » Normal

Basic Auth in core (for Drupal users is a great idea, but since you can only pass the basic auth parameters once, the user login needs to be tied to shield.

Created an MR that, if core basic_auth is enabled, allow an administrator to enable basic_auth as an option inside shield. This resolves most of the issues found above, and resolves a feature request in #2827060: Allow to authenticate with user credentials

  • japerry committed 7caabe71 on 8.x-1.x
    feat: Issue #2923801: Let requests authenticated by basic_auth pass...
japerry’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.