Examples of deleteRoleMapping()


Examples of org.keycloak.models.UserModel.deleteRoleMapping()

        Assert.assertNotEquals(realmModel.getRole("user").getId(), application.getRole("user").getId());

        Assert.assertEquals(6, user.getRoleMappings().size());

        // Revoke some roles
        user.deleteRoleMapping(realmModel.getRole("foo"));
        user.deleteRoleMapping(appBarRole);
        roles = user.getRoleMappings();
        Assert.assertEquals(4, roles.size());
        assertRolesContains(realmUserRole, roles);
        assertRolesContains(application.getRole("user"), roles);
View Full Code Here

Examples of org.keycloak.models.UserModel.deleteRoleMapping()

        Assert.assertEquals(6, user.getRoleMappings().size());

        // Revoke some roles
        user.deleteRoleMapping(realmModel.getRole("foo"));
        user.deleteRoleMapping(appBarRole);
        roles = user.getRoleMappings();
        Assert.assertEquals(4, roles.size());
        assertRolesContains(realmUserRole, roles);
        assertRolesContains(application.getRole("user"), roles);
        Assert.assertFalse(user.hasRole(appBarRole));
View Full Code Here

Examples of org.keycloak.models.UserModel.deleteRoleMapping()

        }

        if (roles == null) {
            Set<RoleModel> roleModels = user.getRealmRoleMappings();
            for (RoleModel roleModel : roleModels) {
                user.deleteRoleMapping(roleModel);
            }

        } else {
            for (RoleRepresentation role : roles) {
                RoleModel roleModel = realm.getRole(role.getName());
View Full Code Here

Examples of org.keycloak.models.UserModel.deleteRoleMapping()

            for (RoleRepresentation role : roles) {
                RoleModel roleModel = realm.getRole(role.getName());
                if (roleModel == null || !roleModel.getId().equals(role.getId())) {
                    throw new NotFoundException("Role not found");
                }
                user.deleteRoleMapping(roleModel);
            }
        }
    }

    @Path("{username}/role-mappings/applications/{app}")
View Full Code Here

Examples of org.keycloak.models.UserModel.deleteRoleMapping()

        // Remove all role mappings first
        UserModel user = session.users().getUserByUsername(username, realm);
        Set<RoleModel> currRoles = user.getRoleMappings();
        for (RoleModel role : currRoles) {
            user.deleteRoleMapping(role);
        }

        // Add new roles now
        for (String r : roles) {
            grantRole(user, r, realmRoles, appRoles);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.