4 Replies Latest reply on May 8, 2018 3:54 PM by skorejo

    identity - Picketlink login fails


      I am new to picket link, on trying to login using below code I am getting failed authentication although my user name and password are correct.. Picket link compares the login password provided to what? Also is there any configuration I am missing, any hint would be really appreciated.

      @Inject Identity identity;

      @Inject DefaultLoginCredentials credentials;

      String user = "abc@abc.com";

      String password = "password";



      String result = identity.login().toString();

        • 1. Re: identity - Picketlink login fails

          You must have a class annotated with @PicketLink, like this:



          public class SimpleAuthenticator extends BaseAuthenticator {// implements BaseAuthenticator

            @Inject DefaultLoginCredentials credentials;


             public void authenticate() { // Here the magic happens. identity.login() calls this method, and here you implement your logic

             if ("jsmith".equals(credentials.getUserId()) &&

             "abc123".equals(credentials.getPassword())) {


             setAccount(new User("jsmith"));

            } else {


            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(

             "Authentication Failure - The username or password you provided were invalid."));





          Here is the link of documentation that describe this proccess:


          2.3. The Authentication Process

          • 2. Re: identity - Picketlink login fails

            I was missing adding user credentials in identityManager, on adding user credentials and role I was able to connect. But if the user is added in identityManager once and tried to add again, it throws exception. Seems like this code of setting user credentials need to be executed only once for each user. Should I add this code in some particular file? or should i check if the identityManager already contains that user?

            • 3. Re: identity - Picketlink login fails

              This issue has been resolved by checking if the identity exists in manager using BasicModel.getUser

              • 4. Re: identity - Picketlink login fails

                Hi Alexandre,


                On trying to add @PicketLink annotation I am getting this error: Unsatisfied dependencies with qualifiers @Default