(nid uuid.UUID, state flow.State)
| 33 | ) |
| 34 | |
| 35 | func createTestFlow(nid uuid.UUID, state flow.State) *flow.Flow { |
| 36 | return &flow.Flow{ |
| 37 | ID: "a12bf95e-ccfc-45fc-b10d-1358790772c7", |
| 38 | NID: nid, |
| 39 | RequestedScope: []string{"openid", "profile"}, |
| 40 | RequestedAudience: []string{"https://api.example.org"}, |
| 41 | LoginSkip: true, |
| 42 | Subject: "test-subject", |
| 43 | OpenIDConnectContext: &flow.OAuth2ConsentRequestOpenIDConnectContext{ |
| 44 | ACRValues: []string{"http://acrvalues.example.org"}, |
| 45 | UILocales: []string{"en-US", "en-GB"}, |
| 46 | Display: "page", |
| 47 | IDTokenHintClaims: map[string]interface{}{"email": "user@example.org"}, |
| 48 | LoginHint: "login-hint", |
| 49 | }, |
| 50 | Client: &client.Client{ |
| 51 | ID: "a12bf95e-ccfc-45fc-b10d-1358790772c7", |
| 52 | NID: nid, |
| 53 | }, |
| 54 | ClientID: "a12bf95e-ccfc-45fc-b10d-1358790772c7", |
| 55 | RequestURL: "https://example.org/oauth2/auth?client_id=test", |
| 56 | SessionID: "session-123", |
| 57 | IdentityProviderSessionID: "session-id", |
| 58 | LoginCSRF: "login-csrf", |
| 59 | RequestedAt: time.Now(), |
| 60 | State: state, |
| 61 | LoginRemember: true, |
| 62 | LoginRememberFor: 3000, |
| 63 | LoginExtendSessionLifespan: true, |
| 64 | ACR: "http://acrvalues.example.org", |
| 65 | AMR: []string{"pwd"}, |
| 66 | ForceSubjectIdentifier: "forced-subject", |
| 67 | Context: sqlxx.JSONRawMessage(`{"foo":"bar"}`), |
| 68 | LoginAuthenticatedAt: sqlxx.NullTime(time.Date(2025, 10, 9, 12, 52, 0, 0, time.UTC)), |
| 69 | DeviceChallengeID: "device-challenge", |
| 70 | DeviceCodeRequestID: "device-code-request", |
| 71 | DeviceCSRF: "device-csrf", |
| 72 | DeviceHandledAt: sqlxx.NullTime{}, |
| 73 | ConsentRequestID: "consent-request", |
| 74 | ConsentSkip: true, |
| 75 | ConsentCSRF: "consent-csrf", |
| 76 | GrantedScope: []string{"openid"}, |
| 77 | GrantedAudience: []string{"https://api.example.org"}, |
| 78 | ConsentRemember: true, |
| 79 | ConsentRememberFor: new(3000), |
| 80 | ConsentHandledAt: sqlxx.NullTime{}, |
| 81 | SessionIDToken: map[string]interface{}{"sub": "test-subject", "foo": "bar"}, |
| 82 | SessionAccessToken: map[string]interface{}{"scp": []string{"openid", "profile"}, "aud": []string{"https://api.example.org"}}, |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | func TestDecodeFromLoginChallenge(t *testing.T) { |
| 87 | ctx := t.Context() |
no test coverage detected