Skip to content

Commit

Permalink
Fix user identifier in ID token generation
Browse files Browse the repository at this point in the history
Updated the ID token generation to use the actual user ID instead of the username. This change ensures that the token is generated with the correct user identifier, aligning with expected authentication practices and potentially resolving issues related to user identification in tokens. This aligns more closely with the intended use of the 'sub' claim in token standards.
  • Loading branch information
eliasjpr committed Oct 19, 2024
1 parent 0832c2c commit bdde441
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/authly/owner.cr
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ module Authly
def id_token(user_id : String) : Hash(String, String | Int64)
user = find! { |owner| owner.username == user_id }
{
"sub" => user_id,
"iat" => Time.utc.to_unix,
"exp" => Authly.config.access_ttl.from_now.to_unix,
"iss" => Authly.config.issuer,
"sub" => user.id,
"iat" => Time.utc.to_unix,
"exp" => Authly.config.access_ttl.from_now.to_unix,
"iss" => Authly.config.issuer,
}
end

Expand Down

0 comments on commit bdde441

Please sign in to comment.