Skip to content

Commit

Permalink
Construct invalid JWT manually in OIDC test.
Browse files Browse the repository at this point in the history
- json-jwt library doesn't compose invalid JWT anymore
  • Loading branch information
simi committed Oct 28, 2024
1 parent 70327f4 commit b5b4f42
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,17 @@ def jwt(claims = @claims, key: @pkey)

%w[nbf exp iat iss jti].each do |claim|
should "return bad request with missing/invalid #{claim}" do
@claims[claim] = ["a"]
payload = jwt # generates jwt hash
payload[claim] = ["a"]

post api_v1_oidc_trusted_publisher_exchange_token_path,
params: { jwt: jwt.to_s }
params: { jwt: payload.to_s }

assert_response :bad_request

@claims.delete claim
payload.delete claim
post api_v1_oidc_trusted_publisher_exchange_token_path,
params: { jwt: jwt.to_s }
params: { jwt: payload.to_s }

assert_response :bad_request
end
Expand Down

0 comments on commit b5b4f42

Please sign in to comment.