Skip to content

Conversation

@heddn
Copy link

@heddn heddn commented Feb 26, 2025

@heddn
Copy link
Author

heddn commented Feb 27, 2025

This allows usages like:

  Scenario: Creating a node via the API triggers creation
    Given I am authenticating with JWT
    And the JWT will have claim "drupal[uid]" with value 2
    And the JWT will have claim "exp" with value "now + 10 minutes"
    And the "Accept" request header is "application/vnd.api+json"
    And the "Content-type" request header is "application/vnd.api+json"
    Given the request body is:
    """
{
  "data": {
    "type": "node--page",
    "attributes": {
      "title": "My title",
    },
  }
}
    """
    When I request "/jsonapi/node/page" using HTTP "POST"
    Then the response code is 200

@heddn
Copy link
Author

heddn commented Feb 27, 2025

The reason we need to have that "toggle" for JWT in the scenario is that we have JWT and Basic Auth and Cookie authentication options. We can't just brute force everything via a configured guzzle client to use JWT.

@christeredvartsen
Copy link
Member

@heddn
Copy link
Author

heddn commented Mar 7, 2025

By using this extension we no longer have to ignore an error related to
the service container.
@christeredvartsen
Copy link
Member

I just pushed a minor change to this branch, installing the Symfony extension for PHPStan instead of ignoring an error.

Would you be able to provide some tests that showcase the feature added in this branch? Perhaps adding a scenario in the features/jwt-matcher.feature file, or just adding a new feature file?

@pwolanin
Copy link
Contributor

Yes, we will have to look at the test setup - it needs a secret for the JWT in the behat.yml file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants