Package org.exoplatform.services.security

Examples of org.exoplatform.services.security.ConversationState


   {

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

      ConversationState state;

      if (credentials != null)
         state = authenticationPolicy.authenticate(credentials);
      else
         state = authenticationPolicy.authenticate();
View Full Code Here


    * @return System session
    */
   public static SessionProvider createAnonimProvider()
   {
      Identity id = new Identity(SystemIdentity.ANONIM, new HashSet<MembershipEntry>());
      return new SessionProvider(new ConversationState(id));
   }
View Full Code Here

         {
            membershipEntries.add(ace.getMembershipEntry());
         }

         Identity id = new Identity(DynamicIdentity.DYNAMIC, membershipEntries);
         ConversationState conversationState = new ConversationState(id);
         ConversationState.setCurrent(conversationState);
         return new SessionProvider(conversationState);
      }

   }
View Full Code Here

      ExtendedSession session = cache.get(key(repository, workspaceName));
      // create and cache new session

      if (session == null)
      {
         ConversationState conversationState = ConversationState.getCurrent();
         if (conversationState != null && conversationState.getIdentity().getUserId().equals(DynamicIdentity.DYNAMIC))
         {
            session = (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity().getMemberships());
         }
         else if (!isSystem)
         {
            session = (ExtendedSession)repository.login(workspaceName);
         }
View Full Code Here

    * @see org.exoplatform.services.jcr.access.AuthenticationPolicy#authenticate()
    */
   public ConversationState authenticate() throws LoginException
   {

      ConversationState state = ConversationState.getCurrent();

      if (state == null)
      {
         log.debug("No current identity found, ANONYMOUS one will be used");
         return new ConversationState(new Identity(SystemIdentity.ANONIM, new HashSet<MembershipEntry>()));
      }

      ConversationState.setCurrent(state);
      return state;

View Full Code Here

         user.setEmail(newEmail);
         uiApp.addMessage(new ApplicationMessage("UIAccountProfiles.msg.update.success", null));
         service.getUserHandler().saveUser(user, true);

         UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
         ConversationState state = ConversationState.getCurrent();
         if (userName.equals(((User)state.getAttribute(CacheUserProfileFilter.USER_PROFILE)).getUserName()))
         {
            state.setAttribute(CacheUserProfileFilter.USER_PROFILE, user);
            uiWorkingWS.updatePortletsByName("UserInfoPortlet");
         }
         uiWorkingWS.updatePortletsByName("OrganizationPortlet");
      }
View Full Code Here

     * Add credentials to {@link ConversationState}.
     *
     * @param credentials
     */
    protected void bindCredentialsToConversationState(Credentials credentials) {
        ConversationState currentConversationState = ConversationState.getCurrent();
        if (currentConversationState != null && credentials != null) {
            log.debug("Binding credentials to conversationState for user " + credentials.getUsername());
            currentConversationState.setAttribute(Credentials.CREDENTIALS, credentials);
        }
    }
View Full Code Here

     * Logger.
     */
    private static Log log = ExoLogger.getLogger(CacheUserProfileFilter.class);

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException {
        ConversationState state = ConversationState.getCurrent();
        try {
            if (state != null && !state.getIdentity().getUserId().equals(IdentityConstants.ANONIM)) {
                if (log.isDebugEnabled())
                    log.debug("Conversation State found, save user profile to Conversation State.");

                if (state.getAttribute(USER_PROFILE) == null) {
                    OrganizationService orgService = (OrganizationService) getContainer().getComponentInstanceOfType(
                            OrganizationService.class);

                    begin(orgService);
                    User user = orgService.getUserHandler().findUserByName(state.getIdentity().getUserId(), UserStatus.ANY);
                    end(orgService);
                    state.setAttribute(USER_PROFILE, user);
                }

            }
            chain.doFilter(request, response);
        } catch (Exception e) {
View Full Code Here

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
            ServletException {
        HttpServletRequest httpRequest = (HttpServletRequest) request;
        ConversationState state = ConversationState.getCurrent();

        if (state != null) {
            if (state.getAttribute(ATTR_LOGIN_DETECTED) == null) {
                String clientIPAddress = request.getRemoteAddr();
                String sessionID = httpRequest.getSession().getId();
                String username = httpRequest.getRemoteUser();
                state.setAttribute(ATTR_LOGIN_DETECTED, true);

                InvalidLoginAttemptsService invalidLoginService = (InvalidLoginAttemptsService) getContainer()
                        .getComponentInstanceOfType(InvalidLoginAttemptsService.class);
                invalidLoginService.successfulLoginAttempt(sessionID, username, clientIPAddress);
            }
View Full Code Here

        String siteOwner = null;
        if (siteInfo != null) {
            siteType = siteInfo[0];
            siteOwner = siteInfo[1];
        }
        ConversationState currentState = ConversationState.getCurrent();
        if (PortalConfig.USER_TYPE.equals(siteType) && currentState.getIdentity().getUserId().equals(siteOwner)) {
            Application<Gadget> gadgetModel = ds.getApplicationModel(storageId);
            UIStandaloneGadget staGadget = createUIComponent(UIStandaloneGadget.class, null, null);
            staGadget.setStorageId(storageId);
            PortalDataMapper.toUIGadget(staGadget, gadgetModel);
            addChild(staGadget);
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.