SAML; Dashboard
This commit is contained in:
61
app/classes/saml/FlitterProfileMapper.js
Normal file
61
app/classes/saml/FlitterProfileMapper.js
Normal file
@@ -0,0 +1,61 @@
|
||||
class FlitterProfileMapper {
|
||||
map = {
|
||||
nameIdentifier: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier',
|
||||
email: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress',
|
||||
name: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name',
|
||||
givenname: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname',
|
||||
surname: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname',
|
||||
upn: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn',
|
||||
groups: 'http://schemas.xmlsoap.org/claims/Group'
|
||||
}
|
||||
|
||||
metadata = [ {
|
||||
id: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
|
||||
optional: true,
|
||||
displayName: 'E-Mail Address',
|
||||
description: 'The e-mail address of the user'
|
||||
}, {
|
||||
id: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname",
|
||||
optional: true,
|
||||
displayName: 'Given Name',
|
||||
description: 'The given name of the user'
|
||||
}, {
|
||||
id: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
|
||||
optional: true,
|
||||
displayName: 'Name',
|
||||
description: 'The unique name of the user'
|
||||
}, {
|
||||
id: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname",
|
||||
optional: true,
|
||||
displayName: 'Surname',
|
||||
description: 'The surname of the user'
|
||||
}, {
|
||||
id: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
|
||||
optional: true,
|
||||
displayName: 'Name ID',
|
||||
description: 'The SAML name identifier of the user'
|
||||
}]
|
||||
|
||||
constructor(user) {
|
||||
this.user = user
|
||||
}
|
||||
|
||||
getClaims() {
|
||||
const claims = {}
|
||||
|
||||
claims[this.map.nameIdentifier] = this.user.uid
|
||||
claims[this.map.email] = this.user.email
|
||||
claims[this.map.name] = `${this.user.first_name} ${this.user.last_name}`
|
||||
claims[this.map.givenname] = this.user.first_name
|
||||
claims[this.map.surname] = this.user.last_name
|
||||
|
||||
// TODO groups
|
||||
return claims
|
||||
}
|
||||
|
||||
getNameIdentifier() {
|
||||
return { nameIdentifier: this.user.uid }
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = FlitterProfileMapper
|
||||
Reference in New Issue
Block a user