Same as decodeAll
but only return the claim
Same as decodeAll
but only return the claim
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
if successful, the claim of the token in its correct type
Same as decodeAll
but only return the claim
Same as decodeAll
but only return the claim
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, the claim of the token in its correct type
Same as decodeAll
but only return the claim
Same as decodeAll
but only return the claim
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
if successful, the claim of the token in its correct type
Same as decodeAll
but only return the claim
Same as decodeAll
but only return the claim
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, the claim of the token in its correct type
Same as decodeAll
but only return the claim
Same as decodeAll
but only return the claim
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, the claim of the token in its correct type
Same as decodeAll
but only return the claim
Same as decodeAll
but only return the claim
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, the claim of the token in its correct type
Same as decodeAll
but only return the claim
Same as decodeAll
but only return the claim
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
if successful, the claim of the token in its correct type
Same as decodeRawAll
but return the real header and claim types
Same as decodeRawAll
but return the real header and claim types
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
if successful, a tuple representing the header, the claim and eventually the signature
Same as decodeRawAll
but return the real header and claim types
Same as decodeRawAll
but return the real header and claim types
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a tuple representing the header, the claim and eventually the signature
Same as decodeRawAll
but return the real header and claim types
Same as decodeRawAll
but return the real header and claim types
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
if successful, a tuple representing the header, the claim and eventually the signature
Same as decodeRawAll
but return the real header and claim types
Same as decodeRawAll
but return the real header and claim types
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a tuple representing the header, the claim and eventually the signature
Same as decodeRawAll
but return the real header and claim types
Same as decodeRawAll
but return the real header and claim types
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a tuple representing the header, the claim and eventually the signature
Same as decodeRawAll
but return the real header and claim types
Same as decodeRawAll
but return the real header and claim types
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a tuple representing the header, the claim and eventually the signature
Same as decodeRawAll
but return the real header and claim types
Same as decodeRawAll
but return the real header and claim types
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
if successful, a tuple representing the header, the claim and eventually the signature
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
if successful, a string representing the JSON version of the claim
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a string representing the JSON version of the claim
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
if successful, a string representing the JSON version of the claim
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a string representing the JSON version of the claim
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a string representing the JSON version of the claim
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a string representing the JSON version of the claim
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
Same as decodeRawAll
but only return the claim (you only care about the claim most of the time)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
if successful, a string representing the JSON version of the claim
Will try to decode a JSON Web Token to raw strings using an asymetric algorithm
Will try to decode a JSON Web Token to raw strings using an asymetric algorithm
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a tuple of 3 strings, the header, the claim and the signature
Will try to decode a JSON Web Token to raw strings using a HMAC algorithm
Will try to decode a JSON Web Token to raw strings using a HMAC algorithm
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a tuple of 3 strings, the header, the claim and the signature
Will try to decode a JSON Web Token to raw strings using an asymetric algorithm
Will try to decode a JSON Web Token to raw strings using an asymetric algorithm
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a tuple of 3 strings, the header, the claim and the signature
Will try to decode a JSON Web Token to raw strings using a HMAC algorithm
Will try to decode a JSON Web Token to raw strings using a HMAC algorithm
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
if successful, a tuple of 3 strings, the header, the claim and the signature
Will try to decode a JSON Web Token to raw strings
Will try to decode a JSON Web Token to raw strings
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
if successful, a tuple of 3 strings, the header, the claim and the signature
An alias of encode
if you only want to pass a string as the key, the algorithm will be deduced from the header.
An alias of encode
if you only want to pass a string as the key, the algorithm will be deduced from the header.
the header to stringify as a JSON before encoding the token
the claim to stringify as a JSON before encoding the token
the secret key to use to sign the token (note that the algorithm will be deduced from the header)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias of encode
if you only want to pass a string as the key, the algorithm will be deduced from the header.
An alias of encode
if you only want to pass a string as the key, the algorithm will be deduced from the header.
the header to stringify as a JSON before encoding the token
the claim to stringify as a JSON before encoding the token
the secret key to use to sign the token (note that the algorithm will be deduced from the header)
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
if you want to use case classes for the header and the claim rather than strings, they will just be stringified to JSON format.
An alias to encode
if you want to use case classes for the header and the claim rather than strings, they will just be stringified to JSON format.
the header to stringify as a JSON before encoding the token
the claim to stringify as a JSON before encoding the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
which will provide an automatically generated header and use the claim as a case class.
An alias to encode
which will provide an automatically generated header and use the claim as a case class.
the claim of the JSON Web Token
the key that will be used to check the token signature
the algorithm to sign the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
which will provide an automatically generated header and use the claim as a case class.
An alias to encode
which will provide an automatically generated header and use the claim as a case class.
the claim of the JSON Web Token
the key that will be used to check the token signature
the algorithm to sign the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
which will provide an automatically generated header and use the claim as a case class.
An alias to encode
which will provide an automatically generated header and use the claim as a case class.
the claim of the JSON Web Token
the key that will be used to check the token signature
the algorithm to sign the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
which will provide an automatically generated header and setting both key and algorithm
to None.
An alias to encode
which will provide an automatically generated header and setting both key and algorithm
to None.
the claim of the JSON Web Token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
which will provide an automatically generated header and allowing you to get rid of Option
for the key and the algorithm.
An alias to encode
which will provide an automatically generated header and allowing you to get rid of Option
for the key and the algorithm.
a valid stringified JSON representing the claim of the token
the key that will be used to check the token signature
the algorithm to sign the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
which will provide an automatically generated header and allowing you to get rid of Option
for the key and the algorithm.
An alias to encode
which will provide an automatically generated header and allowing you to get rid of Option
for the key and the algorithm.
a valid stringified JSON representing the claim of the token
the key that will be used to check the token signature
the algorithm to sign the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
which will provide an automatically generated header and allowing you to get rid of Option
for the key and the algorithm.
An alias to encode
which will provide an automatically generated header and allowing you to get rid of Option
for the key and the algorithm.
a valid stringified JSON representing the claim of the token
the key that will be used to check the token signature
the algorithm to sign the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias to encode
which will provide an automatically generated header.
An alias to encode
which will provide an automatically generated header.
a valid stringified JSON representing the claim of the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
Encode a JSON Web Token from its different parts.
Encode a JSON Web Token from its different parts. Both the header and the claim will be encoded to Base64 url-safe, then a signature will be eventually generated from it if you did pass a key and an algorithm, and finally, those three parts will be merged as a single string, using dots as separator.
a valid stringified JSON representing the header of the token
a valid stringified JSON representing the claim of the token
the key that will be used to check the token signature
the algorithm to sign the token
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
An alias for isValid
if you want to directly pass a string as the key
An alias for isValid
if you want to directly pass a string as the key
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
a boolean value indicating if the token is valid or not
An alias for isValid
if you want to directly pass a string as the key
An alias for isValid
if you want to directly pass a string as the key
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
a boolean value indicating if the token is valid or not
An alias for isValid
if you want to directly pass a string as the key for asymetric algorithms
An alias for isValid
if you want to directly pass a string as the key for asymetric algorithms
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
a boolean value indicating if the token is valid or not
An alias for isValid
if you want to directly pass a string as the key for HMAC algorithms
An alias for isValid
if you want to directly pass a string as the key for HMAC algorithms
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
a boolean value indicating if the token is valid or not
Test if a token is valid.
Test if a token is valid. Doesn't throw any exception.
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
a boolean value indicating if the token is valid or not
An alias of validate
in case you want to directly pass a string key.
An alias of validate
in case you want to directly pass a string key.
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
IllegalArgumentException
couldn't decode the token since it's not a valid base64 string
JwtExpirationException
the token isn't valid anymore because its expiration
attribute is in the past
JwtLengthException
the number of parts separated by dots is wrong
JwtNotBeforeException
the token isn't valid yet because its notBefore
attribute is in the future
JwtValidationException
default validation exeption
An alias of validate
in case you want to directly pass a string key.
An alias of validate
in case you want to directly pass a string key.
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
IllegalArgumentException
couldn't decode the token since it's not a valid base64 string
JwtExpirationException
the token isn't valid anymore because its expiration
attribute is in the past
JwtLengthException
the number of parts separated by dots is wrong
JwtNotBeforeException
the token isn't valid yet because its notBefore
attribute is in the future
JwtValidationException
default validation exeption
An alias of validate
in case you want to directly pass a string key for asymetric algorithms.
An alias of validate
in case you want to directly pass a string key for asymetric algorithms.
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
IllegalArgumentException
couldn't decode the token since it's not a valid base64 string
JwtExpirationException
the token isn't valid anymore because its expiration
attribute is in the past
JwtLengthException
the number of parts separated by dots is wrong
JwtNotBeforeException
the token isn't valid yet because its notBefore
attribute is in the future
JwtValidationException
default validation exeption
An alias of validate
in case you want to directly pass a string key for HMAC algorithms.
An alias of validate
in case you want to directly pass a string key for HMAC algorithms.
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
the key that will be used to check the token signature
a list of possible algorithms that the token can use. See Security concerns for more infos.
IllegalArgumentException
couldn't decode the token since it's not a valid base64 string
JwtExpirationException
the token isn't valid anymore because its expiration
attribute is in the past
JwtLengthException
the number of parts separated by dots is wrong
JwtNotBeforeException
the token isn't valid yet because its notBefore
attribute is in the future
JwtValidationException
default validation exeption
Valid a token: doesn't return anything but will thrown exceptions if there are any errors.
Valid a token: doesn't return anything but will thrown exceptions if there are any errors.
a JSON Web Token as a Base64 url-safe encoded String which can be used inside an HTTP header
IllegalArgumentException
couldn't decode the token since it's not a valid base64 string
JwtExpirationException
the token isn't valid anymore because its expiration
attribute is in the past
JwtLengthException
the number of parts separated by dots is wrong
JwtNotBeforeException
the token isn't valid yet because its notBefore
attribute is in the future
JwtValidationException
default validation exeption
Default 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
exp
andnbf
in 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 return1
instead of1300819380
. Sorry about that.