(t *testing.T)
| 325 | } |
| 326 | |
| 327 | func TestFetchCustomProviderConfig(t *testing.T) { |
| 328 | tests := []struct { |
| 329 | name string |
| 330 | data string |
| 331 | trailingSlash bool |
| 332 | wantAuthURL string |
| 333 | wantTokenURL string |
| 334 | wantUserInfoURL string |
| 335 | wantAlgorithms []string |
| 336 | wantErr bool |
| 337 | }{{ |
| 338 | name: "basic_case", |
| 339 | data: `{ |
| 340 | "issuer": "${issuer}", |
| 341 | "authorization_endpoint": "https://example.com/auth", |
| 342 | "token_endpoint": "https://example.com/token", |
| 343 | "jwks_uri": "https://example.com/keys", |
| 344 | "id_token_signing_alg_values_supported": ["RS256"] |
| 345 | }`, |
| 346 | wantAuthURL: "https://example.com/auth", |
| 347 | wantTokenURL: "https://example.com/token", |
| 348 | wantAlgorithms: []string{"RS256"}, |
| 349 | }, { |
| 350 | name: "additional_algorithms", |
| 351 | data: `{ |
| 352 | "issuer": "${issuer}", |
| 353 | "authorization_endpoint": "https://example.com/auth", |
| 354 | "token_endpoint": "https://example.com/token", |
| 355 | "jwks_uri": "https://example.com/keys", |
| 356 | "id_token_signing_alg_values_supported": ["RS256", "RS384", "ES256"] |
| 357 | }`, |
| 358 | wantAuthURL: "https://example.com/auth", |
| 359 | wantTokenURL: "https://example.com/token", |
| 360 | wantAlgorithms: []string{"RS256", "RS384", "ES256"}, |
| 361 | }, { |
| 362 | name: "mismatched_issuer", |
| 363 | data: `{ |
| 364 | "issuer": "https://example.com", |
| 365 | "authorization_endpoint": "https://example.com/auth", |
| 366 | "token_endpoint": "https://example.com/token", |
| 367 | "jwks_uri": "https://example.com/keys", |
| 368 | "id_token_signing_alg_values_supported": ["RS256"] |
| 369 | }`, |
| 370 | wantErr: true, |
| 371 | }, { |
| 372 | name: "issuer_with_trailing_slash", |
| 373 | data: `{ |
| 374 | "issuer": "${issuer}", |
| 375 | "authorization_endpoint": "https://example.com/auth", |
| 376 | "token_endpoint": "https://example.com/token", |
| 377 | "jwks_uri": "https://example.com/keys", |
| 378 | "id_token_signing_alg_values_supported": ["RS256"] |
| 379 | }`, |
| 380 | trailingSlash: true, |
| 381 | wantAuthURL: "https://example.com/auth", |
| 382 | wantTokenURL: "https://example.com/token", |
| 383 | wantAlgorithms: []string{"RS256"}, |
| 384 | }, { |
nothing calls this directly
no test coverage detected