Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update FAQ #2686

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update README.md
  • Loading branch information
maduvena authored Oct 20, 2022
commit 17d670f22b4622ebdc6ab5df7bc038101fca6735
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
```