diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderModelTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderModelTest.java index 2dd3164575..45f638cac6 100644 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderModelTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderModelTest.java @@ -18,6 +18,7 @@ package org.keycloak.testsuite.broker; import org.junit.Before; +import org.keycloak.broker.kerberos.KerberosIdentityProviderFactory; import org.keycloak.broker.oidc.OIDCIdentityProviderFactory; import org.keycloak.broker.saml.SAMLIdentityProviderFactory; import org.keycloak.social.facebook.FacebookIdentityProviderFactory; @@ -47,6 +48,7 @@ public abstract class AbstractIdentityProviderModelTest extends AbstractModelTes this.expectedProviders.add(FacebookIdentityProviderFactory.PROVIDER_ID); this.expectedProviders.add(GitHubIdentityProviderFactory.PROVIDER_ID); this.expectedProviders.add(TwitterIdentityProviderFactory.PROVIDER_ID); + this.expectedProviders.add(KerberosIdentityProviderFactory.PROVIDER_ID); this.expectedProviders = Collections.unmodifiableSet(this.expectedProviders); } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/ImportIdentityProviderTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/ImportIdentityProviderTest.java index 9a646cb32d..8ac0ee7e15 100644 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/ImportIdentityProviderTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/ImportIdentityProviderTest.java @@ -18,6 +18,9 @@ package org.keycloak.testsuite.broker; import org.junit.Test; +import org.keycloak.broker.kerberos.KerberosIdentityProvider; +import org.keycloak.broker.kerberos.KerberosIdentityProviderConfig; +import org.keycloak.broker.kerberos.KerberosIdentityProviderFactory; import org.keycloak.broker.oidc.OAuth2IdentityProviderConfig; import org.keycloak.broker.oidc.OIDCIdentityProvider; import org.keycloak.broker.oidc.OIDCIdentityProviderConfig; @@ -150,6 +153,8 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes assertGitHubIdentityProviderConfig(identityProvider); } else if (TwitterIdentityProviderFactory.PROVIDER_ID.equals(providerId)) { assertTwitterIdentityProviderConfig(identityProvider); + } else if (KerberosIdentityProviderFactory.PROVIDER_ID.equals(providerId)) { + assertKerberosIdentityProviderConfig(identityProvider); } else { continue; } @@ -243,8 +248,8 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes } private void assertTwitterIdentityProviderConfig(IdentityProviderModel identityProvider) { - TwitterIdentityProvider gitHubIdentityProvider = new TwitterIdentityProviderFactory().create(identityProvider); - OAuth2IdentityProviderConfig config = gitHubIdentityProvider.getConfig(); + TwitterIdentityProvider twitterIdentityProvider = new TwitterIdentityProviderFactory().create(identityProvider); + OAuth2IdentityProviderConfig config = twitterIdentityProvider.getConfig(); assertEquals("model-twitter", config.getId()); assertEquals(TwitterIdentityProviderFactory.PROVIDER_ID, config.getProviderId()); @@ -255,6 +260,20 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes assertEquals("clientSecret", config.getClientSecret()); } + private void assertKerberosIdentityProviderConfig(IdentityProviderModel identityProvider) { + KerberosIdentityProvider kerberosIdentityProvider = new KerberosIdentityProviderFactory().create(identityProvider); + KerberosIdentityProviderConfig config = kerberosIdentityProvider.getConfig(); + + assertEquals("model-kerberos", config.getId()); + assertEquals(KerberosIdentityProviderFactory.PROVIDER_ID, config.getProviderId()); + assertEquals("Kerberos", config.getName()); + assertEquals(true, config.isEnabled()); + assertEquals(true, config.isUpdateProfileFirstLogin()); + assertEquals("HTTP/server.domain.org@DOMAIN.ORG", config.getServerPrincipal()); + assertEquals("/etc/http.keytab", config.getKeyTab()); + assertTrue(config.getDebug()); + } + private RealmModel installTestRealm() throws IOException { RealmRepresentation realmRepresentation = loadJson("broker-test/test-realm-with-broker.json"); diff --git a/testsuite/integration/src/test/resources/broker-test/test-realm-with-broker.json b/testsuite/integration/src/test/resources/broker-test/test-realm-with-broker.json index 2c9804866c..a49a6a5026 100755 --- a/testsuite/integration/src/test/resources/broker-test/test-realm-with-broker.json +++ b/testsuite/integration/src/test/resources/broker-test/test-realm-with-broker.json @@ -140,6 +140,18 @@ "userInfoUrl": "http://localhost:8082/auth/realms/realm-with-oidc-identity-provider/protocol/openid-connect/userinfo", "defaultScope": "email profile" } + }, + { + "id" : "model-kerberos", + "providerId" : "kerberos", + "name" : "Kerberos", + "enabled": true, + "updateProfileFirstLogin" : "true", + "config": { + "serverPrincipal": "HTTP/server.domain.org@DOMAIN.ORG", + "keyTab": "/etc/http.keytab", + "debug": "true" + } } ], "users": [