Package se.digg.dgc.signatures.cwt
Class Cwt.CwtBuilder
- java.lang.Object
-
- se.digg.dgc.signatures.cwt.Cwt.CwtBuilder
-
-
Constructor Summary
Constructors Constructor Description CwtBuilder()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cwt.CwtBuilder
audience(String audience)
Adds a audience to the "aud" claim.Cwt
build()
Builds the CWT.Cwt.CwtBuilder
claim(int claimKey, byte[] value)
Sets a claim identified byclaimKey
.Cwt.CwtBuilder
claim(int claimKey, com.upokecenter.cbor.CBORObject value)
Sets a claim identified byclaimKey
.Cwt.CwtBuilder
claim(String claimKey, byte[] value)
Sets a claim identified byclaimKey
.Cwt.CwtBuilder
claim(String claimKey, com.upokecenter.cbor.CBORObject value)
Sets a claim identified byclaimKey
.Cwt.CwtBuilder
cwtId(byte[] cti)
Sets the "cti" claim.Cwt.CwtBuilder
dgcV1(byte[] dgcPayload)
Sets the DGC v1 payload.Cwt.CwtBuilder
expiration(Instant exp)
Sets the "exp" claim.Cwt.CwtBuilder
issuedAt(Instant iat)
Sets the "iat" claim.Cwt.CwtBuilder
issuer(String issuer)
Sets the "iss" claim.Cwt.CwtBuilder
notBefore(Instant nbf)
Sets the "nbf" claim.Cwt.CwtBuilder
subject(String subject)
Sets the "sub" claim.
-
-
-
Method Detail
-
build
public Cwt build()
Builds the CWT.- Returns:
- the CWT
-
issuer
public Cwt.CwtBuilder issuer(String issuer)
Sets the "iss" claim.- Parameters:
issuer
- the issuer value- Returns:
- the builder
-
subject
public Cwt.CwtBuilder subject(String subject)
Sets the "sub" claim.- Parameters:
subject
- the subject value- Returns:
- the builder
-
audience
public Cwt.CwtBuilder audience(String audience)
Adds a audience to the "aud" claim.- Parameters:
audience
- the audience to add- Returns:
- the builder
-
expiration
public Cwt.CwtBuilder expiration(Instant exp)
Sets the "exp" claim.- Parameters:
exp
- the expiration time- Returns:
- the builder
-
notBefore
public Cwt.CwtBuilder notBefore(Instant nbf)
Sets the "nbf" claim.- Parameters:
nbf
- the not before time- Returns:
- the builder
-
issuedAt
public Cwt.CwtBuilder issuedAt(Instant iat)
Sets the "iat" claim.- Parameters:
iat
- the issued at time- Returns:
- the builder
-
cwtId
public Cwt.CwtBuilder cwtId(byte[] cti)
Sets the "cti" claim.- Parameters:
cti
- the CWT ID- Returns:
- the builder
-
dgcV1
public Cwt.CwtBuilder dgcV1(byte[] dgcPayload)
Sets the DGC v1 payload.- Parameters:
dgcPayload
- the CBOR encoded DGC payload- Returns:
- the builder
-
claim
public Cwt.CwtBuilder claim(int claimKey, byte[] value)
Sets a claim identified byclaimKey
.- Parameters:
claimKey
- the claim keyvalue
- the claim value (in its CBOR encoding)- Returns:
- the builder
-
claim
public Cwt.CwtBuilder claim(int claimKey, com.upokecenter.cbor.CBORObject value)
Sets a claim identified byclaimKey
.- Parameters:
claimKey
- the claim keyvalue
- the claim value- Returns:
- the builder
-
claim
public Cwt.CwtBuilder claim(String claimKey, byte[] value)
Sets a claim identified byclaimKey
.- Parameters:
claimKey
- the claim keyvalue
- the claim value (in its CBOR encoding)- Returns:
- the builder
-
claim
public Cwt.CwtBuilder claim(String claimKey, com.upokecenter.cbor.CBORObject value)
Sets a claim identified byclaimKey
.- Parameters:
claimKey
- the claim keyvalue
- the claim value- Returns:
- the builder
-
-