没有为DefaultPrincipalMapping配置的LoginModule WAS Libert y profile 8.5.5.9

时间:2016-08-04 18:27:27

标签: security java-ee websphere-liberty jaas

我使用了此链接中的信息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程序化登录是可用的,应该可以使用。我将所有更新配置为Liberty profile v 8.5.5.9,但我的代码在[错误] javax.security.auth.login.LoginException处抛出异常:在javax.security.auth.login.LoginContext中没有为DefaultPrincipalMapping [err]配置LoginModule。 init(LoginContext.java:264)[错误]在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) {

     }

任何人都可以告诉我这里缺少什么。

1 个答案:

答案 0 :(得分:-1)

而不是"DefaultPrincipalMapping"登录配置"system.DEFAULT"为我完成了这项工作。 最终提示隐藏在documentation

  

system.DEFAULT

     

在未指定JAAS配置时用于登录。

     

...

     

system.WEB_INBOUND和system.DEFAULT配置有这些   默认登录模块的顺序如下:哈希表,userNameAndPassword,   证书令牌。 WSLogin配置具有proxy login module   作为默认登录模块,代理委托所有   对system.DEFAULT中的真实登录模块的操作。

     
    

WSLogin在申请使用例如Unrecognized Callback时失败org.jboss.security.auth.callback.UsernamePasswordHandler作为回调。如果无法修改应用程序,system.DEFAULT提供了另一种选择。