Search in sources :

Example 11 with UserAttributeUpdater

use of org.keycloak.testsuite.updaters.UserAttributeUpdater in project keycloak by keycloak.

the class RoleMapperTest method singleRealmRoleWithDotsRemapped.

@Test
public void singleRealmRoleWithDotsRemapped() throws Exception {
    pmu.add(createSamlProtocolMapper(RoleListMapper.PROVIDER_ID, AttributeStatementHelper.SAML_ATTRIBUTE_NAME, ROLE_ATTRIBUTE_NAME, AttributeStatementHelper.SAML_ATTRIBUTE_NAMEFORMAT, AttributeStatementHelper.BASIC, RoleListMapper.SINGLE_ROLE_ATTRIBUTE, "true"), createSamlProtocolMapper(RoleNameMapper.PROVIDER_ID, RoleNameMapper.ROLE_CONFIG, "role.with.dots", RoleNameMapper.NEW_ROLE_NAME, "blahWithDots")).update();
    RoleRepresentation roleWithDots = realmsResouce().realm(REALM_NAME).roles().get("role.with.dots").toRepresentation();
    try (UserAttributeUpdater uau = UserAttributeUpdater.forUserByUsername(adminClient, REALM_NAME, bburkeUser.getUsername()).update();
        RoleScopeUpdater rsu = uau.realmRoleScope().removeByName("user").add(roleWithDots).update()) {
        testExpectedRoles(SAML_CLIENT_ID_EMPLOYEE_2, "manager", "blahWithDots", "empl.oyee", "employee");
    }
}
Also used : RoleRepresentation(org.keycloak.representations.idm.RoleRepresentation) UserAttributeUpdater(org.keycloak.testsuite.updaters.UserAttributeUpdater) RoleScopeUpdater(org.keycloak.testsuite.updaters.RoleScopeUpdater) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)11 UserAttributeUpdater (org.keycloak.testsuite.updaters.UserAttributeUpdater)11 AbstractTestRealmKeycloakTest (org.keycloak.testsuite.AbstractTestRealmKeycloakTest)9 AuthenticationSessionFailoverClusterTest (org.keycloak.testsuite.cluster.AuthenticationSessionFailoverClusterTest)9 MimeMessage (javax.mail.internet.MimeMessage)8 Closeable (java.io.Closeable)6 UserRepresentation (org.keycloak.representations.idm.UserRepresentation)3 RoleRepresentation (org.keycloak.representations.idm.RoleRepresentation)2 RoleScopeUpdater (org.keycloak.testsuite.updaters.RoleScopeUpdater)2 WebElement (org.openqa.selenium.WebElement)2 RealmModel (org.keycloak.models.RealmModel)1 RootAuthenticationSessionModel (org.keycloak.sessions.RootAuthenticationSessionModel)1