Skip to content

Commit

Permalink
increment version, add test (#24)
Browse files Browse the repository at this point in the history
Increment patch version for tagging.
Add a test for `with_valid_jwt` passing a string form of jwt.
  • Loading branch information
tanmaykm authored Sep 17, 2023
1 parent bb282cc commit 5463500
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ keywords = ["julialang", "jwt", "jwt-authentication", "jwkset", "signing"]
license = "MIT"
desc = "JSON Web Tokens (JWT) for Julia"
authors = ["Tanmay Mohapatra <[email protected]>"]
version = "0.2.2"
version = "0.2.3"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://accounts.google.com/.well-known/openid-configuration>).

Expand Down
2 changes: 1 addition & 1 deletion src/JWTs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

2 comments on commit 5463500

@tanmaykm
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/91555

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.3 -m "<description of version>" 54635004e664b851558ce7c1bea4e9b2b0219502
git push origin v0.2.3

Please sign in to comment.