Package org.picketlink.idm.api

Examples of org.picketlink.idm.api.IdentitySession


    public void createUser(User user, boolean broadcast) throws Exception {
        if (log.isTraceEnabled()) {
            Tools.logMethodIn(log, LogLevel.TRACE, "createUser", new Object[] { "user", user, "broadcast", broadcast });
        }

        IdentitySession session = service_.getIdentitySession();
        if (broadcast) {
            preSave(user, true);
        }

        try {
            orgService.flush();

            session.getPersistenceManager().createUser(user.getUserName());
        } catch (Exception e) {
            handleException("Identity operation error: ", e);

        }
View Full Code Here


        if (log.isTraceEnabled()) {
            Tools.logMethodIn(log, LogLevel.TRACE, "saveUser", new Object[] { "user", user, "broadcast", broadcast });
        }

        IdentitySession session = service_.getIdentitySession();
        if (broadcast) {
            preSave(user, false);
        }

        persistUserInfo(user, session);
View Full Code Here

    public User removeUser(String userName, boolean broadcast) throws Exception {
        if (log.isTraceEnabled()) {
            Tools.logMethodIn(log, LogLevel.TRACE, "removeUser", new Object[] { "userName", userName, "broadcast", broadcast });
        }

        IdentitySession session = service_.getIdentitySession();

        org.picketlink.idm.api.User foundUser = null;

        try {
            orgService.flush();

            foundUser = session.getPersistenceManager().findUser(userName);
        } catch (Exception e) {
            handleException("Cannot obtain user: " + userName + "; ", e);

        }

        if (foundUser == null) {
            return null;
        }

        try {
            // Remove all memberships and profile first
            orgService.getMembershipHandler().removeMembershipByUser(userName, false);
            orgService.getUserProfileHandler().removeUserProfile(userName, false);
        } catch (Exception e) {
            handleException("Cannot cleanup user relationships: " + userName + "; ", e);

        }

        User exoUser = getPopulatedUser(userName, session);

        if (broadcast) {
            preDelete(exoUser);
        }

        try {
            session.getPersistenceManager().removeUser(foundUser, true);
        } catch (Exception e) {
            handleException("Cannot remove user: " + userName + "; ", e);

        }
View Full Code Here

    public User findUserByName(String userName) throws Exception {
        if (log.isTraceEnabled()) {
            Tools.logMethodIn(log, LogLevel.TRACE, "findUserByName", new Object[] { "userName", userName, });
        }

        IdentitySession session = service_.getIdentitySession();

        User user = getPopulatedUser(userName, session);

        if (log.isTraceEnabled()) {
            Tools.logMethodOut(log, LogLevel.TRACE, "findUserByName", user);
View Full Code Here

            authenticated = user.getPassword().equals(password);
        } else {
            try {
                orgService.flush();

                IdentitySession session = service_.getIdentitySession();
                org.picketlink.idm.api.User idmUser = session.getPersistenceManager().findUser(user.getUserName());

                authenticated = session.getAttributesManager().validatePassword(idmUser, password);
            } catch (Exception e) {
                handleException("Cannot authenticate user: " + username + "; ", e);

            }
        }
View Full Code Here

        if (log.isTraceEnabled()) {
            Tools.logMethodIn(log, LogLevel.TRACE, "findUserByUniqueAttribute", new Object[] { "findUserByUniqueAttribute",
                    attributeName, attributeValue });
        }

        IdentitySession session = service_.getIdentitySession();

        org.picketlink.idm.api.User plUser = null;

        try {
            orgService.flush();

            plUser = session.getAttributesManager().findUserByUniqueAttribute(attributeName, attributeValue);
        } catch (Exception e) {
            handleException("Cannot find user by unique attribute: attrName=" + attributeName +
                    ", attrValue="  + attributeValue + "; ", e);

        }
View Full Code Here

    public void createUser(User user, boolean broadcast) throws Exception {
        if (log.isTraceEnabled()) {
            Tools.logMethodIn(log, LogLevel.TRACE, "createUser", new Object[] { "user", user, "broadcast", broadcast });
        }

        IdentitySession session = service_.getIdentitySession();
        if (broadcast) {
            preSave(user, true);
        }

        try {
            orgService.flush();

            session.getPersistenceManager().createUser(user.getUserName());
        } catch (Exception e) {
            handleException("Identity operation error: ", e);

        }
View Full Code Here

        if (user != null && !user.isEnabled()) {
            throw new DisabledUserException(user.getUserName());
        }

        IdentitySession session = service_.getIdentitySession();
        if (broadcast) {
            preSave(user, false);
        }

        persistUserInfo(user, session, false);
View Full Code Here

            Tools.logMethodIn(log, LogLevel.TRACE, "setEnabled", new Object[] { "userName", userName, "enabled", enabled,
                    "broadcast", broadcast });
        }

        orgService.flush();
        IdentitySession session = service_.getIdentitySession();
        User foundUser = getPopulatedUser(userName, session, UserStatus.ANY);

        if (foundUser == null || foundUser.isEnabled() == enabled) {
            return foundUser;
        }
        ((UserImpl) foundUser).setEnabled(enabled);
        if (broadcast)
            preSetEnabled(foundUser);

        Attribute[] attrs = new Attribute[] { new SimpleAttribute(USER_ENABLED, String.valueOf(enabled)) };

        AttributesManager am = session.getAttributesManager();
        try {
            am.updateAttributes(userName, attrs);
        } catch (Exception e) {
            handleException("Cannot update enabled status for user: " + userName + "; ", e);
        }
View Full Code Here

    public User removeUser(String userName, boolean broadcast) throws Exception {
        if (log.isTraceEnabled()) {
            Tools.logMethodIn(log, LogLevel.TRACE, "removeUser", new Object[] { "userName", userName, "broadcast", broadcast });
        }

        IdentitySession session = service_.getIdentitySession();

        org.picketlink.idm.api.User foundUser = null;

        try {
            orgService.flush();

            foundUser = session.getPersistenceManager().findUser(userName);
        } catch (Exception e) {
            handleException("Cannot obtain user: " + userName + "; ", e);

        }

        if (foundUser == null) {
            return null;
        }

        User exoUser = getPopulatedUser(userName, session, UserStatus.ANY);

        if (broadcast) {
            preDelete(exoUser);
        }

        try {
            // Remove all memberships and profile first
            orgService.getMembershipHandler().removeMembershipByUser(userName, false);
            orgService.getUserProfileHandler().removeUserProfile(userName, false);
        } catch (Exception e) {
            handleException("Cannot cleanup user relationships: " + userName + "; ", e);

        }

        try {
            session.getPersistenceManager().removeUser(foundUser, true);
        } catch (Exception e) {
            handleException("Cannot remove user: " + userName + "; ", e);

        }
View Full Code Here

TOP

Related Classes of org.picketlink.idm.api.IdentitySession

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.