if(authentication!=null && abstractParameter!=null && abstractParameter.getParameterValue(WebConstants.SERVICE_PARAM_NAME)!=null){
String service = abstractParameter.getParameterValue(WebConstants.SERVICE_PARAM_NAME).toString().trim().toLowerCase();
//service不为空,且符合Http协议URL格式,则继续加密。
if(service.length()>0){
//查找ki4so服务对应的应用信息。
App clientApp = appService.findAppByHost(service);
if(clientApp!=null){
String encryCredential = encryCredentialManager.encrypt(buildEncryCredentialInfo(clientApp.getAppId(), authentication, principal));
//加密后的凭据信息写入到动态属性中。
Map<String, Object> attributes = authentication.getAttributes();
if(attributes==null){
attributes = new HashMap<String, Object>();
}
attributes.put(KI4SO_CLIENT_EC_KEY, encryCredential);
attributes.put(WebConstants.SERVICE_PARAM_NAME, service);
authentication.setAttributes(attributes);
//更新用户登录状态到存储器中。
UserLoggedStatus status = new UserLoggedStatus(principal.getId(), clientApp.getAppId(), authentication.getAuthenticatedDate());
userLoggedStatusStore.addUserLoggedStatus(status);
}
}
}
}