File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,11 @@ module Authly
72
72
end
73
73
74
74
private def generate_id_token
75
- if scope.includes? " openid"
75
+ if scope.includes? " openid"
76
76
payload = Authly .owners.id_token(auth_code[" user_id" ].as_s)
77
77
payload[" iss" ] = Authly .config.issuer
78
+ payload[" aud" ] = @client_id
79
+ payload
78
80
Authly .jwt_encode(payload)
79
81
end
80
82
end
Original file line number Diff line number Diff line change 1
1
module Authly
2
2
struct Owner
3
+ property id : String = Random ::Secure .hex(16 )
4
+ property name : String = " "
5
+ property email : String = " "
3
6
property username : String
4
7
property password : String
5
8
@@ -26,11 +29,13 @@ module Authly
26
29
end
27
30
28
31
def id_token (user_id : String ) : Hash (String , String | Int64 )
32
+ user = find! { |owner | owner.id == user_id }
29
33
{
30
- " sub" => Random :: Secure .hex( 32 ) ,
34
+ " sub" => user_id ,
31
35
" iat" => Time .utc.to_unix,
32
36
" exp" => 1 .hour.from_now.to_unix,
33
- " user_id" => user_id,
37
+ " name" => user.name,
38
+ " email" => user.email
34
39
}
35
40
end
36
41
You can’t perform that action at this time.
0 commit comments