我有一个部署在wildfly上的应用程序,在单机版中有以下条目:
<subsystem xmlns="urn:jboss:domain:security:2.0">
<security-domains>
<security-domain name="customLoginModule" cache-type="default">
<authentication>
<login-module code="com.mypackage.MyLoginModule flag="required"/>
</authentication>
</security-domain>
...
还有这一类:
public class MyLoginModule extends UsernamePasswordLoginModule {
public static void authenticateUser(HttpServletRequest request, String principalName) {
try {
request.login(principalName, "PasswordKey");
} catch (ServletException ex) {
throw new RuntimeException("...");
}
}
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
super.iniitalize(subject, callbackHandler, sharedState, options);
}
private static Group[] createUserGroup() {
SimpleGroup group = new SimpleGroup("Roles");
group.addMember(new SimplePrincipal("MyUser"));
return new Group[]{group};
}
@Override
protected String getUsersPassword() {
return "PasswordKey";
}
@Override
protected boolean validatePassword(String input, String expected) {
return input.equals(expected);
}
@Override
protected Group[] getRoleSets() {
return createUserGroup();
}
}
在我们的登录servlet中,调用了静态方法authenticateuser()。
我不太明白这门课的目的是什么,安全性是如何工作的。需要删除提供usernamepasswordloginmodule的picketbox依赖项,因为它使用此已弃用的组类。如何在standalone.xml中修改上述逻辑和安全域以与elyton security配合使用?我阅读了本迁移指南,但无法理解如何将其应用于我的案例中。请帮忙,提前谢谢
暂无答案!
目前还没有任何答案,快来回答吧!