Package org.exoplatform.services.security

Examples of org.exoplatform.services.security.ConversationRegistry


      StateKey stateKey = new HttpSessionStateKey(httpSession);

      ExoContainer container = getContainerIfPresent(httpSession.getServletContext());
      if (container != null)
      {
         ConversationRegistry conversationRegistry =
            (ConversationRegistry)container.getComponentInstanceOfType(ConversationRegistry.class);

         ConversationState conversationState = conversationRegistry.unregister(stateKey);

         if (conversationState != null)
            if (LOG.isDebugEnabled())
               LOG.debug("Remove conversation state " + httpSession.getId());
      }
View Full Code Here


      try
      {
         ExoContainer container = getContainerIfPresent(httpSession.getServletContext());
         if (container != null)
         {
            ConversationRegistry conversationRegistry =
               (ConversationRegistry)container.getComponentInstanceOfType(ConversationRegistry.class);

            ConversationState conversationState = conversationRegistry.unregister(stateKey);

            if (conversationState != null)
            {
               if (LOG.isDebugEnabled())
                  LOG.debug("Remove conversation state " + httpSession.getId());
View Full Code Here

   public void sessionDestroyed(HttpSessionEvent event)
   {
      HttpSession httpSession = event.getSession();
      StateKey stateKey = new HttpSessionStateKey(httpSession);

      ConversationRegistry conversationRegistry =
         (ConversationRegistry)getContainer(httpSession.getServletContext()).getComponentInstanceOfType(
            ConversationRegistry.class);

      ConversationState conversationState = conversationRegistry.unregister(stateKey);

      if (conversationState != null)
         if (log.isDebugEnabled())
            log.debug("Remove conversation state " + httpSession.getId());
View Full Code Here

   /**
    * Gives the current state
    */
   private ConversationState getCurrentState(ExoContainer container, HttpServletRequest httpRequest)
   {
      ConversationRegistry conversationRegistry =
         (ConversationRegistry)container.getComponentInstanceOfType(ConversationRegistry.class);

      IdentityRegistry identityRegistry =
         (IdentityRegistry)container.getComponentInstanceOfType(IdentityRegistry.class);

      ConversationState state = null;
      String userId = httpRequest.getRemoteUser();

      // only if user authenticated, otherwise there is no reason to do anythings
      if (userId != null)
      {
         HttpSession httpSession = httpRequest.getSession();
         StateKey stateKey = new HttpSessionStateKey(httpSession);

         if (log.isDebugEnabled())
         {
            log.debug("Looking for Conversation State " + httpSession.getId());
         }

         state = conversationRegistry.getState(stateKey);

         if (state == null)
         {
            if (log.isDebugEnabled())
            {
               log.debug("Conversation State not found, try create new one.");
            }

            Identity identity = identityRegistry.getIdentity(userId);
            if (identity != null)
            {
               state = new ConversationState(identity);
               // keep subject as attribute in ConversationState
               state.setAttribute(ConversationState.SUBJECT, identity.getSubject());
            }
            else
               log.error("Not found identity in IdentityRegistry for user " + userId + ", check Login Module.");

            if (state != null)
            {
               conversationRegistry.register(stateKey, state);
               if (log.isDebugEnabled())
               {
                  log.debug("Register Conversation state " + httpSession.getId());
               }

View Full Code Here

      HttpSession httpSession = event.getSession();
      StateKey stateKey = new HttpSessionStateKey(httpSession);
      try
      {
         ExoContainer container = getContainer(httpSession.getServletContext());
         ConversationRegistry conversationRegistry =
            (ConversationRegistry)container.getComponentInstanceOfType(ConversationRegistry.class);

         ConversationState conversationState = conversationRegistry.unregister(stateKey);

         if (conversationState != null)
         {
            if (log.isDebugEnabled())
               log.debug("Remove conversation state " + httpSession.getId());
View Full Code Here

   {
      ExoContainer container = getContainer();

      SessionProviderService providerService =
         (SessionProviderService)container.getComponentInstanceOfType(SessionProviderService.class);
      ConversationRegistry stateRegistry = (ConversationRegistry)container.getComponentInstanceOfType(ConversationRegistry.class);

      HttpServletRequest httpRequest = (HttpServletRequest)request;

      ConversationState state = ConversationState.getCurrent();
      SessionProvider provider = null;

      // NOTE not create new HTTP session, if session is not created yet
      // this means some settings is incorrect, see web.xml for filter
      // org.exoplatform.services.security.web.SetCurrentIdentityFilter
      HttpSession httpSession = httpRequest.getSession(false);
      if (state == null)
      {
         if (LOG.isDebugEnabled())
         {
            LOG.debug("Current conversation state is not set");
         }

         if (httpSession != null)
         {
            StateKey stateKey = new HttpSessionStateKey(httpSession);
            // initialize thread local SessionProvider
            state = stateRegistry.getState(stateKey);
            if (state != null)
            {
               provider = new SessionProvider(state);
            }
            else if (LOG.isDebugEnabled())
View Full Code Here

        HttpSession httpSession = httpRequest.getSession();
        StateKey stateKey = new HttpSessionStateKey(httpSession);

        ExoContainer container = getContainer();

        ConversationRegistry conversationRegistry =
                (ConversationRegistry) container.getComponentInstanceOfType(ConversationRegistry.class);

        ConversationState state = conversationRegistry.getState(stateKey);
        if (state == null) {
            log.error("Conversation state not found. This typically means the GWT Gadget application is either being access anonymously or from outside the portal.");
            handleError(httpRequest, httpResponse, 401);
            return;
        }
View Full Code Here

    // Register given conversationState into ConversationRegistry. Key will be current Http session
    private void registerConversationState(HttpServletRequest req, ConversationState conversationState) {
        HttpSession httpSession = req.getSession();
        StateKey stateKey = new HttpSessionStateKey(httpSession);

        ConversationRegistry conversationRegistry = (ConversationRegistry)getContainer().getComponentInstanceOfType(ConversationRegistry.class);
        conversationRegistry.register(stateKey, conversationState);
    }
View Full Code Here

   /**
    * Gives the current state
    */
   private ConversationState getCurrentState(ExoContainer container, HttpServletRequest httpRequest)
   {
      ConversationRegistry conversationRegistry =
         (ConversationRegistry)container.getComponentInstanceOfType(ConversationRegistry.class);

      IdentityRegistry identityRegistry =
         (IdentityRegistry)container.getComponentInstanceOfType(IdentityRegistry.class);

      ConversationState state = null;
      String userId = httpRequest.getRemoteUser();

      // only if user authenticated, otherwise there is no reason to do anythings
      if (userId != null)
      {
         HttpSession httpSession = httpRequest.getSession();
         StateKey stateKey = new HttpSessionStateKey(httpSession);

         if (log.isDebugEnabled())
         {
            log.debug("Looking for Conversation State " + httpSession.getId());
         }

         state = conversationRegistry.getState(stateKey);

         if (state == null)
         {
            if (log.isDebugEnabled())
            {
               log.debug("Conversation State not found, try create new one.");
            }

            Identity identity = identityRegistry.getIdentity(userId);
            if (identity != null)
            {
               state = new ConversationState(identity);
               // keep subject as attribute in ConversationState
               state.setAttribute(ConversationState.SUBJECT, identity.getSubject());
            }
            else
               log.error("Not found identity in IdentityRegistry for user " + userId + ", check Login Module.");

            if (state != null)
            {
               conversationRegistry.register(stateKey, state);
               if (log.isDebugEnabled())
               {
                  log.debug("Register Conversation state " + httpSession.getId());
               }

View Full Code Here

TOP

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

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.