JAAS - J2C authentication data in websphere
Map map = new HashMap();
map.put(Constants.MAPPING_ALIAS,"TEST-ECM-CMNode01/ecm_admin");
CallbackHandler callbackHandler = WSMappingCallbackHandlerFactory.getInstance().getCallbackHandler(map, null);
LoginContext loginContext = new LoginContext("DefaultPrincipalMapping", callbackHandler);
loginContext.login();
Subject subject_1 = loginContext.getSubject();
Set credentials = subject_1.getPrivateCredentials();
PasswordCredential passwordCredential = (PasswordCredential) credentials.iterator().next();
String username = passwordCredential.getUserName();
String password = new String(passwordCredential.getPassword());
Không có nhận xét nào:
Đăng nhận xét