Examples of IdentityRegistry


Examples of org.exoplatform.services.security.IdentityRegistry

         Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);

         if (authenticator == null)
            throw new LoginException("No Authenticator component found, check your configuration.");

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

         if (singleLogin && identityRegistry.getIdentity(userId) != null)
            throw new LoginException("User " + userId + " already logined.");

         Identity identity = authenticator.createIdentity(userId);
         // TODO Remove subject from identity if nod need it in eXo environment.
         // Do not need implement logout by self if use tomcat 6.0.21 and later.
         // See deprecation comments in
         // org.exoplatform.services.security.web.JAASConversationStateListener
         identity.setSubject(subject);

         identityRegistry.register(identity);

      }
      catch (Exception e)
      {
         e.printStackTrace();
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

   public boolean commit() throws LoginException
   {
      try
      {

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

         if (singleLogin && identityRegistry.getIdentity(identity.getUserId()) != null)
            throw new LoginException("User " + identity.getUserId() + " already logined.");

         // TODO Remove subject from identity if nod need it in eXo environment.
         // Do not need implement logout by self if use tomcat 6.0.21 and later.
         // See deprecation comments in
         // org.exoplatform.services.security.web.JAASConversationStateListener
         identity.setSubject(subject);
         identityRegistry.register(identity);

      }
      catch (final Throwable e)
      {
         log.error(e.getLocalizedMessage());
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

      ApplicationRegistryService service = getApplicationComponent(ApplicationRegistryService.class);
      String remoteUser = Util.getPortalRequestContext().getRemoteUser();
      if (remoteUser == null || remoteUser.equals(""))
         return;
      UserACL userACL = Util.getUIPortalApplication().getApplicationComponent(UserACL.class);
      IdentityRegistry identityRegistry = Util.getUIPortalApplication().getApplicationComponent(IdentityRegistry.class);
      Identity identity = identityRegistry.getIdentity(remoteUser);
      if (identity == null)
         return;

      PortletComparator portletComparator = new PortletComparator();
      categories = service.getApplicationCategories(remoteUser);
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

    */
   public static boolean canEditCurrentPortal(String remoteUser) throws Exception
   {
      if (remoteUser == null)
         return false;
      IdentityRegistry identityRegistry = Util.getUIPortalApplication().getApplicationComponent(IdentityRegistry.class);
      Identity identity = identityRegistry.getIdentity(remoteUser);
      if (identity == null)
         return false;
      UIPortal uiPortal = Util.getUIPortal();
      //TODO this code only work for single edit permission
      String editPermission = uiPortal.getEditPermission();
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

  {
    try
    {
      if (super.commit())
      {
        IdentityRegistry identityRegistry = (IdentityRegistry) getContainer()
            .getComponentInstanceOfType(IdentityRegistry.class);

        // Check for single check
        if (identityRegistry.getIdentity(this.identity.getUserId()) != null)
        {
          // already logged in
          return true;
        }

        this.identity.setSubject(this.subject);
        identityRegistry.register(this.identity);

        return true;
      }
      else
      {
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

      String remoteUser = httpRequest.getRemoteUser();
                 
      if(remoteUser != null)
      {               
        //Check and make sure the IdentityRegistry is consistent
        IdentityRegistry identityRegistry = (IdentityRegistry) getContainer()
            .getComponentInstanceOfType(IdentityRegistry.class);
        if(identityRegistry.getIdentity(remoteUser) == null)
        {
          Authenticator authenticator = (Authenticator) getContainer()
          .getComponentInstanceOfType(Authenticator.class);
         
          Identity identity = authenticator.createIdentity(remoteUser);
         
          identityRegistry.register(identity);
        }
      }
     
      chain.doFilter(request, response);           
    }
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

   public boolean commit() throws LoginException
   {
      try
      {

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

         if (singleLogin && identityRegistry.getIdentity(identity.getUserId()) != null)
         {
            throw new LoginException("User " + identity.getUserId() + " already logined.");
         }

         // Do not need implement logout by self if use tomcat 6.0.21 and later.
         // See deprecation comments in
         // org.exoplatform.services.security.web.JAASConversationStateListener
         identity.setSubject(subject);
         identityRegistry.register(identity);

      }
      catch (final Exception e)
      {
         LOG.error(e.getLocalizedMessage());
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

   public boolean commit() throws LoginException
   {
      try
      {

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

         if (singleLogin && identityRegistry.getIdentity(identity.getUserId()) != null)
         {
            throw new LoginException("User " + identity.getUserId() + " already logined.");
         }

         // Do not need implement logout by self if use tomcat 6.0.21 and later.
         // See deprecation comments in
         // org.exoplatform.services.security.web.JAASConversationStateListener
         identity.setSubject(subject);
         identityRegistry.register(identity);

      }
      catch (final Exception e)
      {
         LOG.error(e.getLocalizedMessage());
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

         Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);

         if (authenticator == null)
            throw new LoginException("No Authenticator component found, check your configuration.");

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

         if (singleLogin && identityRegistry.getIdentity(userId) != null)
            throw new LoginException("User " + userId + " already logined.");

         Identity identity = authenticator.createIdentity(userId);
         // Do not need implement logout by self if use tomcat 6.0.21 and later.
         // See deprecation comments in
         // org.exoplatform.services.security.web.JAASConversationStateListener
         identity.setSubject(subject);

         identityRegistry.register(identity);
      }
      catch (Exception e)
      {
         LOG.error(e.getMessage());
         throw new LoginException(e.getMessage());
View Full Code Here

Examples of org.exoplatform.services.security.IdentityRegistry

   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
            {
               if (restoreIdentity)
               {
                  if (LOG.isDebugEnabled())
                  {
                     LOG.debug("Not found identity for " + userId + " try to restore it. ");
                  }

                  Authenticator authenticator =
                     (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
                  try
                  {
                     identity = authenticator.createIdentity(userId);
                     identityRegistry.register(identity);
                  }
                  catch (Exception e)
                  {
                     LOG.error("Unable restore identity. " + e.getMessage(), e);
                  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.