我需要Liferay Autologin和自定义身份验证方面的帮助.
我的目标是从头文件(由不同的身份验证框架填充)然后自动登录获取凭据.我还要在用户登录时调用一些服务.
我已经阅读了一些文档(也是http://www.liferay.com/community/wiki/-/wiki/Main/Developing+a+Custom+Authentication+System上的文档),但我仍然不明白.
我用portal.properties做了一个钩子:
auto.login.hooks=it.mypackage.filter.AutoLoginFilter
Run Code Online (Sandbox Code Playgroud)
和班级:
public class AutoLoginFilter implements AutoLogin {
public AutoLoginFilter() {
super();
}
@Override
public String[] login(HttpServletRequest req, HttpServletResponse arg1) throws AutoLoginException {
String[] credentials = new String[] { "test@liferay.com" };
return credentials;
}
}
Run Code Online (Sandbox Code Playgroud)
在示例类AutoLogin中,我想只返回用户名(我不需要验证其他凭据).
然后我用portal-ext.properties创建一个ext:
auth.pipeline.pre=it.mypackage.auth.MyAuthenticator
auth.pipeline.enable.liferay.check=false
Run Code Online (Sandbox Code Playgroud)
和验证者:
public class MyAuthenticator implements Authenticator {
private static Log _log = LogFactory.getLog(SwaFiamAuthenticator.class);
@Override
public int authenticateByEmailAddress(long companyId, String emailAddress, String password,
Map<String, String[]> headerMap, Map<String, String[]> parameterMap) throws AuthException {
return authenticate();
} …Run Code Online (Sandbox Code Playgroud) liferay ×1