use of com.amazonaws.services.cognitoidentityprovider.model.GetUserResult in project aws-sdk-android by aws-amplify.
the class CognitoUser method getUserDetailsInternal.
/**
* Internal method to fetch user attributes.
*
* @param session REQUIRED: {@link CognitoUserSession}
* @return User attributes
*/
private CognitoUserDetails getUserDetailsInternal(CognitoUserSession session) {
if (session != null && session.isValid()) {
final GetUserRequest getUserRequest = new GetUserRequest();
getUserRequest.setAccessToken(session.getAccessToken().getJWTToken());
final GetUserResult userResult = cognitoIdentityProviderClient.getUser(getUserRequest);
return new CognitoUserDetails(new CognitoUserAttributes(userResult.getUserAttributes()), new CognitoUserSettings(userResult.getMFAOptions()));
} else {
throw new CognitoNotAuthorizedException("user is not authenticated");
}
}
Aggregations