Package org.exoplatform.services.security

Examples of org.exoplatform.services.security.ConversationState


      if (sessionFactory != null)
      {
         sessionFactory.close();
      }

      ConversationState state = getConversationState();
      ConversationState.setCurrent(state);
      this.sessionFactory = new SessionProvider(state);

      logged = true;
   }
View Full Code Here


      this.userId = authenticator.validateUser(credentials);
      Identity identity = authenticator.createIdentity(this.userId);
      identityRegistry.register(identity);

      ConversationState state = new ConversationState(identity);
      // keep subject as attribute in ConversationState
      state.setAttribute(ConversationState.SUBJECT, identity.getSubject());

      return state;
   }
View Full Code Here

         LOG.debug(">>> In postDelete");
      String userId = m.getUserName();
      MembershipEntry expected = new MembershipEntry(m.getGroupId(), m.getMembershipType());
      for (StateKey key : conversationRegistry.getStateKeys(userId))
      {
         ConversationState cstate = conversationRegistry.getState(key);
         Identity identity = cstate.getIdentity();
         Iterator<MembershipEntry> iter = identity.getMemberships().iterator();
         while (iter.hasNext())
         {
            MembershipEntry tmp = iter.next();
            if (tmp.equals(expected))
View Full Code Here

         LOG.debug(">>> In postSave");
      String userId = m.getUserName();
      MembershipEntry me = new MembershipEntry(m.getGroupId(), m.getMembershipType());
      for (StateKey key : conversationRegistry.getStateKeys(userId))
      {
         ConversationState cstate = conversationRegistry.getState(key);
         Identity identity = cstate.getIdentity();
         Iterator<MembershipEntry> iter = identity.getMemberships().iterator();
         boolean contains = false;
         while (iter.hasNext())
         {
            if (iter.next().equals(me))
View Full Code Here

            "Credentials for the authentication should be CredentialsImpl or SimpleCredentials type");
      }

      SessionFactory sessionFactory = (SessionFactory)container.getComponentInstanceOfType(SessionFactory.class);

      ConversationState newState =
         new ConversationState(new Identity(name, userState.getIdentity().getMemberships(), userState.getIdentity()
            .getRoles()));
      return sessionFactory.createSession(newState);

   }
View Full Code Here

      SessionFactory sessionFactory = workspaceContainer.getSessionFactory();

      Identity id = new Identity(DynamicIdentity.DYNAMIC, membershipEntries);

      return sessionFactory.createSession(new ConversationState(id));
   }
View Full Code Here

   {

      if (getState() == OFFLINE)
         LOG.warn("Repository " + getName() + " is OFFLINE.");

      ConversationState state;

      PrivilegedExceptionAction<ConversationState> action = new PrivilegedExceptionAction<ConversationState>()
      {
         public ConversationState run() throws Exception
         {
View Full Code Here

            return true;
        }
    }

    private static Identity getIdentity() {
        ConversationState conversation = ConversationState.getCurrent();
        if (conversation == null) return null;

        return conversation.getIdentity();
    }
View Full Code Here

            UIAccountProfiles uiForm = event.getSource();
            OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIApplication uiApp = context.getUIApplication();

            ConversationState state = ConversationState.getCurrent();
            String userName = ((User) state.getAttribute(CacheUserProfileFilter.USER_PROFILE)).getUserName();
            User user = service.getUserHandler().findUserByName(userName);
            if (user != null) {
                String oldEmail = user.getEmail();
                String newEmail = uiForm.getUIStringInput("email").getValue();

                // Check if mail address is already used
                Query query = new Query();
                query.setEmail(newEmail);
                if (service.getUserHandler().findUsers(query).getAll().size() > 0 && !oldEmail.equals(newEmail)) {
                    // Be sure it keep old value
                    user.setEmail(oldEmail);
                    Object[] args = { userName };
                    uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.email-exist", args));
                    return;
                }
                user.setFirstName(uiForm.getUIStringInput("firstName").getValue());
                user.setLastName(uiForm.getUIStringInput("lastName").getValue());
                user.setDisplayName(uiForm.getUIStringInput("displayName").getValue());
                user.setEmail(newEmail);
                uiApp.addMessage(new ApplicationMessage("UIAccountProfiles.msg.update.success", null));
                service.getUserHandler().saveUser(user, true);

                state.setAttribute(CacheUserProfileFilter.USER_PROFILE, user);
                UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
                uiWorkingWS.updatePortletsByName("UserInfoPortlet");
                uiWorkingWS.updatePortletsByName("OrganizationPortlet");
            } else {
                JavascriptManager jsManager = Util.getPortalRequestContext().getJavascriptManager();
View Full Code Here

            "Credentials for the authentication should be CredentialsImpl or SimpleCredentials type");
      }

      SessionFactory sessionFactory = (SessionFactory)container.getComponentInstanceOfType(SessionFactory.class);

      ConversationState newState =
         new ConversationState(new Identity(name, userState.getIdentity().getMemberships(), userState.getIdentity()
            .getRoles()));
      return sessionFactory.createSession(newState);

   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.security.ConversationState

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.