Comments (1)
Documentation
Usually you will want to generate new claims or change a claim value after an existing authentication is successful.
E.g.
Generate the “Display Name” when you have “First Name” and “Last Name”
Generate “Age” when you have “Date Of Birth”
You are provided two array view of the claims
- Array view with local claim URI
- Array view with remote claim URI
Accessing a claim by local claim uri
var myClaimValueX = context.subject.claims.local['http://wso2.org/claims/<x>];
Accessing a claim by remote claim uri
var myClaimValueX = context.subject.claims.remote['http://some.domain.you/claims/<x>];
Adding a new claim to the claim set
var newClaim = {}
//Populate claim values, remote and local URI with valid value.
...
context.subject.claims.push(newClaim)
Example
Create the "Display Name" and attach it as a new claim, by using the first name and last name of the authenticated user.
function onInitialRequest (context) {
executeStep({id :'1',
on : {
success : function(context) {
Log.info('First Authentication success');
var fName = context.subject.claims.local['http://wso2.org/claims/givenname'];
var lName = context.subject.claims.local['http://wso2.org/claims/lastname'];
var displayName = fName + ' '+ lName + ' by Javascript';
var newClaim = {'local' : {}, 'remote': {}};
newClaim.remote.uri = 'http://your.domain.some/claims/displayName';
newClaim.local.uri = 'http://wso2.org/claims/displayName';
newClaim.value = displayName;
Log.info('Display Name: '+displayName);
context.subject.claims.push(newClaim)
}
}
});
}
from carbon-identity-framework.
Related Issues (20)
- UserMgtFailureAuditLoggerTest is skippped
- JS Functions, Getting current tenant domain by context instead of threadlocal HOT 1
- MultiAttributeSeperator always overriden by DefaultClaimHandler HOT 1
- Please open a security advisory
- Error log in wso2carbon log- ERROR {org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataHandler} - Invalid argument: 'otherDialectURI' is 'NULL'
- Database tables duplicated in postgresql create script
- Authenticated subject is not passing properly
- Can JSONRequestParser/ResponseWriter be pulled into their own jar?
- Fix unique constraint in configuration management test script
- Missing brace in the identity.xml.j2
- Implement deletion of Identity Providers on Tenant Deletion
- Implement deletion of all consents of a tenant on tenant deletion
- Implement deletion of Claim Metadata on Tenant Deletion
- Implement deletion of Service Provider Apps on Tenant Deletion
- Implement deletion of Workflows on Tenant Deletion
- Post Application Listeners are not called when creating a Service Provider from Mgt Console
- Repeated DB calls when external claims are retrieved
- Multiple "update IDP" queries being Issued In the authentication flow HOT 1
- External claim retrieval oracle query issue
- Add character set definition for all the tables HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carbon-identity-framework.