jots

package jots

Members list

Packages

package jots.crypto
package jots.http4s
package jots.testing

Type members

Classlikes

Attributes

Companion
class
Source
AcceptedAudiences.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class AcceptedAudiences

The audiences (aud) accepted when verifying tokens.

The audiences (aud) accepted when verifying tokens.

- AcceptedAudiences.none rejects tokens with an audience, while tokens without an audience are accepted. This is the default. - AcceptedAudiences.any accepts tokens with any audience, and tokens without an audience. - AcceptedAudiences(audience, audiences*) accepts tokens with at least one of the audiences, while other tokens are rejected.

Rejecting tokens with an audience by default follows the JWT specification, which requires tokens to be rejected when the audience is not recognized (RFC 7519 section 4.1.3).

Attributes

Companion
object
Source
AcceptedAudiences.scala
Supertypes
class Object
trait Matchable
class Any
sealed abstract class AcceptedIssuers

The issuers (iss) accepted when verifying tokens.

The issuers (iss) accepted when verifying tokens.

- AcceptedIssuers.any accepts tokens with any issuer, and tokens without an issuer. This is the default. - AcceptedIssuers(issuer, issuers*) accepts tokens with one of the issuers, while other tokens are rejected.

Attributes

Companion
object
Source
AcceptedIssuers.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
AcceptedIssuers.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class AcceptedSubjects

The subjects (sub) accepted when verifying tokens.

The subjects (sub) accepted when verifying tokens.

- AcceptedSubjects.any accepts tokens with any subject, and tokens without a subject. This is the default. - AcceptedSubjects(subject, subjects*) accepts tokens with one of the subjects, while other tokens are rejected.

Attributes

Companion
object
Source
AcceptedSubjects.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
AcceptedSubjects.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class AcceptedTypes

The types (typ) accepted when verifying tokens.

The types (typ) accepted when verifying tokens.

- AcceptedTypes.any accepts tokens with any type, and tokens without a type. This is the default. - AcceptedTypes(type, types*) accepts tokens with one of the types, while other tokens are rejected.

Types are media types compared case-insensitively, where types without a / have an implied application/ prefix. This means JWT accepts the types JWT, jwt, and application/jwt.

Attributes

Companion
object
Source
AcceptedTypes.scala
Supertypes
class Object
trait Matchable
class Any
object AcceptedTypes

Attributes

Companion
class
Source
AcceptedTypes.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class Jwk

Represents a key known as a JSON Web Key (JWK).

Represents a key known as a JSON Web Key (JWK).

Attributes

Companion
object
Source
Jwk.scala
Supertypes
class Object
trait Matchable
class Any
object Jwk

Attributes

Companion
class
Source
Jwk.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Jwk.type
sealed abstract class JwkKeyId

The key identifier used to identify a specific key in a JwkSet.

The key identifier used to identify a specific key in a JwkSet.

Usually set as the kid parameter in a Jwk or JwtHeader.

Attributes

Companion
object
Source
JwkKeyId.scala
Supertypes
class Object
trait Matchable
class Any
object JwkKeyId

Attributes

Companion
class
Source
JwkKeyId.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JwkKeyId.type
sealed abstract class JwkKeyType

The key type used to identify the type of key for a Jwk.

The key type used to identify the type of key for a Jwk.

Required to be set as the kty parameter for a Jwk.

Attributes

Companion
object
Source
JwkKeyType.scala
Supertypes
class Object
trait Matchable
class Any
object JwkKeyType

Attributes

Companion
class
Source
JwkKeyType.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JwkKeyType.type
object JwkSet

Attributes

Companion
class
Source
JwkSet.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JwkSet.type
sealed abstract class JwkSet

Represents a set of keys known as a JSON Web Key Set (JWK Set).

Represents a set of keys known as a JSON Web Key Set (JWK Set).

Attributes

Companion
object
Source
JwkSet.scala
Supertypes
class Object
trait Matchable
class Any
object JwtAlgorithm

Attributes

Companion
class
Source
JwtAlgorithm.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class JwtAlgorithm

Represents a cryptographic algorithm for JWT signatures.

Represents a cryptographic algorithm for JWT signatures.

Attributes

Companion
object
Source
JwtAlgorithm.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
sealed abstract class JwtAsymmetricAlgorithm extends JwtAlgorithm

Represents a cryptographic asymmetric algorithm for JWT signatures.

Represents a cryptographic asymmetric algorithm for JWT signatures.

Attributes

Companion
object
Source
JwtAlgorithm.scala
Supertypes
class JwtAlgorithm
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
class
Source
JwtAlgorithm.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
object JwtBuilder

Attributes

Companion
class
Source
JwtBuilder.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JwtBuilder.type
sealed abstract class JwtBuilder

Represents a JWT being constructed, prior to signing.

Represents a JWT being constructed, prior to signing.

Attributes

Companion
object
Source
JwtBuilder.scala
Supertypes
class Object
trait Matchable
class Any
sealed abstract class JwtClaims

The claims of a JWT being constructed, prior to signing.

The claims of a JWT being constructed, prior to signing.

Attributes

Companion
object
Source
JwtClaims.scala
Supertypes
class Object
trait Matchable
class Any
object JwtClaims

Attributes

Companion
class
Source
JwtClaims.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JwtClaims.type
object JwtDecoder

Attributes

Companion
trait
Source
JwtDecoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
JwtDecoder.type
trait JwtDecoder[A]

Decodes VerifiedJwts to instances of type A.

Decodes VerifiedJwts to instances of type A.

A common approach is to decode VerifiedJwt claims to type A. This can be done by defining a Decoder instance and using JwtDecoder.decodeClaims.

Attributes

Companion
object
Source
JwtDecoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
class
Source
JwtAlgorithm.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class JwtEcdsaAlgorithm extends JwtAsymmetricAlgorithm

Represents an Elliptic Curve Digital Signature Algorithm (ECDSA) for JWT signatures.

Represents an Elliptic Curve Digital Signature Algorithm (ECDSA) for JWT signatures.

Attributes

Companion
object
Source
JwtAlgorithm.scala
Supertypes
class JwtAlgorithm
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
JwtAlgorithm.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class JwtEddsaAlgorithm extends JwtAsymmetricAlgorithm

Represents an Edwards-curve Digital Signature Algorithm (EdDSA) for JWT signatures.

Represents an Edwards-curve Digital Signature Algorithm (EdDSA) for JWT signatures.

Attributes

Companion
object
Source
JwtAlgorithm.scala
Supertypes
class JwtAlgorithm
class Object
trait Matchable
class Any
trait JwtEncoder[A]

Encodes instances of type A to JwtBuilders.

Encodes instances of type A to JwtBuilders.

A common approach is to encode instances of type A as the claims of a JwtBuilder. This can be done by defining an Encoder.AsObject instance and then using JwtEncoder.encodeClaims.

Attributes

Companion
object
Source
JwtEncoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object JwtEncoder

Attributes

Companion
trait
Source
JwtEncoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
JwtEncoder.type
object JwtException

Attributes

Companion
class
Source
JwtException.scala
Supertypes
class Object
trait Matchable
class Any
Self type
abstract class JwtException(val message: String, val cause: Option[Throwable] = ...) extends RuntimeException, NoStackTrace

Exception raised when there is an issue relating to JWTs.

Exception raised when there is an issue relating to JWTs.

Attributes

Companion
object
Source
JwtException.scala
Supertypes
trait NoStackTrace
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
object JwtHeader

Attributes

Companion
class
Source
JwtHeader.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JwtHeader.type
sealed abstract class JwtHeader

The header of a JWT being constructed, prior to signing.

The header of a JWT being constructed, prior to signing.

Attributes

Companion
object
Source
JwtHeader.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
JwtAlgorithm.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class JwtHmacAlgorithm extends JwtAlgorithm

Represents a Hash-based Message Authentication Code (HMAC) algorithm for JWT signatures.

Represents a Hash-based Message Authentication Code (HMAC) algorithm for JWT signatures.

Attributes

Companion
object
Source
JwtAlgorithm.scala
Supertypes
class JwtAlgorithm
class Object
trait Matchable
class Any

Attributes

Companion
trait
Source
JwtJwkSetVerification.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait JwtJwkSetVerification[F[_]] extends JwtVerification[F]

JwtVerification using the keys in a JwkSet, created using the jwkSet functions on JwtVerificationBuilder.

JwtVerification using the keys in a JwkSet, created using the jwkSet functions on JwtVerificationBuilder.

Attributes

Companion
object
Source
JwtJwkSetVerification.scala
Supertypes
trait JwtVerification[F]
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
JwtAlgorithm.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class JwtRsaAlgorithm extends JwtAsymmetricAlgorithm

Represents an RSA (Rivest–Shamir–Adleman) algorithm for JWT signatures.

Represents an RSA (Rivest–Shamir–Adleman) algorithm for JWT signatures.

Attributes

Companion
object
Source
JwtAlgorithm.scala
Supertypes
class JwtAlgorithm
class Object
trait Matchable
class Any
sealed abstract class JwtSignature

The bytes constituting the signature part of a SignedJwt.

The bytes constituting the signature part of a SignedJwt.

JwtSignatures are usually created with JwtSignature.fromMac from jots.crypto.Macs, or using JwtSignature.fromSignature from jots.crypto.Signatures when creating tokens. When parsing existing signatures, JwtSignature.fromString is available.

The JwtSignature should generally not be trusted unless it is part of a VerifiedJwt, so the signature is verified.

Note it is possible for signatures to be empty. However, no default JwtSigning will emit empty signatures. Similarly, all default JwtVerifications will reject empty signatures.

Attributes

Companion
object
Source
JwtSignature.scala
Supertypes
class Object
trait Matchable
class Any
object JwtSignature

Attributes

Companion
class
Source
JwtSignature.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
object JwtSigning

Attributes

Companion
trait
Source
JwtSigning.scala
Supertypes
class Object
trait Matchable
class Any
Self type
JwtSigning.type
trait JwtSigning[F[_]]

Capability to sign JwtBuilders and return SignedJwts.

Capability to sign JwtBuilders and return SignedJwts.

Signing JwtBuilders requires specifying the algorithm to use and a jots.crypto.PrivateKey or jots.crypto.SecretKey. The key requirements of the algorithm are checked by default, but this can be customized using JwtSigningBuilder.

The default JwtSigning instances will set the algorithm in the header of the JwtBuilder before signing, to ensure it matches with the actual signing algorithm.

It is possible to implement custom JwtSigning instances, for example for testing purposes. The bytes which should be signed are provided by JwtBuilder#signingBytes.

Attributes

Companion
object
Source
JwtSigning.scala
Supertypes
class Object
trait Matchable
class Any
sealed abstract class JwtSigningBuilder[F[_], G[_]]

JwtSigning builder which allows customizing signing checks.

JwtSigning builder which allows customizing signing checks.

The default instance checks that the private or secret key meets the key requirements of the algorithm being used, as detailed by checkKeyRequirements.

Attributes

Companion
object
Source
JwtSigningBuilder.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
JwtSigningBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Source
JwtVerification.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait JwtVerification[F[_]]

Capability to verify SignedJwts and return VerifiedJwts.

Capability to verify SignedJwts and return VerifiedJwts.

Verifying SignedJwts requires specifying one or more algorithms, and either a jots.crypto.PublicKey or jots.crypto.SecretKey. Use JwtVerificationBuilder to create instances and customize the claims verification.

It is possible to create custom JwtVerification instances, but these will generally have to make use of a default implementation. This stems from the fact that VerifiedJwts can only be created by the default implementations. The notable exception is that the testing module allows verifying any SignedJwt.

Attributes

Companion
object
Source
JwtVerification.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
sealed abstract class JwtVerificationBuilder[F[_], G[_]]

JwtVerification builder that allows customizing verification.

JwtVerification builder that allows customizing verification.

The default instances perform the following verifications.

- Public and secret keys must meet the key requirement of the algorithm used, as detailed by JwtVerificationBuilder#checkKeyRequirements. - If the token has an audience (aud), then the token is rejected, since the default accepted audiences are AcceptedAudiences.none. Use the withAcceptedAudiences function to specify the accepted audiences. - The expiration (exp), when present, is verified to be in the future. - The not-before (nbf), when present, is verified to not be in the future. - If the token contains a crit header, then the token is rejected. The withCriticalHeaders function can be used to specify the set of accepted critical headers.

The expiration (exp) and not-before (nbf) claims are only verified when present. Their presence can additionally be required, in which case a token missing the claim is rejected.

The verifications above are in addition to verifying the signature and, while not recommended, can be explicitly disabled. It is also recommended to enable additional verifications when appropriate.

For even more verifications, resort to custom JwtVerifications.

Attributes

Companion
object
Source
JwtVerificationBuilder.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
JwtVerificationBuilder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object SignedJwt

Attributes

Companion
class
Source
SignedJwt.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
SignedJwt.type
sealed abstract class SignedJwt

A signed JSON Web Token (JWT) which has not been verified.

A signed JSON Web Token (JWT) which has not been verified.

The String representation is either parsed or generated by using e.g. JwtBuilder#signWith. Unlike JwtBuilder, the SignedJwt does not allow for modifications.

The SignedJwt should generally not be trusted unless it is part of a VerifiedJwt. A SignedJwt can be verified by using the SignedJwt#verifyWith method.

Attributes

Companion
object
Source
SignedJwt.scala
Supertypes
class Object
trait Matchable
class Any
sealed abstract class SignedJwtClaims

A JwtClaims together with its String representation.

A JwtClaims together with its String representation.

The String representation is either parsed or generated by using e.g. JwtClaims#toSigned. Unlike JwtClaims, the SignedJwtClaims does not allow for modifications.

The SignedJwtClaims should generally not be trusted unless it is part of a VerifiedJwt, so the signature is verified.

Attributes

Companion
object
Source
SignedJwtClaims.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
SignedJwtClaims.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
class
Source
SignedJwtHeader.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class SignedJwtHeader

A JwtHeader together with its String representation.

A JwtHeader together with its String representation.

The String representation is either parsed or generated by using e.g. JwtHeader#toSigned. Unlike JwtHeader, the SignedJwtHeader does not allow for modifications.

The SignedJwtHeader should generally not be trusted unless it is part of a VerifiedJwt, so the signature is verified.

Attributes

Companion
object
Source
SignedJwtHeader.scala
Supertypes
class Object
trait Matchable
class Any
object VerifiedJwt

Attributes

Companion
class
Source
VerifiedJwt.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed abstract class VerifiedJwt

A SignedJwt for which the signature has been verified as valid.

A SignedJwt for which the signature has been verified as valid.

Token verification typically also includes verifying that claims are valid, although this is optional and depends on the use case.

VerifiedJwts can only be created by the default implementations of JwtVerification. The notable exception is the testing module which allows to create a VerifiedJwt from any SignedJwt.

Attributes

Companion
object
Source
VerifiedJwt.scala
Supertypes
class Object
trait Matchable
class Any
object literals

Attributes

Source
literals.scala
Supertypes
class Object
trait Matchable
class Any
Self type
literals.type
object syntax

Attributes

Source
syntax.scala
Supertypes
class Object
trait Matchable
class Any
Self type
syntax.type