public URI getAuthFlowStartEndpoint ( final String returnTo , final String scope ) { final String oauthServiceRoot = ( oauthServiceRedirectEndpoint != null ) ? oauthServiceRedirectEndpoint : oauthServiceEndpoint ; final String endpoint = oauthServiceRoot + "/oauth2/authorize" ; UriBuilder builder = UriBuilder . fromUri ( endpoint ) ; builder . replaceQueryParam ( "response_type" , "code" ) ; builder . replaceQueryParam ( "client_id" , clientId ) ; builder . replaceQueryParam ( "redirect_uri" , getOwnCallbackUri ( ) ) ; if ( scope != null ) builder . replaceQueryParam ( "scope" , scope ) ; if ( returnTo != null ) builder . replaceQueryParam ( "state" , encodeState ( callbackNonce + " " + returnTo ) ) ; return builder . build ( ) ; }
Get the endpoint to redirect a client to in order to start an OAuth2 Authorisation Flow