Package org.picketlink.idm.model.basic

Examples of org.picketlink.idm.model.basic.User


    @PUT
    @Path("/update")
    public Response updateUserPasswordAndRole(final Developer developer) {

        User simpleUser = configuration.findByUsername(developer.getLoginName());
        configuration.reset(simpleUser, developer.getPassword(), developer.getNewPassword());

        return Response.ok().build();
    }
View Full Code Here


    @GET
    @Path("/{id}")
    @Produces("application/json")
    public Response findById(@PathParam("id") String id) {
        User developer = identityManager.lookupIdentityById(User.class, id);
        if (developer == null) {
            return Response.status(Status.NOT_FOUND).build();
        }
        return Response.ok(developer).build();
    }
View Full Code Here

    }

    @DELETE
    @Path("/{id}")
    public Response deleteById(@PathParam("id") String id) {
        User simpleUser = identityManager.lookupIdentityById(User.class, id);
        identityManager.remove(simpleUser);
        return Response.noContent().build();
    }
View Full Code Here

        final String DEFAULT_PASSWORD = "123";
        final String DEFAULT_DEVELOPER = "developer";
        final String DEFAULT_ADMIN = "admin";

        User developerUser = BasicModel.getUser(identityManager, DEFAULT_DEVELOPER);

        // We only create the Developer user, if there is none;
        // if present, there is also no need to add the same 'Developer' user again.
        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());
View Full Code Here

            CredentialStore store = ((StoreSelector)partitionManager).getStoreForCredentialOperation(identityCtx, credEvent.getCredential().getClass());
            if (store instanceof LDAPIdentityStore) {
                LDAPIdentityStore ldapStore = (LDAPIdentityStore)store;
                LDAPOperationManager operationManager = ldapStore.getOperationManager();
                User picketlinkUser = (User) credEvent.getAccount();
                String userDN = ldapStore.getBindingDN(picketlinkUser, true);

                ModificationItem[] mods = new ModificationItem[1];
                BasicAttribute mod0 = new BasicAttribute("userAccountControl", "512");
                mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);
                operationManager.modifyAttribute(userDN, mod0);
                logger.debug("Attribute userAccountControls switched to 512 after password update of user " + picketlinkUser.getLoginName());
            } else {
                logger.debug("Store for credential updates is not LDAPIdentityStore. Ignored");
            }

        }
View Full Code Here

    @Override
    public void setUsername(String username) {
        IdentityManager identityManager = provider.getIdentityManager();

        try {
            User picketlinkUser = BasicModel.getUser(identityManager, delegate.getUsername());
            if (picketlinkUser == null) {
                throw new IllegalStateException("User not found in LDAP storage!");
            }
            picketlinkUser.setLoginName(username);
            identityManager.update(picketlinkUser);
        } catch (IdentityManagementException ie) {
            throw new ModelException(ie);
        }
        delegate.setUsername(username);
View Full Code Here

    @Override
    public void setLastName(String lastName) {
        IdentityManager identityManager = provider.getIdentityManager();

        try {
            User picketlinkUser = BasicModel.getUser(identityManager, delegate.getUsername());
            if (picketlinkUser == null) {
                throw new IllegalStateException("User not found in LDAP storage!");
            }
            picketlinkUser.setLastName(lastName);
            identityManager.update(picketlinkUser);
        } catch (IdentityManagementException ie) {
            throw new ModelException(ie);
        }
        delegate.setLastName(lastName);
View Full Code Here

    @Override
    public void setFirstName(String first) {
        IdentityManager identityManager = provider.getIdentityManager();

        try {
            User picketlinkUser = BasicModel.getUser(identityManager, delegate.getUsername());
            if (picketlinkUser == null) {
                throw new IllegalStateException("User not found in LDAP storage!");
            }
            picketlinkUser.setFirstName(first);
            identityManager.update(picketlinkUser);
        } catch (IdentityManagementException ie) {
            throw new ModelException(ie);
        }
        delegate.setFirstName(first);
View Full Code Here

            return;
        }
        IdentityManager identityManager = provider.getIdentityManager();

        try {
            User picketlinkUser = BasicModel.getUser(identityManager, getUsername());
            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)) {
View Full Code Here

    @Override
    public void setEmail(String email) {
        IdentityManager identityManager = provider.getIdentityManager();

        try {
            User picketlinkUser = BasicModel.getUser(identityManager, delegate.getUsername());
            if (picketlinkUser == null) {
                throw new IllegalStateException("User not found in LDAP storage!");
            }
            picketlinkUser.setEmail(email);
            identityManager.update(picketlinkUser);
        } catch (IdentityManagementException ie) {
            throw new ModelException(ie);
        }
        delegate.setEmail(email);
View Full Code Here

TOP

Related Classes of org.picketlink.idm.model.basic.User

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.