Package org.exoplatform.services.security

Examples of org.exoplatform.services.security.Authenticator


            if (log.isDebugEnabled())
            {
               log.debug("Try create identity");
            }

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

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

            String userId = authenticator.validateUser(getCredentials());

            identity = authenticator.createIdentity(userId);
            sharedState.put("javax.security.auth.login.name", userId);
            subject.getPrivateCredentials().add(getPassword());
            subject.getPublicCredentials().add(getUsername());
         }
         return true;
View Full Code Here


            if (log.isDebugEnabled())
            {
               log.debug("Try create identity");
            }

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

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

            String userId = authenticator.validateUser(getCredentials());

            identity = authenticator.createIdentity(userId);
            sharedState.put("javax.security.auth.login.name", userId);
            subject.getPrivateCredentials().add(getPassword());
            subject.getPublicCredentials().add(getUsername());
         }
         return true;
View Full Code Here

          log.error("---------------------------------------------------------");
          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

            User user = service.getUserHandler().findUserByName(username);
            String currentPass = uiForm.getUIStringInput("currentpass").getValue();
            String newPass = uiForm.getUIStringInput("newpass").getValue();
            String confirmnewPass = uiForm.getUIStringInput("confirmnewpass").getValue();

            Authenticator authenticator = uiForm.getApplicationComponent(Authenticator.class);
            boolean authenticated;
            try {
                UsernameCredential usernameCred = new UsernameCredential(username);
                PasswordCredential passwordCred = new PasswordCredential(currentPass);
                authenticator.validateUser(new Credential[] { usernameCred, passwordCred });
                authenticated = true;
            } catch (Exception ex) {
                authenticated = false;
            }
View Full Code Here

        return true;
    }


    protected void establishSecurityContext(ExoContainer container, String username) throws Exception {
        Authenticator authenticator = (Authenticator) container.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

      RepositoryService repService = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);

      cservice = (CommandService)container.getComponentInstanceOfType(CommandService.class);

      // login via Authenticator
      Authenticator authr = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
      String validUser =
         authr.validateUser(new Credential[]{new UsernameCredential("root"), new PasswordCredential("exo")});
      Identity id = authr.createIdentity(validUser);
      ConversationState s = new ConversationState(id);
      ConversationState.setCurrent(s);

      ctx = new BasicAppContext(repService.getDefaultRepository());
View Full Code Here

      // we need to login (see BasicAppContext, 38) and set current item before ctx using
      if (ctx == null)
      {
         // login via Authenticator
         Authenticator authr = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
         String validUser =
            authr.validateUser(new Credential[]{new UsernameCredential("root"), new PasswordCredential("exo")});
         Identity id = authr.createIdentity(validUser);
         ConversationState s = new ConversationState(id);
         ConversationState.setCurrent(s);

         ctx = new CliAppContext(repService.getDefaultRepository(), PARAMETERS_KEY);
         Node root = ctx.getSession().getRootNode();
View Full Code Here

     try
     {
        log.debug("Handle SSO callback authentication. Username: "+username);

        Authenticator authenticator = (Authenticator) getContainer().getComponentInstanceOfType(Authenticator.class);
               
        Credential[] credentials = new Credential[] { new UsernameCredential(username),
          new PasswordCredential(password) };               

        try
        {
          authenticator.validateUser(credentials);
            if (log.isTraceEnabled())
            {
               log.trace("Login successful for user " + username);
            }
          return ""+Boolean.TRUE;
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.