Package org.picketlink.idm

Examples of org.picketlink.idm.PartitionManager


    }

    @InSequence(99)
    @Test
    public void testCustomCredential() {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        CustomCredential credentials = new CustomCredential("valid_token");

        identityManager.validateCredentials(credentials);

        assertEquals(Credentials.Status.VALID, credentials.getStatus());
View Full Code Here


public abstract class AbstractBasicIdentityManagementTestCase {

    @Test
    @InSequence(1)
    public void testPartitionManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        Realm partition = partitionManager.getPartition(Realm.class, Realm.DEFAULT_REALM);

        if (partition != null) {
            partitionManager.remove(partition);
        }

        partitionManager.add(new Realm(Realm.DEFAULT_REALM));

        assertNotNull(partitionManager.getPartition(Realm.class, Realm.DEFAULT_REALM));
    }
View Full Code Here

    }

    @Test
    @InSequence(2)
    public void testUserManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        String loginName = "johny";
        User user = getUser(identityManager, loginName);

        if (user != null) {
            identityManager.remove(user);
View Full Code Here

    }

    @Test
    @InSequence(3)
    public void testCredentialManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        User user = getUser(identityManager, "johny");
        Password password = new Password("abcd1234");

        identityManager.updateCredential(user, password);
View Full Code Here

    }

    @Test
    @InSequence(4)
    public void testRoleManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        String roleName = "admin";
        Role role = getRole(identityManager, roleName);

        if (role != null) {
            identityManager.remove(role);
View Full Code Here

    }

    @Test
    @InSequence(5)
    public void testRelationshipManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        User user = getUser(identityManager, "johny");
        Role role = getRole(identityManager, "admin");

        RelationshipManager relationshipManager = partitionManager.createRelationshipManager();

        BasicModel.grantRole(relationshipManager, user, role);

        assertTrue(hasRole(relationshipManager, user, role));
    }
View Full Code Here

    }

    @Test
    @InSequence(6)
    public void testAttributeManagement() throws Exception {
        PartitionManager partitionManager = getPartitionManager();
        IdentityManager identityManager = partitionManager.createIdentityManager();
        User user = getUser(identityManager, "johny");

        assertNull(user.getAttribute("testAttribute"));

        user.setAttribute(new Attribute<String>("testAttribute", "value"));
View Full Code Here

    }

    @Override
    public LDAPFederationProvider getInstance(KeycloakSession session, UserFederationProviderModel model) {
        PartitionManagerProvider idmProvider = session.getProvider(PartitionManagerProvider.class);
        PartitionManager partition = idmProvider.getPartitionManager(model);
        return new LDAPFederationProvider(session, model, partition);
    }
View Full Code Here

    @Override
    public void syncAllUsers(KeycloakSessionFactory sessionFactory, String realmId, UserFederationProviderModel model) {
        logger.infof("Sync all users from LDAP to local store: realm: %s, federation provider: %s, current time: " + new Date(), realmId, model.getDisplayName());

        PartitionManagerProvider idmProvider = sessionFactory.create().getProvider(PartitionManagerProvider.class);
        PartitionManager partitionMgr = idmProvider.getPartitionManager(model);
        IdentityQuery<User> userQuery = partitionMgr.createIdentityManager().createIdentityQuery(User.class);
        syncImpl(sessionFactory, userQuery, realmId, model);

        // TODO: Remove all existing keycloak users, which have federation links, but are not in LDAP. Perhaps don't check users, which were just added or updated during this sync?
    }
View Full Code Here

    @Override
    public void raiseEvent(Object event) {
        // Used in ActiveDirectory to put account into "enabled" state (aka userAccountControl=512, see http://support.microsoft.com/kb/305144/en ) after password update. If value is -1, it's ignored
        if (updateUserAccountAfterPasswordUpdate && event instanceof CredentialUpdatedEvent) {
            CredentialUpdatedEvent credEvent = ((CredentialUpdatedEvent) event);
            PartitionManager partitionManager = credEvent.getPartitionMananger();
            IdentityContext identityCtx = (IdentityContext)partitionManager.createIdentityManager();

            CredentialStore store = ((StoreSelector)partitionManager).getStoreForCredentialOperation(identityCtx, credEvent.getCredential().getClass());
            if (store instanceof LDAPIdentityStore) {
                LDAPIdentityStore ldapStore = (LDAPIdentityStore)store;
                LDAPOperationManager operationManager = ldapStore.getOperationManager();
View Full Code Here

TOP

Related Classes of org.picketlink.idm.PartitionManager

Copyright © 2018 www.massapicom. 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.