MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestFetchCustomProviderConfig

Function TestFetchCustomProviderConfig

auth/oidc_test.go:327–446  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

325}
326
327func 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 }, {

Callers

nothing calls this directly

Calls 9

TestCtxFunction · 0.92
oidcProviderForTestFunction · 0.85
HeaderMethod · 0.80
RunMethod · 0.65
CloseMethod · 0.65
SetMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected