Package org.picketlink.idm.credential

Examples of org.picketlink.idm.credential.Password


     * @param user
     */
    @Override
    public void create(User user, String password) {
        identityManager.add(user);
        identityManager.updateCredential(user, new Password(password));
    }
View Full Code Here


            this.identityManager = partitionManager.createIdentityManager();
            this.relationshipManager = partitionManager.createRelationshipManager();
            User user = new User(developer.getLoginName());
            identityManager.add(user);
            Calendar calendar = expirationDate();
            Password password = new Password(developer.getPassword().toCharArray());

            identityManager.updateCredential(user, password, new Date(), calendar.getTime());

            Role developerRole = BasicModel.getRole(identityManager, UserRoles.DEVELOPER);
View Full Code Here

        if (developerUser == null) {
            developerUser = new User(DEFAULT_DEVELOPER);
            identityManager.add(developerUser);

            Calendar calendar = expirationDate();
            Password password = new Password(DEFAULT_PASSWORD.toCharArray());

            identityManager.updateCredential(developerUser, password, new Date(), calendar.getTime());

            Role roleDeveloper = new Role(UserRoles.DEVELOPER);

            identityManager.add(roleDeveloper);

            grantRoles(developerUser, roleDeveloper);
        }

        //Temp hack to add user with admin rights
        User adminUser = BasicModel.getUser(identityManager, DEFAULT_ADMIN);

        // We only create the Admin user, if there is none;
        // if present, there is also no need to apply the same 'Admin' user again.
        if (adminUser == null) {
            adminUser = new User(DEFAULT_ADMIN);
            identityManager.add(adminUser);

            Calendar calendar = expirationDate();
            Password password = new Password(DEFAULT_PASSWORD.toCharArray());

            identityManager.updateCredential(adminUser, password, new Date(), calendar.getTime());

            Role roleAdmin = new Role(UserRoles.ADMIN);
View Full Code Here

            if (picketlinkUser == null) {
                logger.debugf("User '%s' doesn't exists. Skip password update", getUsername());
                throw new IllegalStateException("User doesn't exist in LDAP storage");
            }
            if (cred.getType().equals(UserCredentialModel.PASSWORD)) {
                identityManager.updateCredential(picketlinkUser, new Password(cred.getValue().toCharArray()));
            } else if (cred.getType().equals(UserCredentialModel.TOTP)) {
                TOTPCredential credential = new TOTPCredential(cred.getValue());
                credential.setDevice(cred.getDevice());
                identityManager.updateCredential(picketlinkUser, credential);
            }
View Full Code Here

        return picketlinkUser;
    }

    public static void updatePassword(PartitionManager partitionManager, User picketlinkUser, String password) {
        IdentityManager idmManager = getIdentityManager(partitionManager);
        idmManager.updateCredential(picketlinkUser, new Password(password.toCharArray()));
    }
View Full Code Here

    public static boolean validatePassword(PartitionManager partitionManager, String username, String password) {
        IdentityManager idmManager = getIdentityManager(partitionManager);

        UsernamePasswordCredentials credential = new UsernamePasswordCredentials();
        credential.setUsername(username);
        credential.setPassword(new Password(password.toCharArray()));
        idmManager.validateCredentials(credential);
        if (credential.getStatus() == Credentials.Status.VALID) {
            return true;
        } else {
            return false;
View Full Code Here

    hacker.setFirstName("Hacker");
    hacker.setLastName("anonymous");
   
    identityManager.add(john);
    identityManager.add(hacker);
    final Password defaultPassword = new Password("123");
    identityManager.updateCredential(john, defaultPassword);
    identityManager.updateCredential(hacker, defaultPassword);

    Role roleDeveloper = new Role("simple");
    Role roleAdmin = new Role("admin");
View Full Code Here

TOP

Related Classes of org.picketlink.idm.credential.Password

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.