use of org.keycloak.representations.idm.IdentityProviderRepresentation in project keycloak by keycloak.
the class AbstractAdvancedBrokerTest method testLogoutWorksWithTokenTimeout.
/**
* Refers to in old testsuite: org.keycloak.testsuite.broker.OIDCKeyCloakServerBrokerBasicTest#testLogoutWorksWithTokenTimeout()
*/
@Test
public void testLogoutWorksWithTokenTimeout() {
try {
updateExecutions(AbstractBrokerTest::enableUpdateProfileOnFirstLogin);
RealmRepresentation realm = adminClient.realm(bc.providerRealmName()).toRepresentation();
assertNotNull(realm);
realm.setAccessTokenLifespan(1);
adminClient.realm(bc.providerRealmName()).update(realm);
IdentityProviderRepresentation idp = adminClient.realm(bc.consumerRealmName()).identityProviders().get(bc.getIDPAlias()).toRepresentation();
idp.getConfig().put("backchannelSupported", "false");
adminClient.realm(bc.consumerRealmName()).identityProviders().get(bc.getIDPAlias()).update(idp);
Time.setOffset(2);
driver.navigate().to(getAccountUrl(getConsumerRoot(), bc.consumerRealmName()));
logInWithBroker(bc);
waitForPage(driver, "update account information", false);
updateAccountInformationPage.assertCurrent();
updateAccountInformationPage.updateAccountInformation("FirstName", "LastName");
accountPage.logOut();
waitForPage(driver, "sign in to", true);
log.debug("Logging in");
assertTrue(this.driver.getCurrentUrl().contains("/auth/realms/" + bc.consumerRealmName() + "/protocol/openid-connect/auth"));
} finally {
Time.setOffset(0);
}
}
use of org.keycloak.representations.idm.IdentityProviderRepresentation in project keycloak by keycloak.
the class AbstractIdentityProviderMapperTest method setupIdentityProviderDisableUserInfo.
protected IdentityProviderRepresentation setupIdentityProviderDisableUserInfo() {
log.debug("adding identity provider to realm " + bc.consumerRealmName());
final IdentityProviderRepresentation idp = bc.setUpIdentityProvider();
idp.getConfig().put("disableUserInfo", "true");
realm.identityProviders().create(idp).close();
return idp;
}
use of org.keycloak.representations.idm.IdentityProviderRepresentation in project keycloak by keycloak.
the class AbstractAdvancedGroupMapperTest method createAdvancedGroupMapper.
protected void createAdvancedGroupMapper(String claimsOrAttributeRepresentation, boolean areClaimsOrAttributeValuesRegexes) {
IdentityProviderRepresentation idp = setupIdentityProvider();
createMapperInIdp(idp, claimsOrAttributeRepresentation, areClaimsOrAttributeValuesRegexes, IMPORT);
}
use of org.keycloak.representations.idm.IdentityProviderRepresentation in project keycloak by keycloak.
the class HardcodedUserAttributeMapperTest method addHardcodedAttributeOnFirstLogin.
@Test
public void addHardcodedAttributeOnFirstLogin() {
final IdentityProviderRepresentation idp = setupIdentityProvider();
createMapperInIdp(idp, IMPORT);
createUserInProviderRealm();
logInAsUserInIDPForFirstTime();
UserRepresentation user = findUser(bc.consumerRealmName(), bc.getUserLogin(), bc.getUserEmail());
assertThatAttributeHasBeenAssigned(user);
}
use of org.keycloak.representations.idm.IdentityProviderRepresentation in project keycloak by keycloak.
the class KcOIDCBrokerWithSignatureTest method testSignatureVerificationHardcodedPublicKey.
@Test
public void testSignatureVerificationHardcodedPublicKey() throws Exception {
// Configure OIDC identity provider with JWKS URL
IdentityProviderRepresentation idpRep = getIdentityProvider();
OIDCIdentityProviderConfigRep cfg = new OIDCIdentityProviderConfigRep(idpRep);
cfg.setValidateSignature(true);
cfg.setUseJwksUrl(false);
KeysMetadataRepresentation.KeyMetadataRepresentation key = ApiUtil.findActiveSigningKey(providerRealm());
cfg.setPublicKeySignatureVerifier(key.getPublicKey());
updateIdentityProvider(idpRep);
// Check that user is able to login
logInAsUserInIDPForFirstTime();
assertLoggedInAccountManagement();
logoutFromRealm(getConsumerRoot(), bc.consumerRealmName());
// Rotate public keys on the parent broker
rotateKeys();
// User not able to login now as new keys can't be yet downloaded (10s timeout)
logInAsUserInIDP();
assertErrorPage("Unexpected error when authenticating with identity provider");
logoutFromRealm(getConsumerRoot(), bc.consumerRealmName());
// Even after time offset is user not able to login, because it uses old key hardcoded in identityProvider config
setTimeOffset(20);
logInAsUserInIDPWithReAuthenticate();
assertErrorPage("Unexpected error when authenticating with identity provider");
}
Aggregations