diff --git a/Project.toml b/Project.toml index 639c62c..ab915d7 100644 --- a/Project.toml +++ b/Project.toml @@ -4,7 +4,7 @@ keywords = ["julialang", "jwt", "jwt-authentication", "jwkset", "signing"] license = "MIT" desc = "JSON Web Tokens (JWT) for Julia" authors = ["Tanmay Mohapatra "] -version = "0.2.2" +version = "0.2.3" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/README.md b/README.md index 3fa4851..3f0c91c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ JSON Web Tokens (JWT) are an open, industry standard [RFC 7519](https://tools.ie ## Keys and Key Sets -**JWK** represents a JWK Key (either for signing or verification). JWK can be either a **JWKRSA** or **JWKSymmetric**. A RSA key can represent either the public or private key. +**JWK** represents a JWK Key (either for signing or verification). JWK can be either a **JWKRSA** or **JWKSymmetric**. A RSA key can represent either the public or private key. Ref: https://datatracker.ietf.org/doc/html/rfc7517 **JWKSet** holds a set of keys, fetched from a OpenId key URL, each key identified by a key id. The OpenId key URL is usually found in the OpenId configuration (e.g. `jwks_uri` element in ). diff --git a/src/JWTs.jl b/src/JWTs.jl index 96d0608..ad24319 100644 --- a/src/JWTs.jl +++ b/src/JWTs.jl @@ -346,7 +346,7 @@ Run `f` with a valid JWT. The validated JWT is passed as an argument to `f`. If Arguments: - `f`: The function to execute with a valid JWT. The validated JWT is passed as an argument to `f`. -- `jwt`: The JWT string or JWT object to use. +- `jwt`: The JWT string or JWT object to use. If a string is passed, it is converted to a JWT object. - `keyset`: The JWKSet to use for validation. Only keys in this keyset are used for validation. Keyword arguments: diff --git a/test/runtests.jl b/test/runtests.jl index 4bfef97..08d4e9c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -135,6 +135,11 @@ function test_with_valid_jwt(keyset_url) key = first(keys(keyset.keys)) sign!(jwt, keyset, key) + with_valid_jwt(jwt, keyset) do jwt3 + @test isvalid(jwt3) + @test claims(jwt3) == d + end + jwt2 = JWT(; jwt=string(jwt)) with_valid_jwt(jwt2, keyset) do jwt3 @test isvalid(jwt3)