4 Replies Latest reply on Jun 19, 2015 5:10 AM by manarh

    JBOSS seam authentication on clicking a link

    naresh_bahety

      Currently I am using JBoss seam authentication using

      Authenticator component

       

      <security:identity authenticate-method="#{authenticator.authenticate}"/>

       

      and my authentciation method looks like

       

      @Name("authenticator")

      public class Authenticator{   

         

          @In   

          Identity identity;  

         

          @In

          EntityManager entityManager;

         

         

          public boolean authenticate() {

              boolean found = false;

              List<XYZ> userList = (List) entityManager.createQuery( "from XYZ").getResultList();

              for (int i = 0; i < userList.size(); i++) {

                  XYZ user = (XYZ)userList.get(i);

                  if(identity.getUsername().equalsIgnoreCase(user.getUsername())){               

                      return true;

                  }

              }

              if(!found){

                  FacesMessages.instance().add("Invalid username");

                  return false;            

              }

              return false;    

          }

       

       

      now as per new requirement , from one web site when ever user clicks on seam application link , I need to pass user name and invoke above authentication method , so that I am able to login and load user roles as well..

       

      Please provide valuable feed back.

       

      Thanks in advance !!