enhance(SSO): Attributeの調整 (MisskeyIO#555)
This commit is contained in:
parent
478c1eb087
commit
eb884721bb
|
@ -172,7 +172,9 @@ export class JWTIdentifyProviderService {
|
||||||
const roles = await this.roleService.getUserRoles(user.id);
|
const roles = await this.roleService.getUserRoles(user.id);
|
||||||
|
|
||||||
const payload: JWTPayload = {
|
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,
|
preferred_username: user.username,
|
||||||
profile: `${this.config.url}/@${user.username}`,
|
profile: `${this.config.url}/@${user.username}`,
|
||||||
picture: user.avatarUrl ?? undefined,
|
picture: user.avatarUrl ?? undefined,
|
||||||
|
|
|
@ -492,20 +492,28 @@ export class SAMLIdentifyProviderService {
|
||||||
'#text': user.id,
|
'#text': user.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
...(user.name ? [{
|
||||||
'@Name': 'displayname',
|
'@Name': 'firstName',
|
||||||
'@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
|
'@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
|
||||||
'saml:AttributeValue': {
|
'saml:AttributeValue': {
|
||||||
'@xsi:type': 'xs:string',
|
'@xsi:type': 'xs:string',
|
||||||
'#text': user.name ?? user.username,
|
'#text': user.name,
|
||||||
|
},
|
||||||
|
}] : []),
|
||||||
|
{
|
||||||
|
'@Name': 'lastName',
|
||||||
|
'@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
|
||||||
|
'saml:AttributeValue': {
|
||||||
|
'@xsi:type': 'xs:string',
|
||||||
|
'#text': `@${user.username}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'@Name': 'name',
|
'@Name': 'displayName',
|
||||||
'@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
|
'@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
|
||||||
'saml:AttributeValue': {
|
'saml:AttributeValue': {
|
||||||
'@xsi:type': 'xs:string',
|
'@xsi:type': 'xs:string',
|
||||||
'#text': user.username,
|
'#text': user.name ? `${user.name} (@${user.username})` : `@${user.username}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue