added apple oauth2 integration

This commit is contained in:
Gani Georgiev
2023-03-01 23:29:45 +02:00
parent 41f01bab0d
commit f5e5fae773
68 changed files with 1019 additions and 242 deletions

View File

@@ -63,6 +63,8 @@ func TestSettingsValidate(t *testing.T) {
s.OIDC2Auth.ClientId = ""
s.OIDC3Auth.Enabled = true
s.OIDC3Auth.ClientId = ""
s.AppleAuth.Enabled = true
s.AppleAuth.ClientId = ""
// check if Validate() is triggering the members validate methods.
err := s.Validate()
@@ -98,6 +100,7 @@ func TestSettingsValidate(t *testing.T) {
`"oidcAuth":{`,
`"oidc2Auth":{`,
`"oidc3Auth":{`,
`"appleAuth":{`,
}
errBytes, _ := json.Marshal(err)
@@ -160,6 +163,8 @@ func TestSettingsMerge(t *testing.T) {
s2.OIDC2Auth.ClientId = "oidc2_test"
s2.OIDC3Auth.Enabled = true
s2.OIDC3Auth.ClientId = "oidc3_test"
s2.AppleAuth.Enabled = true
s2.AppleAuth.ClientId = "apple_test"
if err := s1.Merge(s2); err != nil {
t.Fatal(err)
@@ -243,6 +248,7 @@ func TestSettingsRedactClone(t *testing.T) {
s1.OIDCAuth.ClientSecret = testSecret
s1.OIDC2Auth.ClientSecret = testSecret
s1.OIDC3Auth.ClientSecret = testSecret
s1.AppleAuth.ClientSecret = testSecret
s1Bytes, err := json.Marshal(s1)
if err != nil {
@@ -297,6 +303,7 @@ func TestNamedAuthProviderConfigs(t *testing.T) {
s.OIDCAuth.ClientId = "oidc_test"
s.OIDC2Auth.ClientId = "oidc2_test"
s.OIDC3Auth.ClientId = "oidc3_test"
s.AppleAuth.ClientId = "apple_test"
result := s.NamedAuthProviderConfigs()
@@ -324,6 +331,7 @@ func TestNamedAuthProviderConfigs(t *testing.T) {
`"oidc":{"enabled":false,"clientId":"oidc_test"`,
`"oidc2":{"enabled":false,"clientId":"oidc2_test"`,
`"oidc3":{"enabled":false,"clientId":"oidc3_test"`,
`"apple":{"enabled":false,"clientId":"apple_test"`,
}
for _, p := range expectedParts {
if !strings.Contains(encodedStr, p) {