Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
[compat]
julia = "1"
HTTP = "0.8, 0.9, 1"
JSON = "0.21"
JSON = "0.21, 1"
JWTs = "0.1, 0.2, 0.3"
MbedTLS = "0.6.8, 0.7, 1"
SHA = "<0.0.1, 0.7, 1"
Expand Down
11 changes: 7 additions & 4 deletions src/OpenIDConnect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ struct OIDCCtx
end

# fetch and store the openid config, along with the additional args for SSL
openid_config = JSON.parse(String(HTTP.request("GET", openid_config_url; status_exception=true, http_tls_opts...).body))
openid_config = JSON.parse(
String(HTTP.request("GET", openid_config_url; status_exception=true, http_tls_opts...).body),
dicttype = Dict{String,Any}
)
validator = JWKSet(openid_config["jwks_uri"])

new(Dict{String,Float64}(), Dict{String,String}(), state_timeout_secs, allowed_skew_secs, openid_config, http_tls_opts, validator, key_refresh_secs, 0.0, client_id, client_secret, scopes, redirect_uri, random_device)
Expand Down Expand Up @@ -208,11 +211,11 @@ function parse_token_response(tok_res)
resp_str = String(tok_res.body)

if tok_res.status == 200
return JSON.parse(resp_str)
return JSON.parse(resp_str, dicttype = Dict{String,Any})
end

try
err_resp = JSON.parse(resp_str)
err_resp = JSON.parse(resp_str, dicttype = Dict{String,Any})
errcode = get(err_resp, "error", nothing)
if errcode !== nothing
return AuthServerError(errcode, get(err_resp, "error_description", nothing), get(err_resp, "error_uri", nothing))
Expand Down Expand Up @@ -292,7 +295,7 @@ function flow_validate_id_token(ctx::OIDCCtx, jwt::JWT)
validator = ctx.validator
if (time() - ctx.last_key_refresh) >= ctx.key_refresh_secs
jstr = String(HTTP.get(ctx.validator.url; ctx.http_tls_opts...).body)
keys = JSON.parse(jstr)["keys"]
keys = JSON.parse(jstr, dicttype = Dict{String,Any})["keys"]
keysetdict = Dict{String,JWK}()
refresh!(keys, keysetdict)
validator.keys = keysetdict
Expand Down
2 changes: 1 addition & 1 deletion tools/oidc_standalone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function main()

# Load configuration
config = open(config_file, "r") do f
JSON.parse(f)
JSON.parse(f, dicttype = Dict{String,Any})
end

# Create OIDC context
Expand Down
Loading