Skip to content

Commit

Permalink
Fixes to allow setting downloader for precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Jun 14, 2024
1 parent 0e02362 commit 9b7dc42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "OktaJWTVerifier"
uuid = "4bff0fe4-4ead-499c-9e50-e12c47db005b"
version = "1.0.3"
version = "1.1"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand All @@ -15,7 +15,7 @@ julia = "1.6"
ExpiringCaches = "1"
HTTP = "1"
JSON = "0.21"
JWTs = "0.2"
JWTs = "0.2.5"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
9 changes: 6 additions & 3 deletions src/OktaJWTVerifier.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module OktaJWTVerifier

using Base64, HTTP, JSON, Dates, JWTs, ExpiringCaches
using Base64, HTTP, JSON, Dates, JWTs, ExpiringCaches, Logging

export Verifier, verify_access_token!, verify_id_token!

Expand Down Expand Up @@ -66,7 +66,8 @@ function fetch_metadata(url::String)
local resp
try
resp = HTTP.get(url)
catch
catch e
@error "failed to fetch metadata" exception=(e, catch_backtrace())
throw(ArgumentError("Request for metadata $url was not HTTP 2xx OK"))
end
return jsonparse(resp.body)
Expand All @@ -79,10 +80,12 @@ function get_metadata(j::Verifier)
end
end

const DOWNLOADER = Ref{Any}(nothing)

function decode(v::Verifier, jwt::String, jwkuri::String)
jwkset = get!(v.jwkset_cache, jwkuri) do
jks = JWKSet(jwkuri)
refresh!(jks)
refresh!(jks; downloader=DOWNLOADER[])
return jks
end
token = JWT(; jwt)
Expand Down

2 comments on commit 9b7dc42

@quinnj
Copy link
Member Author

@quinnj quinnj commented on 9b7dc42 Jun 14, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@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/109010

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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 v1.1.0 -m "<description of version>" 9b7dc421b2702757e56b08ab725fec4c8c0d7bf0
git push origin v1.1.0

Please sign in to comment.