我使用了此鏈接中的信息https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_dev_prog_login_auth_data.html根據我從本討論主題獲得的信息。 https://developer.ibm.com/answers/questions/261209/websphere-liberty-profile-and-j2c-authdata-retriev-1.html否爲DefaultPrincipalMapping配置的LoginModules WAS Libert y配置文件8.5.5.9
DefaultPrincipalMapping程序化登錄是可用的,應該可以工作。我配置了更新到Liberty配置文件v 8.5.5.9的所有內容,但是我的代碼在[err] javax.security.auth.login.LoginException處拋出了異常:沒有爲javax.security.auth.login.LoginContext處的DefaultPrincipalMapping [err]配置LoginModules。的init(LoginContext.java:264)[ERR]在javax.security.auth.login.LoginContext中。(LoginContext.java:417)這是我的代碼段..
Context context = new InitialContext();
String user = (String) context.lookup("cell/persistent/ADBindUser");
String password = (String) context.lookup("cell/persistent/ADBindPwd");
Map<String, String> map = new HashMap<String, String>();
map.put(Constants.MAPPING_ALIAS, "WPSBIND");
//的CallbackHandler的callbackHandler = // WSMappingCallbackHandlerFactory.getInstance()。getCallbackHandler(map,null);
CallbackHandler callbackHandler =new WSMappingCallbackHandler(map, null);
LoginContext loginContext =
new LoginContext("DefaultPrincipalMapping", callbackHandler);
try{
loginContext.login();
}catch(LoginException le) {
}
任何人都可以告訴我我在這裏失蹤。
你可以添加你的'server.xml'嗎?你添加了'passwordUtilities-1.0'功能嗎? – Gas