@Test public void testPrepareUrl() throws InvalidRequestException { List<Scope> scopes = new ArrayList<Scope>(); scopes.add(Scope.OpenId); String url = oauth2Config.prepareUrl(scopes, "https: assertNotNull(url); Map<String, String> params = prepareQueryParamMap(url); assertNotNull(params.containsKey("scope")); assertEquals("openid", params.get("scope")); scopes.add(Scope.Email); scopes.add(Scope.Phone); url = oauth2Config.prepareUrl(scopes, "https: assertNotNull(url); params = prepareQueryParamMap(url); assertNotNull(params.containsKey("scope")); assertEquals("openid+email+phone", params.get("scope")); }
public String prepareUrl(List<Scope> scopes, String redirectUri, String csrfToken) throws InvalidRequestException { logger.debug("Enter OAuth2config::prepareUrl"); if(scopes == null || scopes.isEmpty() || redirectUri.isEmpty() || csrfToken.isEmpty()) { logger.error("Invalid request for prepareUrl "); throw new InvalidRequestException("Invalid request for prepareUrl"); } try { return intuitAuthorizationEndpoint + "?client_id=" + clientId + "&response_type=code&scope=" + URLEncoder.encode(buildScopeString(scopes), "UTF-8") + "&redirect_uri=" + URLEncoder.encode(redirectUri, "UTF-8") + "&state=" + csrfToken; } catch (UnsupportedEncodingException e) { logger.error("Exception while preparing url for redirect ", e); throw new InvalidRequestException(e.getMessage(), e); } }
OAuth2Config { public String prepareUrl(List<Scope> scopes, String redirectUri, String csrfToken) throws InvalidRequestException { logger.debug("Enter OAuth2config::prepareUrl"); if(scopes == null || scopes.isEmpty() || redirectUri.isEmpty() || csrfToken.isEmpty()) { logger.error("Invalid request for prepareUrl "); throw new InvalidRequestException("Invalid request for prepareUrl"); } try { return intuitAuthorizationEndpoint + "?client_id=" + clientId + "&response_type=code&scope=" + URLEncoder.encode(buildScopeString(scopes), "UTF-8") + "&redirect_uri=" + URLEncoder.encode(redirectUri, "UTF-8") + "&state=" + csrfToken; } catch (UnsupportedEncodingException e) { logger.error("Exception while preparing url for redirect ", e); throw new InvalidRequestException(e.getMessage(), e); } } }
OAuth2Config { public String prepareUrl(List<Scope> scopes, String redirectUri, String csrfToken) throws InvalidRequestException { logger.debug("Enter OAuth2config::prepareUrl"); if(scopes == null || scopes.isEmpty() || redirectUri.isEmpty() || csrfToken.isEmpty()) { logger.error("Invalid request for prepareUrl "); throw new InvalidRequestException("Invalid request for prepareUrl"); } try { return intuitAuthorizationEndpoint + "?client_id=" + clientId + "&response_type=code&scope=" + URLEncoder.encode(buildScopeString(scopes), "UTF-8") + "&redirect_uri=" + URLEncoder.encode(redirectUri, "UTF-8") + "&state=" + csrfToken; } catch (UnsupportedEncodingException e) { logger.error("Exception while preparing url for redirect ", e); throw new InvalidRequestException(e.getMessage(), e); } } private  OAuth2Config(OAuth2ConfigBuilder builder); }
OAuth2Config { public String prepareUrl(List<Scope> scopes, String redirectUri, String csrfToken) throws InvalidRequestException { logger.debug("Enter OAuth2config::prepareUrl"); if(scopes == null || scopes.isEmpty() || redirectUri.isEmpty() || csrfToken.isEmpty()) { logger.error("Invalid request for prepareUrl "); throw new InvalidRequestException("Invalid request for prepareUrl"); } try { return intuitAuthorizationEndpoint + "?client_id=" + clientId + "&response_type=code&scope=" + URLEncoder.encode(buildScopeString(scopes), "UTF-8") + "&redirect_uri=" + URLEncoder.encode(redirectUri, "UTF-8") + "&state=" + csrfToken; } catch (UnsupportedEncodingException e) { logger.error("Exception while preparing url for redirect ", e); throw new InvalidRequestException(e.getMessage(), e); } } private  OAuth2Config(OAuth2ConfigBuilder builder); String getIntuitIdTokenIssuer(); String getIntuitAuthorizationEndpoint(); String getIntuitBearerTokenEndpoint(); String getIntuitRevokeTokenEndpoint(); String getIntuitJwksURI(); String getUserProfileEndpoint(); String getClientId(); String getClientSecret(); ProxyConfig getProxyConfig(); void setIntuitAuthorizationEndpoint(String intuitAuthorizationEndpoint); void setIntuitBearerTokenEndpoint(String intuitBearerTokenEndpoint); void setIntuitRevokeTokenEndpoint(String intuitRevokeTokenEndpoint); void setUserProfileEndpoint(String userProfileEndpoint); void setIntuitIdTokenIssuer(String intuitIdTokenIssuer); void setIntuitJwksURI(String intuitJwksURI); String getScopeValue(Scope scope); String generateCSRFToken(); String prepareUrl(List<Scope> scopes, String redirectUri, String csrfToken); String prepareUrl(List<Scope> scopes, String redirectUri); String prepareUrlWithCustomScopes(List<String> scopes, String redirectUri); String prepareUrlWithCustomScopes(List<String> scopes, String redirectUri, String csrfToken); }
OAuth2Config { public String prepareUrl(List<Scope> scopes, String redirectUri, String csrfToken) throws InvalidRequestException { logger.debug("Enter OAuth2config::prepareUrl"); if(scopes == null || scopes.isEmpty() || redirectUri.isEmpty() || csrfToken.isEmpty()) { logger.error("Invalid request for prepareUrl "); throw new InvalidRequestException("Invalid request for prepareUrl"); } try { return intuitAuthorizationEndpoint + "?client_id=" + clientId + "&response_type=code&scope=" + URLEncoder.encode(buildScopeString(scopes), "UTF-8") + "&redirect_uri=" + URLEncoder.encode(redirectUri, "UTF-8") + "&state=" + csrfToken; } catch (UnsupportedEncodingException e) { logger.error("Exception while preparing url for redirect ", e); throw new InvalidRequestException(e.getMessage(), e); } } private  OAuth2Config(OAuth2ConfigBuilder builder); String getIntuitIdTokenIssuer(); String getIntuitAuthorizationEndpoint(); String getIntuitBearerTokenEndpoint(); String getIntuitRevokeTokenEndpoint(); String getIntuitJwksURI(); String getUserProfileEndpoint(); String getClientId(); String getClientSecret(); ProxyConfig getProxyConfig(); void setIntuitAuthorizationEndpoint(String intuitAuthorizationEndpoint); void setIntuitBearerTokenEndpoint(String intuitBearerTokenEndpoint); void setIntuitRevokeTokenEndpoint(String intuitRevokeTokenEndpoint); void setUserProfileEndpoint(String userProfileEndpoint); void setIntuitIdTokenIssuer(String intuitIdTokenIssuer); void setIntuitJwksURI(String intuitJwksURI); String getScopeValue(Scope scope); String generateCSRFToken(); String prepareUrl(List<Scope> scopes, String redirectUri, String csrfToken); String prepareUrl(List<Scope> scopes, String redirectUri); String prepareUrlWithCustomScopes(List<String> scopes, String redirectUri); String prepareUrlWithCustomScopes(List<String> scopes, String redirectUri, String csrfToken);  }