< Return to Summary | File Generated: Thu Nov 21 2024 17:41:21 GMT+0000 (Coordinated Universal Time)

booking-partner-authentication >> authorization-persisted

Booking Flow:

Opportunity Type:

Feature: Authentication / Booking Partner Authentication for Multiple Seller Systems (Implemented)

Test: Authorization persists when not requesting offline access

When authorisation is requested without offline access and a user has already given permission, consent must not be required.

Running only this test

npm start -- --runInBand test/features/authentication/booking-partner-authentication/implemented/authorization-persisted-test.js

Is this test failing?

The OpenActive Reference Implementation test result for this test can be used as a reference to help with debugging.


✅ 9 passed with 0 failures, 0 warnings and 0 suggestions


✅ Open ID Connect Authentication

Credentials

The test suite is using the credentials configured by bookingPartnersForSpecificTests.authorizationPersisted.authentication.clientCredentials for this test:

Discovery Request

GET https://localhost:5003/.well-known/openid-configuration


Response status code: 200.

{
  "issuer": "https://localhost:5003",
  "jwks_uri": "https://localhost:5003/.well-known/openid-configuration/jwks",
  "authorization_endpoint": "https://localhost:5003/connect/authorize",
  "token_endpoint": "https://localhost:5003/connect/token",
  "userinfo_endpoint": "https://localhost:5003/connect/userinfo",
  "end_session_endpoint": "https://localhost:5003/connect/endsession",
  "check_session_iframe": "https://localhost:5003/connect/checksession",
  "revocation_endpoint": "https://localhost:5003/connect/revocation",
  "introspection_endpoint": "https://localhost:5003/connect/introspect",
  "device_authorization_endpoint": "https://localhost:5003/connect/deviceauthorization",
  "frontchannel_logout_supported": true,
  "frontchannel_logout_session_supported": true,
  "backchannel_logout_supported": true,
  "backchannel_logout_session_supported": true,
  "scopes_supported": [
    "openid",
    "openactive-identity",
    "openactive-openbooking",
    "openactive-ordersfeed",
    "offline_access"
  ],
  "claims_supported": [
    "sub",
    "https://openactive.io/sellerId",
    "https://openactive.io/sellerName",
    "https://openactive.io/sellerUrl",
    "https://openactive.io/sellerLogo",
    "https://openactive.io/bookingServiceName",
    "https://openactive.io/bookingServiceUrl",
    "name",
    "https://openactive.io/clientId"
  ],
  "grant_types_supported": [
    "authorization_code",
    "client_credentials",
    "refresh_token",
    "implicit",
    "urn:ietf:params:oauth:grant-type:device_code"
  ],
  "response_types_supported": [
    "code",
    "token",
    "id_token",
    "id_token token",
    "code id_token",
    "code token",
    "code id_token token"
  ],
  "response_modes_supported": [
    "form_post",
    "query",
    "fragment"
  ],
  "token_endpoint_auth_methods_supported": [
    "client_secret_basic",
    "client_secret_post"
  ],
  "id_token_signing_alg_values_supported": [
    "RS256"
  ],
  "subject_types_supported": [
    "public"
  ],
  "code_challenge_methods_supported": [
    "plain",
    "S256"
  ],
  "request_parameter_supported": true,
  "registration_endpoint": "https://localhost:5003/connect/register"
}

Authorization Code Flow (first attempt) - 1 Request

POST http://localhost:3000/browser-automation-for-auth

{
  "headless": true,
  "offlineAccess": true,
  "username": "test1",
  "password": "test1",
  "authorizationUrl": "https://localhost:5003/connect/authorize?client_id=clientid_801&scope=openid%20openactive-identity&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcb&code_challenge=JYqMS5ALKI6P97pN6GA4oAcVXNYcllqbIjfjffJmq18&code_challenge_method=S256"
}

Screenshot: Login page

"https://localhost:5003/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3Dclientid_801%26scope%3Dopenid%2520openactive-identity%26response_type%3Dcode%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A3000%252Fcb%26code_challenge%3DJYqMS5ALKI6P97pN6GA4oAcVXNYcllqbIjfjffJmq18%26code_challenge_method%3DS256"

Screenshot: Login page

Screenshot: Authorization page

"https://localhost:5003/consent?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3Dclientid_801%26scope%3Dopenid%2520openactive-identity%26response_type%3Dcode%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A3000%252Fcb%26code_challenge%3DJYqMS5ALKI6P97pN6GA4oAcVXNYcllqbIjfjffJmq18%26code_challenge_method%3DS256"

Screenshot: Authorization page

Callback URL

"/cb?code=ED83B356D6B024AA55A3A9246B946360539A345855F2B4E8D2BEA035F8BDAACA&scope=openid%20openactive-identity&session_state=HKmejDIz5Y1QLcfmkqaZ-URZk0GXD8sjdIKt0qOomaA.76C7A0DFAAEF3C6169D6C4AB255752A9"

Authorization Code Flow (first attempt) - 2 Request

POST https://localhost:5003/connect/token

"grant_type=authorization_code&code=ED83B356D6B024AA55A3A9246B946360539A345855F2B4E8D2BEA035F8BDAACA&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcb&code_verifier=q_QpYkPVdMIMJ9aGuH7xsp1ueCdCnfaPq-_eB_71FPU"

Response status code: 200.

{
  "id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IkIwNEY3QjkxREUzQjk0NzhDNjE4MzNGQjI0QUE1Q0RCIiwidHlwIjoiSldUIn0.eyJuYmYiOjE3MzIyMTA4ODMsImV4cCI6MTczMjIxMTE4MywiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwMyIsImF1ZCI6ImNsaWVudGlkXzgwMSIsImlhdCI6MTczMjIxMDg4MywiYXRfaGFzaCI6InZCcDdnSzduVGE2dHdZN0JJb00yOVEiLCJzaWQiOiJENEVEMDdFOEFCRjU1NkVEQ0RBNjU3MDI2RDIxQTA5QyIsInN1YiI6IjEwMCIsImF1dGhfdGltZSI6MTczMjIxMDg4MiwiaWRwIjoibG9jYWwiLCJodHRwczovL29wZW5hY3RpdmUuaW8vc2VsbGVyTmFtZSI6IkFjbWUgRml0bmVzcyBMdGQiLCJodHRwczovL29wZW5hY3RpdmUuaW8vc2VsbGVySWQiOiJodHRwczovL2xvY2FsaG9zdDo1MDAxL2FwaS9pZGVudGlmaWVycy9zZWxsZXJzLzEiLCJodHRwczovL29wZW5hY3RpdmUuaW8vc2VsbGVyVXJsIjoiaHR0cHM6Ly93d3cuZXhhbXBsZS5jb20iLCJodHRwczovL29wZW5hY3RpdmUuaW8vc2VsbGVyTG9nbyI6Imh0dHBzOi8vcGxhY2VraXR0ZW4uY29tLzY0MC8zNjAiLCJhbXIiOlsicHdkIl19.xbWPiWcs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zkh5wZVSTj1Oo14sl61N1gle-C28hLEXQiEw8_PrC2vIimhLBKVE_Ee7Od0H_yBVKBjujcQweuvV6WXyoaC71RCOzGABqGHgu7mj0APlLiZbWRIQF1Z6ZVtKtqW2ZcDEAhcUo1-XlMY-tdZPck828IDbynkBYWVYxiNAw",
  "expires_in": 3600,
  "token_type": "Bearer",
  "scope": "openid openactive-identity"
}

Authorization Code Flow (first attempt) - 3 Request

GET https://localhost:5003/.well-known/openid-configuration/jwks


Response status code: 200.

{
  "keys": [
    {
      "kty": "RSA",
      "use": "sig",
      "kid": "B04F7B91DE3B9478C61833FB24AA5CDB",
      "e": "AQAB",
      "n": "yZO68vCGrvfBQ5R1z0DVCRAADOWeF3aLlhOaz1Je1SnmohmmlO-1F1hkRM_4MJtR5aECMxMz-MUW1nBCPmUrH0h_rrdCdDdlk8vTHki0ixK-gO73W2ZscOCZ6L2fZ2Oqz0_I840cnSCv55zpiOk9oGJL9TEsLAWYAIyQheaqZO3BkqImuBFmaLVTckvaZeONjHDQa01rxEjRQByir6oYSZPJy54XuRQJaPuCVNeOW8r0R9rKUQf9nl7tnVvhCsU3q1-UPrs8ZW_kaYXuYQJJMk392jX6XNm6czehIYM-O8Z5eGFdR3WW7IAWYEmqTCxrCRuuKU-EEcKOwksx8gBPgQ",
      "alg": "RS256"
    }
  ]
}

Authorization Code Flow (first attempt) - Claims Result

id_token claims:

{
  "nbf": 1732210883,
  "exp": 1732211183,
  "iss": "https://localhost:5003",
  "aud": "clientid_801",
  "iat": 1732210883,
  "at_hash": "vBp7gK7nTa6twY7BIoM29Q",
  "sid": "D4ED07E8ABF556EDCDA657026D21A09C",
  "sub": "100",
  "auth_time": 1732210882,
  "idp": "local",
  "https://openactive.io/sellerName": "Acme Fitness Ltd",
  "https://openactive.io/sellerId": "https://localhost:5001/api/identifiers/sellers/1",
  "https://openactive.io/sellerUrl": "https://www.example.com",
  "https://openactive.io/sellerLogo": "https://placekitten.com/640/360",
  "amr": [
    "pwd"
  ]
}

Authorization Code Flow (second attempt) - 1 Request

POST http://localhost:3000/browser-automation-for-auth

{
  "headless": true,
  "offlineAccess": true,
  "username": "test1",
  "password": "test1",
  "authorizationUrl": "https://localhost:5003/connect/authorize?client_id=clientid_801&scope=openid%20openactive-identity&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcb&code_challenge=DcJw4uJlDxXcF03NxnFllrlsIC734iUW1hvMA5DKmjA&code_challenge_method=S256"
}

Screenshot: Login page

"https://localhost:5003/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3Dclientid_801%26scope%3Dopenid%2520openactive-identity%26response_type%3Dcode%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A3000%252Fcb%26code_challenge%3DDcJw4uJlDxXcF03NxnFllrlsIC734iUW1hvMA5DKmjA%26code_challenge_method%3DS256"

Screenshot: Login page

Callback URL

"/cb?code=8FCC76A67CEC8FF90406B93724B2EA494479ECBEA0B0DB75A9167B9EAC5BDA77&scope=openid%20openactive-identity&session_state=vF91A7kMhnYF6m4xwHYHv9hZ4wiOq0YAOVwgAe47UkU.61AD42FB7E64190F17D2CFE23D9E1B32"

Authorization Code Flow (second attempt) - 2 Request

POST https://localhost:5003/connect/token

"grant_type=authorization_code&code=8FCC76A67CEC8FF90406B93724B2EA494479ECBEA0B0DB75A9167B9EAC5BDA77&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcb&code_verifier=M-aD2iQgJuzaYBBVTZJUGS6ozlvyEvIMc_PYcym6OSE"

Response status code: 200.

{
  "id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IkIwNEY3QjkxREUzQjk0NzhDNjE4MzNGQjI0QUE1Q0RCIiwidHlwIjoiSldUIn0.eyJuYmYiOjE3MzIyMTA4ODMsImV4cCI6MTczMjIxMTE4MywiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwMyIsImF1ZCI6ImNsaWVudGlkXzgwMSIsImlhdCI6MTczMjIx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sImNsaWVudF9pZCI6ImNsaWVudGlkXzgwMSIsImh0dHBzOi8vb3BlbmFjdGl2ZS5pby9jbGllbnRJZCI6ImNsaWVudGlkXzgwMSIsInN1YiI6IjEwMCIsImF1dGhfdGltZSI6MTczMjIxMDg4MywiaWRwIjoibG9jYWwiLCJqdGkiOiI0RTkzMDlCMENEMTQ5RDUyODI2MjkzM0QwQjkyNTFENyIsInNpZCI6IkM2NjFGODBFREU3NjJFODdGNDBBMUMyOUYyOTAxNDQzIiwiaWF0IjoxNzMyMjEwODgzLCJzY29wZSI6WyJvcGVuaWQiLCJvcGVuYWN0aXZlLWlkZW50aXR5Il0sImFtciI6WyJwd2QiXX0.NCGgkEJQGY4j_x47OzYJu18dTy9JTej_t2SwEdCxllsF7UNIYQAU7mVfdKgo6r5hGPY68uFmemAnAW8rtOcKQV3TWSsJ0lTLhEPEkYGJE1Q6-5G7gd77HuWHELISzOxY-cCJUJHnK2pFf_WeljhVdVxBlhRuCRPTeTRKZcjxGE3VkDChHXqsjAhvb9Lhkg-dyQVtbZKgu2ZN8Y15IYmRZ9iEt5Ut9LeYe8T0h-3hyQwAfkw-4EGpF72u_wQSREXpZeGVfG0xbtnmrsOI9Ug8faQ8OEfGkR7ZQPi8xaKUdLZzpUaichfwgSW8WagIt9Yel5z9HEkWWyt3cnHMx-cGjw",
  "expires_in": 3600,
  "token_type": "Bearer",
  "scope": "openid openactive-identity"
}

Authorization Code Flow (second attempt) - Claims Result

id_token claims:

{
  "nbf": 1732210883,
  "exp": 1732211183,
  "iss": "https://localhost:5003",
  "aud": "clientid_801",
  "iat": 1732210883,
  "at_hash": "oyGvU7XqaYguN56A0E5P3A",
  "sid": "C661F80EDE762E87F40A1C29F2901443",
  "sub": "100",
  "auth_time": 1732210883,
  "idp": "local",
  "https://openactive.io/sellerName": "Acme Fitness Ltd",
  "https://openactive.io/sellerId": "https://localhost:5001/api/identifiers/sellers/1",
  "https://openactive.io/sellerUrl": "https://www.example.com",
  "https://openactive.io/sellerLogo": "https://placekitten.com/640/360",
  "amr": [
    "pwd"
  ]
}

Specs