Skip to content

Commit

Permalink
Remove password from jwt. Review mods.
Browse files Browse the repository at this point in the history
  • Loading branch information
svogt0511 committed Feb 25, 2022
1 parent fc039b4 commit f30fac5
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/models/concerns/authenticable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ def generate_token(attributes = {})
provider_id: attributes.fetch(:provider_id, nil),
client_id: attributes.fetch(:client_id, nil),
role_id: attributes.fetch(:role_id, "staff_admin"),
password: attributes.fetch(:password, nil),
beta_tester: attributes.fetch(:beta_tester, nil),
has_orcid_token: attributes.fetch(:has_orcid_token, nil),
aud: attributes.fetch(:aud, Rails.env),
Expand All @@ -331,7 +330,6 @@ def generate_alb_token(attributes = {})
provider_id: attributes.fetch(:provider_id, nil),
client_id: attributes.fetch(:client_id, nil),
role_id: attributes.fetch(:role_id, "user"),
password: attributes.fetch(:password, nil),
aud: Rails.env,
iat: Time.now.to_i,
exp: Time.now.to_i + attributes.fetch(:exp, 30),
Expand All @@ -358,11 +356,8 @@ def get_payload(uid: nil, user: nil, password: nil)

# we only need password for clients registering DOIs in the handle system
if uid.include? "."
payload.merge!(
"provider_id" => user.provider_id,
"client_id" => uid,
"password" => password,
)
payload["provider_id"] = user.provider_id
payload["client_id"] = uid
elsif uid != "admin"
payload["provider_id"] = uid
end
Expand Down

0 comments on commit f30fac5

Please sign in to comment.