2017-03-14 5 views

답변

1

활성 사용자를 설정하기 위해 로그 아웃 할 필요가 없음 & 사용자을 사용하여 사용자가 인증 된 직후에 활성 사용자를 어댑터에 설정할 수 있습니다.

setActiveUsergetActiveUser에 대한 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을 참조하십시오.