@Test(expected = RemoteApiException.class) public void testGetUserAuthDataNullSessionToken() throws RemoteApiException { apiClient.getUserAuthData(null, null, null, null); }
public UserAuthorizationData getUserAuthData(String sessionToken, String integrationId, Long userId, String url) throws RemoteApiException { checkAuthToken(sessionToken); checkParam(integrationId, INTEGRATION_ID); checkParam(userId, USER_ID); checkParam(url, URL); String path = "/v1/configuration/" + apiClient.escapeString(integrationId) + "/auth/user"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); Map<String, String> queryParams = new HashMap<>(); queryParams.put(USER_ID, String.valueOf(userId)); queryParams.put(URL, url); try { return apiClient.doGet(path, headerParams, queryParams, UserAuthorizationData.class); } catch (RemoteApiException e) { if (e.getCode() == Response.Status.UNAUTHORIZED.getStatusCode()) { String message = logMessage.getMessage(UNAUTHORIZED_MESSAGE); String solution = logMessage.getMessage(UNAUTHORIZED_MESSAGE_SOLUTION); throw new UnauthorizedUserException(message, solution); } if (e.getCode() == Response.Status.FORBIDDEN.getStatusCode()) { String message = logMessage.getMessage(FORBIDDEN_MESSAGE); String solution = logMessage.getMessage(FORBIDDEN_MESSAGE_SOLUTION); throw new ForbiddenAuthException(message, solution); } throw new UnexpectedAuthException(logMessage.getMessage(API_MSG), e, logMessage.getMessage(API_MSG_SOLUTION)); } }
IntegrationAuthApiClient extends BasePodApiClient { public UserAuthorizationData getUserAuthData(String sessionToken, String integrationId, Long userId, String url) throws RemoteApiException { checkAuthToken(sessionToken); checkParam(integrationId, INTEGRATION_ID); checkParam(userId, USER_ID); checkParam(url, URL); String path = "/v1/configuration/" + apiClient.escapeString(integrationId) + "/auth/user"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); Map<String, String> queryParams = new HashMap<>(); queryParams.put(USER_ID, String.valueOf(userId)); queryParams.put(URL, url); try { return apiClient.doGet(path, headerParams, queryParams, UserAuthorizationData.class); } catch (RemoteApiException e) { if (e.getCode() == Response.Status.UNAUTHORIZED.getStatusCode()) { String message = logMessage.getMessage(UNAUTHORIZED_MESSAGE); String solution = logMessage.getMessage(UNAUTHORIZED_MESSAGE_SOLUTION); throw new UnauthorizedUserException(message, solution); } if (e.getCode() == Response.Status.FORBIDDEN.getStatusCode()) { String message = logMessage.getMessage(FORBIDDEN_MESSAGE); String solution = logMessage.getMessage(FORBIDDEN_MESSAGE_SOLUTION); throw new ForbiddenAuthException(message, solution); } throw new UnexpectedAuthException(logMessage.getMessage(API_MSG), e, logMessage.getMessage(API_MSG_SOLUTION)); } } }
IntegrationAuthApiClient extends BasePodApiClient { public UserAuthorizationData getUserAuthData(String sessionToken, String integrationId, Long userId, String url) throws RemoteApiException { checkAuthToken(sessionToken); checkParam(integrationId, INTEGRATION_ID); checkParam(userId, USER_ID); checkParam(url, URL); String path = "/v1/configuration/" + apiClient.escapeString(integrationId) + "/auth/user"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); Map<String, String> queryParams = new HashMap<>(); queryParams.put(USER_ID, String.valueOf(userId)); queryParams.put(URL, url); try { return apiClient.doGet(path, headerParams, queryParams, UserAuthorizationData.class); } catch (RemoteApiException e) { if (e.getCode() == Response.Status.UNAUTHORIZED.getStatusCode()) { String message = logMessage.getMessage(UNAUTHORIZED_MESSAGE); String solution = logMessage.getMessage(UNAUTHORIZED_MESSAGE_SOLUTION); throw new UnauthorizedUserException(message, solution); } if (e.getCode() == Response.Status.FORBIDDEN.getStatusCode()) { String message = logMessage.getMessage(FORBIDDEN_MESSAGE); String solution = logMessage.getMessage(FORBIDDEN_MESSAGE_SOLUTION); throw new ForbiddenAuthException(message, solution); } throw new UnexpectedAuthException(logMessage.getMessage(API_MSG), e, logMessage.getMessage(API_MSG_SOLUTION)); } } IntegrationAuthApiClient(HttpApiClient apiClient, LogMessageSource logMessage); }
IntegrationAuthApiClient extends BasePodApiClient { public UserAuthorizationData getUserAuthData(String sessionToken, String integrationId, Long userId, String url) throws RemoteApiException { checkAuthToken(sessionToken); checkParam(integrationId, INTEGRATION_ID); checkParam(userId, USER_ID); checkParam(url, URL); String path = "/v1/configuration/" + apiClient.escapeString(integrationId) + "/auth/user"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); Map<String, String> queryParams = new HashMap<>(); queryParams.put(USER_ID, String.valueOf(userId)); queryParams.put(URL, url); try { return apiClient.doGet(path, headerParams, queryParams, UserAuthorizationData.class); } catch (RemoteApiException e) { if (e.getCode() == Response.Status.UNAUTHORIZED.getStatusCode()) { String message = logMessage.getMessage(UNAUTHORIZED_MESSAGE); String solution = logMessage.getMessage(UNAUTHORIZED_MESSAGE_SOLUTION); throw new UnauthorizedUserException(message, solution); } if (e.getCode() == Response.Status.FORBIDDEN.getStatusCode()) { String message = logMessage.getMessage(FORBIDDEN_MESSAGE); String solution = logMessage.getMessage(FORBIDDEN_MESSAGE_SOLUTION); throw new ForbiddenAuthException(message, solution); } throw new UnexpectedAuthException(logMessage.getMessage(API_MSG), e, logMessage.getMessage(API_MSG_SOLUTION)); } } IntegrationAuthApiClient(HttpApiClient apiClient, LogMessageSource logMessage); void saveUserAuthData(String sessionToken, String integrationId,
      UserAuthorizationData userData); UserAuthorizationData getUserAuthData(String sessionToken, String integrationId,
      Long userId, String url); List<UserAuthorizationData> searchUserAuthData(String sessionToken, String integrationId,
      Map<String, String> filter); void saveAppAuthenticationToken(String sessionToken, String integrationId,
      AppToken appToken); AppToken getAppAuthenticationToken(String sessionToken, String integrationId,
      String applicationToken); }
IntegrationAuthApiClient extends BasePodApiClient { public UserAuthorizationData getUserAuthData(String sessionToken, String integrationId, Long userId, String url) throws RemoteApiException { checkAuthToken(sessionToken); checkParam(integrationId, INTEGRATION_ID); checkParam(userId, USER_ID); checkParam(url, URL); String path = "/v1/configuration/" + apiClient.escapeString(integrationId) + "/auth/user"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); Map<String, String> queryParams = new HashMap<>(); queryParams.put(USER_ID, String.valueOf(userId)); queryParams.put(URL, url); try { return apiClient.doGet(path, headerParams, queryParams, UserAuthorizationData.class); } catch (RemoteApiException e) { if (e.getCode() == Response.Status.UNAUTHORIZED.getStatusCode()) { String message = logMessage.getMessage(UNAUTHORIZED_MESSAGE); String solution = logMessage.getMessage(UNAUTHORIZED_MESSAGE_SOLUTION); throw new UnauthorizedUserException(message, solution); } if (e.getCode() == Response.Status.FORBIDDEN.getStatusCode()) { String message = logMessage.getMessage(FORBIDDEN_MESSAGE); String solution = logMessage.getMessage(FORBIDDEN_MESSAGE_SOLUTION); throw new ForbiddenAuthException(message, solution); } throw new UnexpectedAuthException(logMessage.getMessage(API_MSG), e, logMessage.getMessage(API_MSG_SOLUTION)); } } IntegrationAuthApiClient(HttpApiClient apiClient, LogMessageSource logMessage); void saveUserAuthData(String sessionToken, String integrationId,
      UserAuthorizationData userData); UserAuthorizationData getUserAuthData(String sessionToken, String integrationId,
      Long userId, String url); List<UserAuthorizationData> searchUserAuthData(String sessionToken, String integrationId,
      Map<String, String> filter); void saveAppAuthenticationToken(String sessionToken, String integrationId,
      AppToken appToken); AppToken getAppAuthenticationToken(String sessionToken, String integrationId,
      String applicationToken);  }