Package org.exoplatform.services.security

Examples of org.exoplatform.services.security.Authenticator


                // If authenticated credentials were presented in HTTP session, it means that we were already logged on
                // different cluster node
                // with this HTTP session. We don't need to validate password again in this case (We don't have password anyway)
                if (authCredentials != null) {
                    Authenticator authenticator = (Authenticator) getContainer()
                            .getComponentInstanceOfType(Authenticator.class);
                    if (authenticator == null) {
                        throw new LoginException("No Authenticator component found, check your configuration");
                    }

                    String username = authCredentials.getUsername();
                    Identity identity = authenticator.createIdentity(username);

                    sharedState.put("exo.security.identity", identity);
                    sharedState.put("javax.security.auth.login.name", username);

                    subject.getPublicCredentials().add(new UsernameCredential(username));
View Full Code Here


   }

   private ConversationState getConversationState() throws Exception
   {
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      Authenticator authenticator = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);

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

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

      Credential[] credentials =
         new Credential[]{new UsernameCredential(this.userName), new PasswordCredential(this.userPass)};

      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());
View Full Code Here

        ConversationRegistry conversationRegistry = (ConversationRegistry)getContainer().getComponentInstanceOfType(ConversationRegistry.class);
        conversationRegistry.register(stateKey, conversationState);
    }

    private Identity createIdentity(String username) {
        Authenticator authenticator = (Authenticator) getContainer().getComponentInstanceOfType(Authenticator.class);
        try {
            return authenticator.createIdentity(username);
        } catch (Exception e) {
            log.error("New identity for user: " + username + " not created.", e);
            return null;
        }
    }
View Full Code Here

            // If authenticated credentials were presented in HTTP session, it means that we were already logged on different cluster node
            // with this HTTP session. We don't need to validate password again in this case (We don't have password anyway)
            if (authCredentials != null)
            {
               Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);
               if (authenticator == null)
               {
                  throw new LoginException("No Authenticator component found, check your configuration");
               }

               String username = authCredentials.getUsername();
               Identity identity = authenticator.createIdentity(username);

               sharedState.put("exo.security.identity", identity);
               sharedState.put("javax.security.auth.login.name", username);

               subject.getPublicCredentials().add(new UsernameCredential(username));
View Full Code Here

   }

   private ConversationState getConversationState() throws Exception
   {
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      Authenticator authenticator = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);

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

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

      Credential[] credentials =
         new Credential[]{new UsernameCredential(this.userName), new PasswordCredential(this.userPass)};

      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());
View Full Code Here

          log.debug("SSOLogin Failed. Credential Not Found!!");
          return false;
      }
       
      //Perform authentication by setting up the proper Application State
      Authenticator authenticator = (Authenticator) getContainer()
          .getComponentInstanceOfType(Authenticator.class);

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

      Identity identity = authenticator.createIdentity(username);

      sharedState.put("exo.security.identity", identity);
      sharedState.put("javax.security.auth.login.name", username);
      subject.getPublicCredentials().add(new UsernameCredential(username));
View Full Code Here

         }

         try
         {
            //Perform authentication by setting up the proper Application State
            Authenticator authenticator = (Authenticator) getContainer().getComponentInstanceOfType(Authenticator.class);

            Identity identity = authenticator.createIdentity(username);
            sharedState.put("exo.security.identity", identity);
            subject.getPublicCredentials().add(new UsernameCredential(username));

            return true;
         }
View Full Code Here

    try
    {
      if (super.login())
      {
        Principal principal = this.getIdentity();
        Authenticator authenticator = (Authenticator) getContainer()
            .getComponentInstanceOfType(Authenticator.class);

        this.identity = authenticator.createIdentity(principal.getName());

        return true;
      }
      else
      {
View Full Code Here

         String username = (String)sharedState.get("javax.security.auth.login.name");
         String password = (String)sharedState.get("javax.security.auth.login.password");
         if (username == null || password == null)
            return false;

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

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

         Credential[] credentials =
            new Credential[]{new UsernameCredential(username), new PasswordCredential(password)};

         String userId = authenticator.validateUser(credentials);
         Identity identity = authenticator.createIdentity(userId);

         sharedState.put("exo.security.identity", identity);
         sharedState.put("javax.security.auth.login.name", userId);
         // TODO use PasswordCredential wrapper
         subject.getPrivateCredentials().add(password);
View Full Code Here

   }

   private ConversationState getConversationState() throws Exception
   {
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      Authenticator authenticator = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);

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

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

      Credential[] credentials =
         new Credential[]{new UsernameCredential(this.userName), new PasswordCredential(this.userPass)};

      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());
View Full Code Here

TOP

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

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.