package jwt
- Alphabetic
- Public
- Protected
Package Members
- package algorithms
- package exceptions
Type Members
- sealed trait EcCurve extends AnyRef
An elliptic curve usable in an
ECJWK (RFC 7518 section 6.2.1.1). - final class EcJwk extends Jwk
- Exceptions thrown
JwtValidationExceptionif a coordinate does not fit the curve length, is negative, or the point is not on the curve
- sealed trait Jwk extends AnyRef
A public JSON Web Key as defined by RFC 7517.
A public JSON Web Key as defined by RFC 7517.
Only the public parameters of
RSA,ECandOKPkeys are modelled. Private members such asd,p,q,dp,dq,qiorothare ignored: they are never read when parsing and never written bytoJson.The certificate members
x5c,x5t,x5t#S256andx5uare ignored too: no certificate chain is read, validated or checked against the key, and they are never written bytoJson.Keys are immutable values. Use the companion factories to construct them, named accessors to inspect them and
withKeyId,withUse,withAlgorithmorwithKeyOperationsto update their metadata. They deliberately do not expose case-classcopy, extractors orProductAPIs, so that the model can evolve without changing those public signatures. - final class JwkSet extends AnyRef
An immutable JWK Set (RFC 7517 section 5).
- final class JwkThumbprint extends AnyRef
A JWK thumbprint as defined by RFC 7638.
A JWK thumbprint as defined by RFC 7638.
The thumbprint is the digest itself: the hash octets of the canonical JSON form of the key. base64Url is its textual form (unpadded base64url), which is the value conventionally used as a JWT/JWK
kid. uri is the RFC 9278 URI form.Only SHA-256 is supported at the moment. RFC 7638 permits other hash functions.
- sealed trait JwkUse extends AnyRef
The intended use of a JWK, the
usemember (RFC 7517 section 4.2). - class Jwt extends JwtCore[JwtHeader, JwtClaim]
- sealed trait JwtAlgorithm extends AnyRef
- class JwtArgonaut extends JwtArgonautParser[JwtHeader, JwtClaim]
- trait JwtArgonautParser[H, C] extends JwtJsonCommon[Json, H, C]
- class JwtCirce extends JwtCirceParser[JwtHeader, JwtClaim]
- trait JwtCirceParser[H, C] extends JwtJsonCommon[Json, H, C]
Implementation of
JwtCoreusingJsonfrom Circe. - class JwtClaim extends AnyRef
- trait JwtCore[H, C] extends AnyRef
Provide the main logic around Base64 encoding / decoding and signature using the correct algorithm.
Provide the main logic around Base64 encoding / decoding and signature using the correct algorithm. H and C types are respesctively the header type and the claim type. For the core project, they will be String but you are free to extend this trait using other types like JsObject or anything else.
Please, check implementations, like Jwt, for code samples.
- H
the type of the extracted header from a JSON Web Token
- C
the type of the extracted claim from a JSON Web Token
- class JwtHeader extends AnyRef
- class JwtJson extends JwtJsonParser[JwtHeader, JwtClaim]
- class JwtJson4s extends JwtJson4sParser[JwtHeader, JwtClaim]
- trait JwtJson4sImplicits extends AnyRef
- trait JwtJson4sParser[H, C] extends JwtJson4sCommon[H, C] with JwtJson4sImplicits
Implementation of
JwtCoreusingJObjectfrom Json4s Native.Implementation of
JwtCoreusingJObjectfrom Json4s Native.To see a full list of samples, check the online documentation.
- trait JwtJsonImplicits extends AnyRef
- trait JwtJsonParser[H, C] extends JwtJsonCommon[JsObject, H, C] with JwtJsonImplicits
Implementation of
JwtCoreusingJsObjectfrom Play JSON.Implementation of
JwtCoreusingJsObjectfrom Play JSON.To see a full list of samples, check the online documentation.
- case class JwtOptions(signature: Boolean = true, expiration: Boolean = true, notBefore: Boolean = true, leeway: Long = 0) extends Product with Serializable
- trait JwtPlayImplicits extends AnyRef
- case class JwtSession(headerData: JsObject, claimData: JsObject, signature: String)(implicit conf: Configuration, clock: Clock) extends Product with Serializable
Similar to the default Play Session but using JsObject instead of Map[String, String].
Similar to the default Play Session but using JsObject instead of Map[String, String]. The data is separated into two attributes:
headerDataandclaimData. There is also a optional signature. Most of the time, you should only care about theclaimDatawhich stores the claim of the token containing the custom values you eventually put in it. That's why all methods ofJwtSession(such as add and removing values) only modifiy theclaimData.To see a full list of samples, check the online documentation.
Warning Be aware that if you override the
claimData(usingwithClaimfor example), you might override some attributes that were automatically put inside the claim such as the expiration of the token. - class JwtUpickle extends JwtUpickleParser[JwtHeader, JwtClaim]
- trait JwtUpickleImplicits extends AnyRef
- trait JwtUpickleParser[H, C] extends JwtJsonCommon[Value, H, C] with JwtUpickleImplicits
Implementation of
JwtCoreusingJs.Valuefrom uPickle.Implementation of
JwtCoreusingJs.Valuefrom uPickle.To see a full list of samples, check the online documentation.
- class JwtZIOJson extends JwtZIOJsonParser[JwtHeader, JwtClaim]
- trait JwtZIOJsonParser[H, C] extends JwtJsonCommon[Json, H, C]
- sealed trait OkpCurve extends AnyRef
A curve usable in an
OKPJWK (RFC 8037 section 2).A curve usable in an
OKPJWK (RFC 8037 section 2).Ed25519andEd448are supported. Turning a key on these curves into a JDKPublicKey, and verifying signatures with it, requires a JDK that provides theEdDSAKeyFactory(JDK 15+). The otherOKPcurves, such asX25519andX448, are not supported. - final class OkpJwk extends Jwk
An
OKPJWK (RFC 8037) holding an Ed25519 or Ed448 public key.An
OKPJWK (RFC 8037) holding an Ed25519 or Ed448 public key.Building the
publicKeyof such a key requires a JDK that provides theEdDSAKeyFactory, which is the case from JDK 15 on. See OkpCurve.- Exceptions thrown
JwtValidationExceptionifxdoes not decode tocurve.keyLengthbytesjava.lang.IllegalArgumentExceptionifxis not valid base64url
- final class RsaJwk extends Jwk
Value Members
- object EcCurve
- object EcJwk
- object Jwk
- object JwkSet
- object JwkThumbprint
- object JwkUse
- object Jwt extends Jwt
Test implementation of JwtCore using only Strings.
Test implementation of JwtCore using only Strings. Most of the time, you should use a lib implementing JSON and shouldn't be using this object. But just in case you need pure Scala support, here it is.
To see a full list of samples, check the online documentation.
Warning: since there is no JSON support in Scala, this object doesn't have any way to parse a JSON string as an AST, so it only uses regex with all the limitations it implies. Try not to use keys like
expandnbfin sub-objects of the claim. For example, if you try to use the following claim:{"user":{"exp":1},"exp":1300819380}, it should be correct but it will fail because the regex extracting the expiration will return1instead of1300819380. Sorry about that. - object JwtAlgorithm
- object JwtArgonaut extends JwtArgonaut
- object JwtArrayUtils
- object JwtBase64
- object JwtCirce extends JwtCirce
- object JwtClaim
- object JwtHeader
- object JwtJson extends JwtJson
- object JwtJson4s extends JwtJson4s
- object JwtOptions extends Serializable
- object JwtSession extends JwtJsonImplicits with JwtPlayImplicits with Serializable
- object JwtTime
Util object to handle time operations
- object JwtUpickle extends JwtUpickle
- object JwtUtils
- object JwtZIOJson extends JwtZIOJson
- object OkpCurve
- object OkpJwk
- object RsaJwk