(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestEncoding(t *testing.T) { |
| 26 | f := flow.Flow{ |
| 27 | ID: "test-flow-id", |
| 28 | NID: uuid.FromStringOrNil("735c9c15-3d07-4501-9800-4e5e0599e57b"), |
| 29 | RequestedScope: []string{"scope1", "scope2"}, |
| 30 | RequestedAudience: []string{"https://api.example.org/v1", "https://api.example.org/v2"}, |
| 31 | LoginSkip: false, |
| 32 | Subject: "some-subject@some-idp-somewhere.com", |
| 33 | OpenIDConnectContext: &flow.OAuth2ConsentRequestOpenIDConnectContext{ |
| 34 | ACRValues: []string{"acr1", "acr2"}, |
| 35 | UILocales: []string{"en-US", "en-GB"}, |
| 36 | Display: "page", |
| 37 | IDTokenHintClaims: map[string]interface{}{"claim1": "value1", "claim2": "value2"}, |
| 38 | LoginHint: "some-login-hint", |
| 39 | }, |
| 40 | Client: &client.Client{ |
| 41 | ID: "test-client-id", |
| 42 | NID: uuid.FromStringOrNil("735c9c15-3d07-4501-9800-4e5e0599e57b"), |
| 43 | Name: "some-client-name", |
| 44 | Secret: "some-supersafe-secret", |
| 45 | RedirectURIs: []string{ |
| 46 | "https://redirect1.example.org/callback", |
| 47 | "https://redirect2.example.org/callback", |
| 48 | }, |
| 49 | GrantTypes: []string{"authorization_code", "refresh_token"}, |
| 50 | ResponseTypes: []string{"code"}, |
| 51 | Scope: "scope1 scope2", |
| 52 | Audience: sqlxx.StringSliceJSONFormat{"https://api.example.org/v1 https://api.example.org/v2"}, |
| 53 | Owner: "some-owner", |
| 54 | TermsOfServiceURI: "https://tos.example.org", |
| 55 | PolicyURI: "https://policy.example.org", |
| 56 | ClientURI: "https://client.example.org", |
| 57 | LogoURI: "https://logo.example.org", |
| 58 | Contacts: []string{"contact1", "contact2"}, |
| 59 | SubjectType: "public", |
| 60 | JSONWebKeysURI: "https://jwks.example.org", |
| 61 | JSONWebKeys: nil, // TODO? |
| 62 | TokenEndpointAuthMethod: "client_secret_basic", |
| 63 | CreatedAt: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC), |
| 64 | UpdatedAt: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC), |
| 65 | AllowedCORSOrigins: []string{"https://cors1.example.org", "https://cors2.example.org"}, |
| 66 | Metadata: sqlxx.JSONRawMessage(`{"client-metadata-key1": "val1"}`), |
| 67 | AccessTokenStrategy: "jwt", |
| 68 | SkipConsent: true, |
| 69 | }, |
| 70 | RequestURL: "https://auth.hydra.local/oauth2/auth?client_id=some-client-id&response_type=code&scope=scope1+scope2&redirect_uri=https%3A%2F%2Fredirect1.example.org%2Fcallback&state=some-state&nonce=some-nonce", |
| 71 | SessionID: sqlxx.NullString("some-session-id"), |
| 72 | LoginCSRF: "test-login-csrf", |
| 73 | RequestedAt: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC), |
| 74 | State: 1, |
| 75 | LoginRemember: true, |
| 76 | LoginRememberFor: 3600, |
| 77 | Context: sqlxx.JSONRawMessage(`{"context-key1": "val1"}`), |
| 78 | GrantedScope: []string{"scope1", "scope2"}, |
| 79 | GrantedAudience: []string{"https://api.example.org/v1", "https://api.example.org/v2"}, |
| 80 | ConsentRemember: true, |
| 81 | ConsentRememberFor: new(3600), |
| 82 | ConsentHandledAt: sqlxx.NullTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)), |
nothing calls this directly
no test coverage detected