Skip to content

Commit

Permalink
Update README.md (#2686)
Browse files Browse the repository at this point in the history
  • Loading branch information
maduvena authored Oct 20, 2022
1 parent d3867f6 commit 3434e08
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/script-catalog/update_token/sample-script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,19 @@ Used to modify claims in a Refresh Token
1. Use this: [Reference for testing](https://github.com/JanssenProject/jans/blob/main/jans-auth-server/client/src/test/java/io/jans/as/client/ws/rs/AuthorizationCodeFlowHttpTest.java)
2. Inspect the tokens. Use [jwt.io](https://jwt.io) to inspect the contents of a JWT.

## FAQ

1. How can I add a `dict` type object as a claim value?
```
from io.jans.as.model.uti import JwtUtil
from org.json import JSONObject;
def modifyIdToken(self, jsonWebResponse, context):
datas = {'country': 'ID', 'sponsor': '7022952467', 'role': 'BusinessOwner', 'salesplanaff': '220', 'acctsubtype': 'BusinessOwner', 'accttype': 'AmBCBusiness', 'abo': '7022953754', 'aboname': 'NEW', 'lclpartyid': '119700175', 'email': None, 'status': 'Active'}
string_rep = json.dumps(datas)
jsonObject = JwtUtil.fromJson(string_rep)
jsonWebResponse.getClaims().setClaim("test", jsonObject)
print "Update token script. Modify idToken: %s" % jsonWebResponse
return True
```

0 comments on commit 3434e08

Please sign in to comment.