Reputation: 1218
The interface com.liferay.portal.security.auth.Authenticator of liferay contains different prototypes of different kinds of authenticate. To understand whats the rôle of every kind of authenticate, I implement a test-hook containing this class:
public class Test-hook implements Authenticator {
@Override
public int authenticateByEmailAddress(long arg0, String arg1, String arg2,Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {
System.out.println("successfull by email address authenticate ");
return SUCCESS;
}
@Override
public int authenticateByScreenName(long arg0, String arg1, String arg2,
Map<String, String[]> arg3, Map<String, String[]> arg4)
throws AuthException {
// TODO Auto-generated method stub
System.out.println("successfull by screen name authenticate");
}
@Override
public int authenticateByUserId(long arg0, long arg1, String arg2,
Map<String, String[]> arg3, Map<String, String[]> arg4)
throws AuthException {
// TODO Auto-generated method stub
System.out.println("successfull by user id authenticate");
return SUCCESS;
}
}
So if I login correctly through the portlet sign-in, automatically the function "authenticateByEmailAddress" is called and we get "successfull by email address authenticate" displayed in the console.
My question is when functions authenticateByScreenName and authenticateByUserId are called? That means simply how we can authenticate by screen name and userId in Liferay?
Upvotes: 1
Views: 1651
Reputation: 5226
I am not exactly sure whether this might be the solution or they're related.But,
Setting company.security.auth.type
to screen name in portlet-ext.properties
might solve the issue,
#
# The portal can authenticate users based on their email address, screen
# name, or user id.
#
#company.security.auth.type=emailAddress
company.security.auth.type=screenName
company.security.auth.type=userId
Upvotes: 3