Package org.forgerock.json.jose.jwk
Class JWK.Builder<B extends JWK.Builder>
- java.lang.Object
-
- org.forgerock.json.jose.jwk.JWK.Builder<B>
-
- Type Parameters:
B
- The current builder.
- Direct Known Subclasses:
EcJWK.Builder
,OctJWK.Builder
,OkpJWK.Builder
,RsaJWK.Builder
- Enclosing class:
- JWK
public abstract static class JWK.Builder<B extends JWK.Builder> extends Object
JWK builder.
-
-
Field Summary
Fields Modifier and Type Field Description protected Algorithm
algorithm
The intended JOSE algorithm for the key, optional.protected String
keyId
The key ID, optional.protected Set<KeyOperation>
keyOperations
The key operations, optional.protected KeyType
keyType
The key type, required.protected String
use
The key use, optional.protected List<String>
x509Chain
The X.509 certificate chain, optional.protected String
x509Thumbnail
X.509 certificate thumbprint, optional.protected String
x509url
X.509 certificate URL, optional.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description B
algorithm(String algorithm)
Sets the algorithm parameter of the JWK.B
algorithm(Algorithm algorithm)
Sets the algorithm parameter of the JWK.abstract JWK
build()
Builds the JWK.B
keyId(String keyId)
Sets the keyId parameter of the JWK.B
keyOperations(Set<KeyOperation> keyOperations)
Set the key operations parameter of the JWK.B
keyUse(String use)
Set the key use parameter of the JWK.B
withX509Thumbprint()
Sets the SHA-1 X509 thumbprint based on the configuredx509Chain(List)
.B
withX509ThumbprintS256()
Sets the SHA-256 X509 thumbprint based on the configuredx509Chain(List)
.B
x509Chain(List<String> x509Chain)
Set the X509 certificates attributes.B
x509Thumbnail(String x509Thumbnail)
Deprecated.Usex509Thumbprint(String)
orx509ThumbprintS256(String)
instead.B
x509Thumbprint(String x509Thumbprint)
Sets the SHA-1 X509 thumbprint.B
x509ThumbprintS256(String x509Thumbprint)
Sets the SHA-256 X509 thumbprint.B
x509Url(String x509url)
Gets the X509 URL.
-
-
-
Field Detail
-
keyType
protected KeyType keyType
The key type, required.
-
use
protected String use
The key use, optional.
-
keyOperations
protected Set<KeyOperation> keyOperations
The key operations, optional.
-
algorithm
protected Algorithm algorithm
The intended JOSE algorithm for the key, optional.
-
keyId
protected String keyId
The key ID, optional.
-
x509url
protected String x509url
X.509 certificate URL, optional.
-
x509Thumbnail
protected String x509Thumbnail
X.509 certificate thumbprint, optional.
-
-
Constructor Detail
-
Builder
protected Builder(KeyType keyType)
The builder constructor.- Parameters:
keyType
- the JWK key type
-
-
Method Detail
-
keyUse
public B keyUse(String use)
Set the key use parameter of the JWK.- Parameters:
use
- the JWK use- Returns:
- the current builder
-
keyOperations
public B keyOperations(Set<KeyOperation> keyOperations)
Set the key operations parameter of the JWK.- Parameters:
keyOperations
- the JWK key Operations- Returns:
- the current builder
-
algorithm
public B algorithm(Algorithm algorithm)
Sets the algorithm parameter of the JWK.- Parameters:
algorithm
- the JWK algorithm- Returns:
- the current builder
-
algorithm
public B algorithm(String algorithm)
Sets the algorithm parameter of the JWK.- Parameters:
algorithm
- the JWK algorithm- Returns:
- the current builder
-
keyId
public B keyId(String keyId)
Sets the keyId parameter of the JWK.- Parameters:
keyId
- the JWK key id- Returns:
- the current builder
-
x509Url
public B x509Url(String x509url)
Gets the X509 URL.- Parameters:
x509url
- the x509 url for the key- Returns:
- the current builder
-
x509Thumbnail
@Deprecated public B x509Thumbnail(String x509Thumbnail)
Deprecated.Usex509Thumbprint(String)
orx509ThumbprintS256(String)
instead.Sets the X509 thumbprint.- Parameters:
x509Thumbnail
- the x509 thumbprint for the key- Returns:
- the current builder
-
x509Thumbprint
public B x509Thumbprint(String x509Thumbprint)
Sets the SHA-1 X509 thumbprint. You should prefer to usex509ThumbprintS256(String)
instead in most cases.- Parameters:
x509Thumbprint
- the x509 thumbprint for the key- Returns:
- the current builder
-
withX509Thumbprint
public B withX509Thumbprint()
Sets the SHA-1 X509 thumbprint based on the configuredx509Chain(List)
.- Returns:
- the current builder
- Throws:
IllegalStateException
- if no X509 certificate has been set.
-
x509ThumbprintS256
public B x509ThumbprintS256(String x509Thumbprint)
Sets the SHA-256 X509 thumbprint.- Parameters:
x509Thumbprint
- the SHA-256 x509 thumbprint for the key- Returns:
- the current builder
-
withX509ThumbprintS256
public B withX509ThumbprintS256()
Sets the SHA-256 X509 thumbprint based on the configuredx509Chain(List)
.- Returns:
- the current builder
- Throws:
IllegalStateException
- if no X509 certificate has been set.
-
x509Chain
public B x509Chain(List<String> x509Chain)
Set the X509 certificates attributes.- Parameters:
x509Chain
- the x509 chain as a list of Base64 encoded strings- Returns:
- the current builder
-
build
public abstract JWK build()
Builds the JWK.- Returns:
- the JWK.
-
-