Class OAuth2CredentialSource.Builder
- java.lang.Object
-
- org.wildfly.security.credential.source.OAuth2CredentialSource.Builder
-
- Enclosing class:
- OAuth2CredentialSource
public static class OAuth2CredentialSource.Builder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuth2CredentialSource
build()
Creates a newOAuth2CredentialSource
instance.OAuth2CredentialSource.Builder
clientCredentials(String id, String secret)
Configure OAuth2 Client Credentials Grant Type as defined by the OAuth2 specification.OAuth2CredentialSource.Builder
grantScopes(String scopes)
The scopes to grant access.OAuth2CredentialSource.Builder
maskedClientCredentials(String id, String maskedSecret, String algorithm, String initialKeyMaterial, int iterationCount, String salt, String initializationVector)
Configure OAuth2 Masked Client Credentials Grant Type as defined by the OAuth2 specification.OAuth2CredentialSource.Builder
useResourceOwnerMaskedPassword(String userName, String maskedPassword, String algorithm, String initialKeyMaterial, int iterationCount, String salt, String initializationVector)
Configure OAuth2 Resource Owner Masked Password Grant Type as defined by the OAuth2 specification.OAuth2CredentialSource.Builder
useResourceOwnerPassword(String userName, String password)
Configure OAuth2 Resource Owner Password Grant Type as defined by the OAuth2 specification.OAuth2CredentialSource.Builder
useSslContext(SSLContext sslContext)
TTheSSLContext
to be used in case connections to remote server require TLS/HTTPS.OAuth2CredentialSource.Builder
useSslHostnameVerifier(HostnameVerifier hostnameVerifier)
TTheHostnameVerifier
to be used in case connections to remote server require TLS/HTTPS.
-
-
-
Method Detail
-
grantScopes
public OAuth2CredentialSource.Builder grantScopes(String scopes)
The scopes to grant access.- Parameters:
scopes
- the scopes to grant access.- Returns:
- this instance
-
useResourceOwnerPassword
public OAuth2CredentialSource.Builder useResourceOwnerPassword(String userName, String password)
Configure OAuth2 Resource Owner Password Grant Type as defined by the OAuth2 specification.
When using this grant type, make sure to also configure one of the supported client authentication methods. For instance, make sure to provide client credentials via
clientCredentials(String, String)
.- Parameters:
userName
- the resource owner's user namepassword
- the resource owner's password- Returns:
- this instance.
-
clientCredentials
public OAuth2CredentialSource.Builder clientCredentials(String id, String secret)
Configure OAuth2 Client Credentials Grant Type as defined by the OAuth2 specification.
- Parameters:
id
- the client idsecret
- the client secret- Returns:
- this instance.
-
useResourceOwnerMaskedPassword
public OAuth2CredentialSource.Builder useResourceOwnerMaskedPassword(String userName, String maskedPassword, String algorithm, String initialKeyMaterial, int iterationCount, String salt, String initializationVector) throws NoSuchAlgorithmException, InvalidKeySpecException
Configure OAuth2 Resource Owner Masked Password Grant Type as defined by the OAuth2 specification.
When using this grant type, make sure to also configure one of the supported client authentication methods. For instance, make sure to provide client credentials via
clientCredentials(String, String)
.- Parameters:
userName
- the resource owner's user namemaskedPassword
- the masked password, as a string (must not benull
)algorithm
- the algorithm (can benull
, default:"masked-MD5-DES")initialKeyMaterial
- the initial key material, as a string(can benull
, default:"somearbitrarycrazystringthatdoesnotmatter")iterationCount
- the iteration count, as an integer (must not be less than 1)salt
- the salt, as a string (must not benull
)initializationVector
- the initialization vector, as a string (can benull
)- Returns:
- this instance.
- Throws:
NoSuchAlgorithmException
- if algorithm used to get PasswordFactory instance is invalidInvalidKeySpecException
- if invalid spec is used to generate password
-
maskedClientCredentials
public OAuth2CredentialSource.Builder maskedClientCredentials(String id, String maskedSecret, String algorithm, String initialKeyMaterial, int iterationCount, String salt, String initializationVector) throws NoSuchAlgorithmException, InvalidKeySpecException
Configure OAuth2 Masked Client Credentials Grant Type as defined by the OAuth2 specification.
- Parameters:
id
- the client idmaskedSecret
- the masked password, as a string (must not benull
)algorithm
- the algorithm (can benull
, default:"masked-MD5-DES")initialKeyMaterial
- the initial key material, as a string(can benull
, default:"somearbitrarycrazystringthatdoesnotmatter")iterationCount
- the iteration count, as an integer (must not be less than 1)salt
- the salt, as a string (must not benull
)initializationVector
- the initialization vector, as a string (can benull
)- Returns:
- this instance.
- Throws:
NoSuchAlgorithmException
- if algorithm used to get PasswordFactory instance is invalidInvalidKeySpecException
- if invalid spec is used to generate password
-
useSslContext
public OAuth2CredentialSource.Builder useSslContext(SSLContext sslContext)
TTheSSLContext
to be used in case connections to remote server require TLS/HTTPS.- Parameters:
sslContext
- the SSLContext- Returns:
- this instance
-
useSslHostnameVerifier
public OAuth2CredentialSource.Builder useSslHostnameVerifier(HostnameVerifier hostnameVerifier)
TTheHostnameVerifier
to be used in case connections to remote server require TLS/HTTPS.- Parameters:
hostnameVerifier
- the HostnameVerifier- Returns:
- this instance
-
build
public OAuth2CredentialSource build()
Creates a newOAuth2CredentialSource
instance.- Returns:
- a OAuth2 credential source
-
-