Since I am using auth0 with SAML 2 for sisense.This means that after a user is authenticated, Auth0 sends a SAML response back to Sisense, not ID/Access Tokens. So, instead of adding the organization information as a custom claim to ID/Access Tokens, you’ll just need to add the organization information to the SAML response. You’ll need to do this with a Rule. It’s not supported yet with Actions
So I tried this
function addOrgIdToAccessToken(user, context, callback) {
// This rule adds the authenticated user's email address to the access token.
console.log("user log sisense ",user);
console.log("context log sisense ",context);
console.log("callback log sisense ",callback);
console.log("context.organization",context.organization);
let namespace = "http://clinifyhealth.com";
//context.accessToken[`${namespace}/org`] = context.organization.id;
//callback(null, user, context);
// if available, add organization_id to SAML response
if (context.organization) {
user.org_id = context.organization;
context.samlConfiguration.mappings = {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/organization_id": "org_id"
};
}
return callback(null, user, context);
}
And after that I got the response as this
user log sisense {
name: 'jdoe@foobar.com',
email: 'jdoe@foobar.com',
user_id: 'auth0|0123456789',
nickname: 'jdoe',
picture: 'http://foobar.com/pictures/jdoe.png',
identities: [
{
provider: 'auth0',
user_id: '0123456789',
connection: 'Username-Password-Connection',
isSocial: false
}
],
persistent: {}
}
context log sisense {
clientID: '123456789',
clientName: 'MyWebApp',
connection: 'MyDbConn',
connectionStrategy: 'auth0',
protocol: 'oidc-basic-profile',
request: {
query: { scope: 'openid' },
body: {},
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36',
ip: 'X.X.X.X',
geoip: {
city_name: 'Buenos Aires',
continent_code: 'SA',
country_code: 'AR',
country_code3: 'ARG',
country_name: 'Argentina',
latitude: -34.6072,
longitude: -58.3875,
subdivision_code: 'C',
subdivision_name: 'Buenos Aires F.D.',
time_zone: 'America/Argentina/Buenos_Aires'
}
},
samlConfiguration: {},
stats: { loginsCount: 5 },
accessToken: {},
idToken: {},
riskAssessment: {
confidence: 'low',
version: '1',
assessments: {
UntrustedIP: [Object],
NewDevice: [Object],
ImpossibleTravel: [Object]
}
}
}
callback log sisense [Function]
context.organization undefined
The profile is:
{
"name": "jdoe@foobar.com",
"email": "jdoe@foobar.com",
"nickname": "jdoe",
"picture": "http://foobar.com/pictures/jdoe.png",
"user_id": "auth0|0123456789",
"identities": [
{
"provider": "auth0",
"user_id": "0123456789",
"connection": "Username-Password-Connection",
"isSocial": false
}
]
}
The rules context is:
{
"clientID": "123456789",
"clientName": "MyWebApp",
"connection": "MyDbConn",
"connectionStrategy": "auth0",
"protocol": "oidc-basic-profile",
"request": {
"query": {
"scope": "openid"
},
"body": {},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36",
"ip": "X.X.X.X",
"geoip": {
"city_name": "Buenos Aires",
"continent_code": "SA",
"country_code": "AR",
"country_code3": "ARG",
"country_name": "Argentina",
"latitude": -34.6072,
"longitude": -58.3875,
"subdivision_code": "C",
"subdivision_name": "Buenos Aires F.D.",
"time_zone": "America/Argentina/Buenos_Aires"
}
},
"samlConfiguration": {},
"stats": {
"loginsCount": 5
},
"accessToken": {},
"idToken": {},
"riskAssessment": {
"confidence": "low",
"version": "1",
"assessments": {
"UntrustedIP": {
"confidence": "low",
"code": "found_on_deny_list",
"details": {
"ip": "1.1.1.1",
"matches": "1.1.1.1/32",
"source": "STOPFORUMSPAM-1"
}
},
"NewDevice": {
"confidence": "low",
"code": "no_match",
"details": {
"device": "unknown",
"useragent": "unknown"
}
},
"ImpossibleTravel": {
"confidence": "low",
"code": "impossible_travel_from_last_login"
}
}
}
}
This didn’t work because I don’t have the organization key in my context object. Do you know how can I add organization key to the context object