Package org.gcube.common.iam
Class AuthorizationURLBuilder
java.lang.Object
org.gcube.common.iam.AuthorizationURLBuilder
Builds the URL of the authorization endpoint the browser is redirected to in the authorization code flow
(response type
code), with optional PKCE (S256). The code received on the redirect URI is exchanged for
the tokens with D4ScienceIAMClient.authenticateWithCode(String, String, String, String, String).
Obtained from D4ScienceIAMClient.authorizationURL(String, String).-
Method Summary
Modifier and TypeMethodDescriptionbuild()codeChallengeS256(String codeVerifier) Enables PKCE with the S256 method.static StringcodeChallengeS256Of(String codeVerifier) static StringAdds (or replaces) any other authorization request parameter (e.g.toString()
-
Method Details
-
scope
- Parameters:
scope- the requested scopes as standard space separated list- Returns:
- this builder
-
state
- Parameters:
state- the opaque value to check on the redirect URI (CSRF protection)- Returns:
- this builder
-
nonce
- Parameters:
nonce- the value that will be bound to the ID token- Returns:
- this builder
-
codeChallengeS256
Enables PKCE with the S256 method.- Parameters:
codeVerifier- the code verifier (seenewCodeVerifier()), to be kept by the caller and passed toD4ScienceIAMClient.authenticateWithCode(String, String, String, String, String)- Returns:
- this builder
-
param
Adds (or replaces) any other authorization request parameter (e.g.prompt,login_hint,kc_idp_hint).- Parameters:
name- the parameter namevalue- the parameter value, anullvalue removes the parameter- Returns:
- this builder
-
build
- Returns:
- the authorization URL, with all the parameters URL encoded
-
toString
-
newCodeVerifier
- Returns:
- a new random PKCE code verifier (43 characters, URL safe)
-
codeChallengeS256Of
- Parameters:
codeVerifier- the PKCE code verifier- Returns:
- the S256 code challenge of the verifier: base64url(sha256(verifier))
-