0
MobileFirst Platform V8.0을 사용하고 있으며 로그인 성공 후 활성 사용자 속성을 업데이트해야합니다. 로그 아웃하지 않고 활성 사용자를 업데이트하는 솔루션이 있습니까?IBM MobileFirst V8.0 : 활성 사용자 업데이트
MobileFirst Platform V8.0을 사용하고 있으며 로그인 성공 후 활성 사용자 속성을 업데이트해야합니다. 로그 아웃하지 않고 활성 사용자를 업데이트하는 솔루션이 있습니까?IBM MobileFirst V8.0 : 활성 사용자 업데이트
활성 사용자를 설정하기 위해 로그 아웃 할 필요가 없음 & 사용자을 사용하여 사용자가 인증 된 직후에 활성 사용자를 어댑터에 설정할 수 있습니다.
약 setActiveUser
및 getActiveUser
에 대한 API는 here입니다.
다음 코드는 Mobilefirst 8.0 등록 Sample 용 어댑터에서이를 수행하는 방법에 대한 예제입니다.
public void authorize(Set<String> scope, Map<String, Object> credentials, HttpServletRequest request, AuthorizationResponse response) {
PersistentAttributes attributes = registrationContext.getRegisteredProtectedAttributes();
if (attributes.get("pinCode") != null){
// Is there a user currently active?
if (!userLogin.isLoggedIn()){
// If not, set one here.
authorizationContext.setActiveUser(userLogin.getRegisteredUser());
}
setState(SUCCESS_STATE);
response.addSuccess(scope, getExpiresAt(), this.getName());
} else {
setState(STATE_EXPIRED);
Map <String, Object> failure = new HashMap<String, Object>();
failure.put("failure", "User is not enrolled");
response.addFailure(getName(), failure);
}
}
자세한 내용은 this tutorial을 참조하십시오.