Added test for import kerberos model
This commit is contained in:
parent
b2c0b90d07
commit
d59a28f1cb
3 changed files with 35 additions and 2 deletions
|
@ -18,6 +18,7 @@
|
||||||
package org.keycloak.testsuite.broker;
|
package org.keycloak.testsuite.broker;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.keycloak.broker.kerberos.KerberosIdentityProviderFactory;
|
||||||
import org.keycloak.broker.oidc.OIDCIdentityProviderFactory;
|
import org.keycloak.broker.oidc.OIDCIdentityProviderFactory;
|
||||||
import org.keycloak.broker.saml.SAMLIdentityProviderFactory;
|
import org.keycloak.broker.saml.SAMLIdentityProviderFactory;
|
||||||
import org.keycloak.social.facebook.FacebookIdentityProviderFactory;
|
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(FacebookIdentityProviderFactory.PROVIDER_ID);
|
||||||
this.expectedProviders.add(GitHubIdentityProviderFactory.PROVIDER_ID);
|
this.expectedProviders.add(GitHubIdentityProviderFactory.PROVIDER_ID);
|
||||||
this.expectedProviders.add(TwitterIdentityProviderFactory.PROVIDER_ID);
|
this.expectedProviders.add(TwitterIdentityProviderFactory.PROVIDER_ID);
|
||||||
|
this.expectedProviders.add(KerberosIdentityProviderFactory.PROVIDER_ID);
|
||||||
|
|
||||||
this.expectedProviders = Collections.unmodifiableSet(this.expectedProviders);
|
this.expectedProviders = Collections.unmodifiableSet(this.expectedProviders);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
package org.keycloak.testsuite.broker;
|
package org.keycloak.testsuite.broker;
|
||||||
|
|
||||||
import org.junit.Test;
|
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.OAuth2IdentityProviderConfig;
|
||||||
import org.keycloak.broker.oidc.OIDCIdentityProvider;
|
import org.keycloak.broker.oidc.OIDCIdentityProvider;
|
||||||
import org.keycloak.broker.oidc.OIDCIdentityProviderConfig;
|
import org.keycloak.broker.oidc.OIDCIdentityProviderConfig;
|
||||||
|
@ -150,6 +153,8 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes
|
||||||
assertGitHubIdentityProviderConfig(identityProvider);
|
assertGitHubIdentityProviderConfig(identityProvider);
|
||||||
} else if (TwitterIdentityProviderFactory.PROVIDER_ID.equals(providerId)) {
|
} else if (TwitterIdentityProviderFactory.PROVIDER_ID.equals(providerId)) {
|
||||||
assertTwitterIdentityProviderConfig(identityProvider);
|
assertTwitterIdentityProviderConfig(identityProvider);
|
||||||
|
} else if (KerberosIdentityProviderFactory.PROVIDER_ID.equals(providerId)) {
|
||||||
|
assertKerberosIdentityProviderConfig(identityProvider);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -243,8 +248,8 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertTwitterIdentityProviderConfig(IdentityProviderModel identityProvider) {
|
private void assertTwitterIdentityProviderConfig(IdentityProviderModel identityProvider) {
|
||||||
TwitterIdentityProvider gitHubIdentityProvider = new TwitterIdentityProviderFactory().create(identityProvider);
|
TwitterIdentityProvider twitterIdentityProvider = new TwitterIdentityProviderFactory().create(identityProvider);
|
||||||
OAuth2IdentityProviderConfig config = gitHubIdentityProvider.getConfig();
|
OAuth2IdentityProviderConfig config = twitterIdentityProvider.getConfig();
|
||||||
|
|
||||||
assertEquals("model-twitter", config.getId());
|
assertEquals("model-twitter", config.getId());
|
||||||
assertEquals(TwitterIdentityProviderFactory.PROVIDER_ID, config.getProviderId());
|
assertEquals(TwitterIdentityProviderFactory.PROVIDER_ID, config.getProviderId());
|
||||||
|
@ -255,6 +260,20 @@ public class ImportIdentityProviderTest extends AbstractIdentityProviderModelTes
|
||||||
assertEquals("clientSecret", config.getClientSecret());
|
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 {
|
private RealmModel installTestRealm() throws IOException {
|
||||||
RealmRepresentation realmRepresentation = loadJson("broker-test/test-realm-with-broker.json");
|
RealmRepresentation realmRepresentation = loadJson("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",
|
"userInfoUrl": "http://localhost:8082/auth/realms/realm-with-oidc-identity-provider/protocol/openid-connect/userinfo",
|
||||||
"defaultScope": "email profile"
|
"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": [
|
"users": [
|
||||||
|
|
Loading…
Reference in a new issue