-
1. Re: identity - Picketlink login fails
acamilo0709 May 7, 2018 11:17 AM (in response to skorejo)You must have a class annotated with @PicketLink, like this:
@PicketLink
public class SimpleAuthenticator extends BaseAuthenticator {// implements BaseAuthenticator
@Inject DefaultLoginCredentials credentials;
@Override
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())) {
setStatus(AuthenticationStatus.SUCCESS);
setAccount(new User("jsmith"));
} else {
setStatus(AuthenticationStatus.FAILURE);
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. Re: identity - Picketlink login fails
skorejo May 7, 2018 2:16 PM (in response to skorejo)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
skorejo May 8, 2018 2:52 PM (in response to skorejo)This issue has been resolved by checking if the identity exists in manager using BasicModel.getUser
-
4. Re: identity - Picketlink login fails
skorejo May 8, 2018 3:54 PM (in response to acamilo0709)Hi Alexandre,
On trying to add @PicketLink annotation I am getting this error: Unsatisfied dependencies with qualifiers @Default