Skip to content

Commit

Permalink
enhance(SSO): Attributeの調整 (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
u1-liquid authored Mar 20, 2024
1 parent 478c1eb commit eb88472
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ export class JWTIdentifyProviderService {
const roles = await this.roleService.getUserRoles(user.id);

const payload: JWTPayload = {
name: user.name ?? user.username,
name: user.name ? `${user.name} (@${user.username})` : `@${user.username}`,
given_name: user.name ?? undefined,
family_name: `@${user.username}`,
preferred_username: user.username,
profile: `${this.config.url}/@${user.username}`,
picture: user.avatarUrl ?? undefined,
Expand Down
16 changes: 12 additions & 4 deletions packages/backend/src/server/sso/SAMLIdentifyProviderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,20 +492,28 @@ export class SAMLIdentifyProviderService {
'#text': user.id,
},
},
...(user.name ? [{
'@Name': 'firstName',
'@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
'saml:AttributeValue': {
'@xsi:type': 'xs:string',
'#text': user.name,
},
}] : []),
{
'@Name': 'displayname',
'@Name': 'lastName',
'@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
'saml:AttributeValue': {
'@xsi:type': 'xs:string',
'#text': user.name ?? user.username,
'#text': `@${user.username}`,
},
},
{
'@Name': 'name',
'@Name': 'displayName',
'@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
'saml:AttributeValue': {
'@xsi:type': 'xs:string',
'#text': user.username,
'#text': user.name ? `${user.name} (@${user.username})` : `@${user.username}`,
},
},
{
Expand Down

0 comments on commit eb88472

Please sign in to comment.