Automatically load IdP OIDC configuration (#847)

This commit is contained in:
Bethuel
2023-05-11 16:14:00 +03:00
committed by GitHub
parent e4c28f64fa
commit 2c50d7af1e
9 changed files with 91 additions and 83 deletions

View File

@@ -46,19 +46,19 @@ func TestNewKeycloakManager(t *testing.T) {
assertErrFuncMessage: "should return error when field empty",
}
testCase5Config := defaultTestConfig
testCase5Config.GrantType = "authorization_code"
testCase3Config := defaultTestConfig
testCase3Config.ClientSecret = ""
testCase5 := test{
name: "Wrong GrantType",
inputConfig: testCase5Config,
testCase3 := test{
name: "Missing ClientSecret Configuration",
inputConfig: testCase3Config,
assertErrFunc: require.Error,
assertErrFuncMessage: "should return error when wrong grant type",
assertErrFuncMessage: "should return error when field empty",
}
for _, testCase := range []test{testCase1, testCase2, testCase5} {
for _, testCase := range []test{testCase1, testCase2, testCase3} {
t.Run(testCase.name, func(t *testing.T) {
_, err := NewKeycloakManager(testCase.inputConfig, &telemetry.MockAppMetrics{})
_, err := NewKeycloakManager(OIDCConfig{}, testCase.inputConfig, &telemetry.MockAppMetrics{})
testCase.assertErrFunc(t, err, testCase.assertErrFuncMessage)
})
}