Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
George Jahad committed Nov 8, 2024
1 parent fbc6e0c commit f459d52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/lib/clients/vault/entity_alias.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def delete_entity_alias(entity_name, alias_name, auth_path)

private
def find_alias(aliases, name, auth_path)
aliases.find { |a| a[:name] == name && a[:mount_path] == "auth/#{auth_path}/"}
aliases.find { |a| a[:name] == name && a[:mount_path] == "auth/#{auth_path}/" }
end
end
end
Expand Down
12 changes: 7 additions & 5 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ class TestCase

# Helper methods
def jwt_authorized
data = {"sub"=>"[email protected]", "name"=>"John Doe", "iat"=>1516239022,
"groups"=>["group1", "group2"], "aud"=>"astral"}
JWT.encode(data, Config[:jwt_signing_key])
@@authorized_token ||= JWT.encode(@@authorized_data, Config[:jwt_signing_key])
end

def jwt_unauthorized
data = {"sub"=>"application_name", "common_name"=>"example.com", "ip_sans"=>"10.0.1.100"}
JWT.encode(data, "bad_secret")
@@unauthorized_token ||= JWT.encode(@@unauthorized_data, "bad_secret")
end

private
@@authorized_data = { "sub"=>"[email protected]", "name"=>"John Doe", "iat"=>1516239022,
"groups"=>[ "group1", "group2" ], "aud"=>"astral" }
@@unauthorized_data = { "sub"=>"application_name", "common_name"=>"example.com", "ip_sans"=>"10.0.1.100" }
end
end

0 comments on commit f459d52

Please sign in to comment.