Package io.vertx.ext.auth.oauth2
Class OAuth2Options
- java.lang.Object
-
- io.vertx.ext.auth.oauth2.OAuth2Options
-
public class OAuth2Options extends Object
Options describing how an OAuth2HttpClientwill make connections.- Author:
- Paulo Lopes
-
-
Constructor Summary
Constructors Constructor Description OAuth2Options()Default constructorOAuth2Options(JsonObject json)Constructor to create an options from JSONOAuth2Options(OAuth2Options other)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuth2OptionsaddJwk(JsonObject jwk)Adds a local JWKsOAuth2OptionsaddPubSecKey(PubSecKeyOptions pubSecKey)OAuth2OptionsaddSupportedGrantType(String supportedGrantType)StringgetAuthorizationPath()Get the Oauth2 authorization resource path. e.g.: /oauth/authorizeStringgetClientAssertion()StringgetClientAssertionType()StringgetClientId()Get the provider client idStringgetClientSecret()Get the provider client secretJsonObjectgetExtraParameters()Extra parameters to send to the providerJsonObjectgetHeaders()Custom headers to send along with every request.HttpClientOptionsgetHttpClientOptions()StringgetIntrospectionPath()The provider token introspection resource pathlonggetJwkMaxAgeInSeconds()StringgetJwkPath()List<JsonObject>getJwks()JWTOptionsgetJWTOptions()StringgetLogoutPath()The provider logout pathList<PubSecKeyOptions>getPubSecKeys()The provider PubSec key optionsStringgetRevocationPath()Get the Oauth2 revocation resource path. e.g.: /oauth/revokeStringgetScopeSeparator()Set the provider scope separatorStringgetSite()List<String>getSupportedGrantTypes()The provider supported grant typesStringgetTenant()StringgetTokenPath()Get the Oauth2 token resource path. e.g.: /oauth/tokenStringgetUserAgent()The User-Agent header to use when communicating with a providerJsonObjectgetUserInfoParameters()Set the provider custom userInfo parameters to send when requesting them.StringgetUserInfoPath()The provider userInfo resource pathbooleanisUseBasicAuthorization()booleanisValidateIssuer()voidreplaceVariables(boolean strict)OAuth2OptionssetAuthorizationPath(String authorizationPath)OAuth2OptionssetClientAssertion(String clientAssertion)OAuth2OptionssetClientAssertionType(String clientAssertionType)OAuth2OptionssetClientId(String clientId)Set the provider client idOAuth2OptionssetClientSecret(String clientSecret)Set the provider client secretOAuth2OptionssetExtraParameters(JsonObject extraParams)Set extra parameters to be sent to the provider on each requestOAuth2OptionssetHeaders(JsonObject headers)Set custom headers to be sent with every request to the providerOAuth2OptionssetHttpClientOptions(HttpClientOptions httpClientOptions)OAuth2OptionssetIntrospectionPath(String introspectionPath)Set the provider token introspection resource pathvoidsetJwkMaxAgeInSeconds(long jwkMaxAgeInSeconds)-1 means no rotation for JWKsOAuth2OptionssetJwkPath(String jwkPath)OAuth2OptionssetJwks(List<JsonObject> jwks)Sets the initial local JWKsOAuth2OptionssetJWTOptions(JWTOptions jwtOptions)OAuth2OptionssetLogoutPath(String logoutPath)Set the provider logout pathOAuth2OptionssetPubSecKeys(List<PubSecKeyOptions> pubSecKeys)OAuth2OptionssetRevocationPath(String revocationPath)Set the Oauth2 revocation resource path. e.g.: /oauth/revokeOAuth2OptionssetScopeSeparator(String scopeSeparator)Set the provider scope separatorOAuth2OptionssetSite(String site)Root URL for the provider without trailing slashesOAuth2OptionssetSupportedGrantTypes(List<String> supportedGrantTypes)OAuth2OptionssetTenant(String tenant)Sets an optional tenant.OAuth2OptionssetTokenPath(String tokenPath)OAuth2OptionssetUseBasicAuthorization(boolean useBasicAuthorization)OAuth2OptionssetUserAgent(String userAgent)Set a custom user agent to use when communicating to a providerOAuth2OptionssetUserInfoParameters(JsonObject userInfoParams)Set custom parameters to be sent during the userInfo resource requestOAuth2OptionssetUserInfoPath(String userInfoPath)Set the provider userInfo resource pathOAuth2OptionssetValidateIssuer(boolean validateIssuer)JsonObjecttoJson()StringtoString()voidvalidate()
-
-
-
Constructor Detail
-
OAuth2Options
public OAuth2Options()
Default constructor
-
OAuth2Options
public OAuth2Options(OAuth2Options other)
Copy constructor- Parameters:
other- the options to copy
-
OAuth2Options
public OAuth2Options(JsonObject json)
Constructor to create an options from JSON- Parameters:
json- the JSON
-
-
Method Detail
-
getSite
public String getSite()
-
getAuthorizationPath
public String getAuthorizationPath()
Get the Oauth2 authorization resource path. e.g.: /oauth/authorize- Returns:
- authorization path
-
setAuthorizationPath
public OAuth2Options setAuthorizationPath(String authorizationPath)
-
getTokenPath
public String getTokenPath()
Get the Oauth2 token resource path. e.g.: /oauth/token- Returns:
- token path
-
setTokenPath
public OAuth2Options setTokenPath(String tokenPath)
-
getRevocationPath
public String getRevocationPath()
Get the Oauth2 revocation resource path. e.g.: /oauth/revoke- Returns:
- revocation path
-
setRevocationPath
public OAuth2Options setRevocationPath(String revocationPath)
Set the Oauth2 revocation resource path. e.g.: /oauth/revoke- Returns:
- self
-
setSite
public OAuth2Options setSite(String site)
Root URL for the provider without trailing slashes- Parameters:
site- a url- Returns:
- self
-
getClientId
public String getClientId()
Get the provider client id- Returns:
- client id
-
setClientId
public OAuth2Options setClientId(String clientId)
Set the provider client id- Parameters:
clientId- client id- Returns:
- self
-
getClientSecret
public String getClientSecret()
Get the provider client secret- Returns:
- the client secret
-
setClientSecret
public OAuth2Options setClientSecret(String clientSecret)
Set the provider client secret- Parameters:
clientSecret- client secret- Returns:
- self
-
setUseBasicAuthorization
public OAuth2Options setUseBasicAuthorization(boolean useBasicAuthorization)
-
isUseBasicAuthorization
public boolean isUseBasicAuthorization()
-
getClientAssertionType
public String getClientAssertionType()
-
setClientAssertionType
public OAuth2Options setClientAssertionType(String clientAssertionType)
-
getClientAssertion
public String getClientAssertion()
-
setClientAssertion
public OAuth2Options setClientAssertion(String clientAssertion)
-
getUserAgent
public String getUserAgent()
The User-Agent header to use when communicating with a provider- Returns:
- the user agent string
-
setUserAgent
public OAuth2Options setUserAgent(String userAgent)
Set a custom user agent to use when communicating to a provider- Parameters:
userAgent- the user agent- Returns:
- self
-
getHeaders
public JsonObject getHeaders()
Custom headers to send along with every request.- Returns:
- the headers as a json structure
-
setHeaders
public OAuth2Options setHeaders(JsonObject headers)
Set custom headers to be sent with every request to the provider- Parameters:
headers- the headers- Returns:
- self
-
getPubSecKeys
public List<PubSecKeyOptions> getPubSecKeys()
The provider PubSec key options- Returns:
- the pub sec key options
-
setPubSecKeys
public OAuth2Options setPubSecKeys(List<PubSecKeyOptions> pubSecKeys)
-
addPubSecKey
public OAuth2Options addPubSecKey(PubSecKeyOptions pubSecKey)
-
getLogoutPath
public String getLogoutPath()
The provider logout path- Returns:
- a logout resource path
-
setLogoutPath
public OAuth2Options setLogoutPath(String logoutPath)
Set the provider logout path- Parameters:
logoutPath- a logout resource path- Returns:
- self
-
getUserInfoPath
public String getUserInfoPath()
The provider userInfo resource path- Returns:
- a resouce path
-
setUserInfoPath
public OAuth2Options setUserInfoPath(String userInfoPath)
Set the provider userInfo resource path- Parameters:
userInfoPath- a resource path- Returns:
- self
-
getScopeSeparator
public String getScopeSeparator()
Set the provider scope separator- Returns:
- a single character string usually a space or a plus
-
setScopeSeparator
public OAuth2Options setScopeSeparator(String scopeSeparator)
Set the provider scope separator- Parameters:
scopeSeparator- a separator e.g.: ' ', '+', ','- Returns:
- self
-
getExtraParameters
public JsonObject getExtraParameters()
Extra parameters to send to the provider- Returns:
- a json representation of the parameters
-
setExtraParameters
public OAuth2Options setExtraParameters(JsonObject extraParams)
Set extra parameters to be sent to the provider on each request- Parameters:
extraParams- a json representation of the parameters- Returns:
- self
-
getIntrospectionPath
public String getIntrospectionPath()
The provider token introspection resource path- Returns:
- the resource path
-
setIntrospectionPath
public OAuth2Options setIntrospectionPath(String introspectionPath)
Set the provider token introspection resource path- Parameters:
introspectionPath- a resource path- Returns:
- self
-
getUserInfoParameters
public JsonObject getUserInfoParameters()
Set the provider custom userInfo parameters to send when requesting them.- Returns:
- a json representation of the extra parameters
-
setUserInfoParameters
public OAuth2Options setUserInfoParameters(JsonObject userInfoParams)
Set custom parameters to be sent during the userInfo resource request- Parameters:
userInfoParams- json representation of the parameters- Returns:
- self
-
getJwkPath
public String getJwkPath()
-
setJwkPath
public OAuth2Options setJwkPath(String jwkPath)
-
getJWTOptions
public JWTOptions getJWTOptions()
-
setJWTOptions
public OAuth2Options setJWTOptions(JWTOptions jwtOptions)
-
isValidateIssuer
public boolean isValidateIssuer()
-
setValidateIssuer
public OAuth2Options setValidateIssuer(boolean validateIssuer)
-
getTenant
public String getTenant()
-
setTenant
public OAuth2Options setTenant(String tenant)
Sets an optional tenant. Tenants are used in some OpenID servers as placeholders for the URLs. The tenant should be set prior to any URL as it affects the way the URLs will be stored.Some provders may name this differently, for example: `realm`.
- Parameters:
tenant- the tenant/realm for this config.- Returns:
- self
-
getSupportedGrantTypes
public List<String> getSupportedGrantTypes()
The provider supported grant types- Returns:
- the supported grant types options
-
setSupportedGrantTypes
public OAuth2Options setSupportedGrantTypes(List<String> supportedGrantTypes)
-
addSupportedGrantType
public OAuth2Options addSupportedGrantType(String supportedGrantType)
-
replaceVariables
public void replaceVariables(boolean strict)
-
validate
public void validate() throws IllegalStateException- Throws:
IllegalStateException
-
toJson
public JsonObject toJson()
-
getHttpClientOptions
public HttpClientOptions getHttpClientOptions()
-
setHttpClientOptions
public OAuth2Options setHttpClientOptions(HttpClientOptions httpClientOptions)
-
getJwkMaxAgeInSeconds
public long getJwkMaxAgeInSeconds()
-
setJwkMaxAgeInSeconds
public void setJwkMaxAgeInSeconds(long jwkMaxAgeInSeconds)
-1 means no rotation for JWKs- Parameters:
jwkMaxAgeInSeconds- timeout of JWKs rotation
-
getJwks
public List<JsonObject> getJwks()
-
setJwks
public OAuth2Options setJwks(List<JsonObject> jwks)
Sets the initial local JWKs- Parameters:
jwks- a json array as defined in https://tools.ietf.org/html/rfc7517#section-5- Returns:
- self
-
addJwk
public OAuth2Options addJwk(JsonObject jwk)
Adds a local JWKs- Parameters:
jwk- a single keyas defined in https://tools.ietf.org/html/rfc7517#section-5- Returns:
- self
-
-