fix(openid): name claim is required in id_token
This commit is contained in:
parent
77104472df
commit
941f4846c7
1 changed files with 6 additions and 3 deletions
|
|
@ -1,3 +1,6 @@
|
|||
use std::ascii::AsciiExt;
|
||||
|
||||
use axum::body::HttpBody;
|
||||
use fully_pub::fully_pub;
|
||||
use jsonwebtoken::get_current_timestamp;
|
||||
use kernel::models::{authorization::AuthorizationScope, config::Config, user::User};
|
||||
|
|
@ -74,8 +77,8 @@ struct OIDCIdTokenClaims {
|
|||
aud: String,
|
||||
/// End-user id assigned by the issuer (user_id)
|
||||
sub: String,
|
||||
/// additional claims
|
||||
name: Option<String>,
|
||||
/// Displayable name
|
||||
name: String,
|
||||
email: Option<String>,
|
||||
/// handle of user
|
||||
preferred_username: Option<String>,
|
||||
|
|
@ -101,7 +104,7 @@ impl OIDCIdTokenClaims {
|
|||
iat: get_current_timestamp(),
|
||||
exp: get_current_timestamp() + 86_000,
|
||||
email: user.email,
|
||||
name: user.full_name,
|
||||
name: user.full_name.unwrap_or(user.handle.clone()),
|
||||
picture: user.avatar_asset_id.map(|asset_id| format!("{}/api/user-assets/{}", &config.instance.base_uri, asset_id)),
|
||||
preferred_username: Some(user.handle),
|
||||
roles: user.roles.0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue