{"action":"created","issue":{"url":"https://api.github.com/repos/wso2/carbon-identity-framework/issues/1256","repository_url":"https://api.github.com/repos/wso2/carbon-identity-framework","labels_url":"https://api.github.com/repos/wso2/carbon-identity-framework/issues/1256/labels{/name}","comments_url":"https://api.github.com/repos/wso2/carbon-identity-framework/issues/1256/comments","events_url":"https://api.github.com/repos/wso2/carbon-identity-framework/issues/1256/events","html_url":"https://github.com/wso2/carbon-identity-framework/issues/1256","id":286239989,"number":1256,"title":"Conditional claim handling","user":{"login":"ruwanta","id":1294542,"avatar_url":"https://avatars2.githubusercontent.com/u/1294542?v=4","gravatar_id":"","url":"https://api.github.com/users/ruwanta","html_url":"https://github.com/ruwanta","followers_url":"https://api.github.com/users/ruwanta/followers","following_url":"https://api.github.com/users/ruwanta/following{/other_user}","gists_url":"https://api.github.com/users/ruwanta/gists{/gist_id}","starred_url":"https://api.github.com/users/ruwanta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruwanta/subscriptions","organizations_url":"https://api.github.com/users/ruwanta/orgs","repos_url":"https://api.github.com/users/ruwanta/repos","events_url":"https://api.github.com/users/ruwanta/events{/privacy}","received_events_url":"https://api.github.com/users/ruwanta/received_events","type":"User","site_admin":false},"labels":[{"id":795630631,"url":"https://api.github.com/repos/wso2/carbon-identity-framework/labels/5.5.0","name":"5.5.0","color":"f99fc5","default":false},{"id":762163591,"url":"https://api.github.com/repos/wso2/carbon-identity-framework/labels/Complexity/Medium","name":"Complexity/Medium","color":"67fcf5","default":false},{"id":683248287,"url":"https://api.github.com/repos/wso2/carbon-identity-framework/labels/Type/Improvement","name":"Type/Improvement","color":"1d76db","default":false}],"state":"closed","locked":false,"assignee":{"login":"ruwanta","id":1294542,"avatar_url":"https://avatars2.githubusercontent.com/u/1294542?v=4","gravatar_id":"","url":"https://api.github.com/users/ruwanta","html_url":"https://github.com/ruwanta","followers_url":"https://api.github.com/users/ruwanta/followers","following_url":"https://api.github.com/users/ruwanta/following{/other_user}","gists_url":"https://api.github.com/users/ruwanta/gists{/gist_id}","starred_url":"https://api.github.com/users/ruwanta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruwanta/subscriptions","organizations_url":"https://api.github.com/users/ruwanta/orgs","repos_url":"https://api.github.com/users/ruwanta/repos","events_url":"https://api.github.com/users/ruwanta/events{/privacy}","received_events_url":"https://api.github.com/users/ruwanta/received_events","type":"User","site_admin":false},"assignees":[{"login":"ruwanta","id":1294542,"avatar_url":"https://avatars2.githubusercontent.com/u/1294542?v=4","gravatar_id":"","url":"https://api.github.com/users/ruwanta","html_url":"https://github.com/ruwanta","followers_url":"https://api.github.com/users/ruwanta/followers","following_url":"https://api.github.com/users/ruwanta/following{/other_user}","gists_url":"https://api.github.com/users/ruwanta/gists{/gist_id}","starred_url":"https://api.github.com/users/ruwanta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruwanta/subscriptions","organizations_url":"https://api.github.com/users/ruwanta/orgs","repos_url":"https://api.github.com/users/ruwanta/repos","events_url":"https://api.github.com/users/ruwanta/events{/privacy}","received_events_url":"https://api.github.com/users/ruwanta/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-01-05T09:49:41Z","updated_at":"2018-02-19T05:35:45Z","closed_at":"2018-02-19T05:35:45Z","author_association":"CONTRIBUTOR","body":"Conditional Authentication needs to support claim handling.\r\n1. Allow read claims in javascript\r\n2. Add/Modify/Delete existing claims in Authentication Context"},"comment":{"url":"https://api.github.com/repos/wso2/carbon-identity-framework/issues/comments/366593160","html_url":"https://github.com/wso2/carbon-identity-framework/issues/1256#issuecomment-366593160","issue_url":"https://api.github.com/repos/wso2/carbon-identity-framework/issues/1256","id":366593160,"user":{"login":"ruwanta","id":1294542,"avatar_url":"https://avatars2.githubusercontent.com/u/1294542?v=4","gravatar_id":"","url":"https://api.github.com/users/ruwanta","html_url":"https://github.com/ruwanta","followers_url":"https://api.github.com/users/ruwanta/followers","following_url":"https://api.github.com/users/ruwanta/following{/other_user}","gists_url":"https://api.github.com/users/ruwanta/gists{/gist_id}","starred_url":"https://api.github.com/users/ruwanta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruwanta/subscriptions","organizations_url":"https://api.github.com/users/ruwanta/orgs","repos_url":"https://api.github.com/users/ruwanta/repos","events_url":"https://api.github.com/users/ruwanta/events{/privacy}","received_events_url":"https://api.github.com/users/ruwanta/received_events","type":"User","site_admin":false},"created_at":"2018-02-19T05:35:45Z","updated_at":"2018-02-19T05:35:45Z","author_association":"CONTRIBUTOR","body":"## Documentation\r\n\r\nUsually you will want to generate new claims or change a claim value after an existing authentication is successful.\r\nE.g.\r\nGenerate the “Display Name” when you have “First Name” and “Last Name”\r\nGenerate “Age” when you have “Date Of Birth”\r\n\r\nYou are provided two array view of the claims\r\n* Array view with local claim URI\r\n* Array view with remote claim URI\r\n\r\n## Accessing a claim by local claim uri\r\n```\r\nvar myClaimValueX = context.subject.claims.local['http://wso2.org/claims/<x>];\r\n```\r\n## Accessing a claim by remote claim uri\r\n```\r\nvar myClaimValueX = context.subject.claims.remote['http://some.domain.you/claims/<x>];\r\n```\r\n\r\n## Adding a new claim to the claim set\r\n\r\n```\r\nvar newClaim = {}\r\n//Populate claim values, remote and local URI with valid value.\r\n...\r\ncontext.subject.claims.push(newClaim)\r\n```\r\n\r\n## Example\r\n\r\nCreate the \"Display Name\" and attach it as a new claim, by using the first name and last name of the authenticated user.\r\n\r\n```\r\nfunction onInitialRequest (context) {\r\n   executeStep({id :'1',\r\n       on : {\r\n           success : function(context) {\r\n               Log.info('First Authentication success');\r\n               var fName = context.subject.claims.local['http://wso2.org/claims/givenname'];\r\n               var lName = context.subject.claims.local['http://wso2.org/claims/lastname'];\r\n               var displayName = fName + ' '+ lName + ' by Javascript';\r\n               var newClaim = {'local' : {}, 'remote': {}};\r\n               newClaim.remote.uri = 'http://your.domain.some/claims/displayName';\r\n               newClaim.local.uri = 'http://wso2.org/claims/displayName';\r\n               newClaim.value = displayName;\r\n\r\n               Log.info('Display Name: '+displayName);\r\n               context.subject.claims.push(newClaim)\r\n           }\r\n       }\r\n   });\r\n}\r\n```\r\n\r\n"}}
{"actor":{"display_login":"ruwanta"}}