Skip to content

AS: remembered consent skips the Data Custodian delegation, so the token has no ESPI provisioning or URIs #276

Open

Description

@dfcoffin

Problem

When the Authorization Server already holds the customer's consent for a Third Party, a repeat authorization skips the Data Custodian completely. The Third Party then gets a token with no ESPI provisioning and no token-response URIs.

Found while testing #146 / #275 end to end (local profile): the first Authorize Monthly returned resourceURI and authorizationURI. A second authorization by the same customer in the same browser session returned a token with none of the ESPI keys. Restarting the AS (in-memory consent store) brought the URIs back.

Cause (from the code, to be confirmed with a test)

  1. AuthorizeContinueController saves the customer's approved scope in the OAuth2AuthorizationConsentService (JDBC) so that the replayed /oauth2/authorize passes Spring's consent check.
  2. That consent is persisted and never removed.
  3. On the next /oauth2/authorize for the same client, customer and scope, Spring Authorization Server finds the stored consent. It does not redirect to the consent page (/authorize/delegate) and mints the code directly.
  4. No delegation means no GrantContext in the session. GrantContextEnrichingAuthorizationService stamps nothing, so the token customizer provisions no ESPI Authorization or Subscription, and the token response carries no resourceURI, authorizationURI or customerResourceURI.

Effects

  • The Third Party receives a customer access token that points at no Subscription (REQ.21 6.1.2 requires the URIs).
  • The customer never sees the DC's Authorization Screen for the new authorization, so no per-Function-Block or UsagePoint choice is made, and the DC has no record of it.

Fix

Every ESPI customer authorization must go through the DC delegation. Options:

  • Remove the consent record once the replayed /oauth2/authorize has minted the code, so it is used once only.
  • Or don't use Spring's consent store for this: let the continue step mark the request as approved for that single replay.

Check how this interacts with re-authorization, revocation and refresh (#202).

Tests

  • testcontainers-it: authorize twice for the same customer and client. The second run must redirect to /authorize/delegate, provision a new Subscription and return the URIs.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions