简体   繁体   中英

WSO2 Identity Server 5.0.0 boolean claims

I am trying to add custom boolean claims to my user profiles. I added claim in the http://wso2.org/oidc/claim dialect and then added the necessary mapping in the http://wso2.org/claims and made the claim supported by default. I want to store boolean value in that custom claim (true/false). Once I open some identity I see a blank value for that claim. If I store the value "true" and save the profile, I receive a checkbox with tick. If I then go and update some other field of the same identity and click save, the boolean value is preserved and I am still seeing the checkbox with the tick (which represents the "true" value). Then I decided to uncheck the value for my custom boolean claim in order to store the "false" value for the claim. But once I clicked "save" button, I was no longer seeing the empty checkbox (which I expect to represent the "false" value). Instead I am seeing a blank field which expects value. At this moment if I try to call the user info endpoint, I am not retrieving the mentioned custom claim. In order to receive a false value for it, I need to go to the mentioned identity, explicitly type "false" and save the identity. After that I receive the "false" value for that claim. Then if for some reason someone goes after me and update another part of the identity, the "false" value for my custom claim is lost and I fall in the previous situation and I am not able to get the value for the custom claim, because it is not defined.
I am using "Account locked" claim and I am not able to observe such behavior with this claim. I suppose because it is a sort of special one, because it is used by the identity management.
Is there a way to workaround this situation? For the moment I made the claim "required" and you are not able to save the identity with an empty value for that claim (through the IS Admin Console).
Is this expected behavior when it comes to boolean claims in the WSO2 IS 5.0.0?

This is the expected behavior. Claims can have any value (numeric, boolean, text etc.) and therefore Identity Server cannot identify the data type of the claim. However booleans are treated little bit different. Initially when you add the claim, it will be displayed as a text box as IS cannot decide the data type. Once you save the user profile adding either 'true' or 'false' as the value for the text box (for the very first time), then internally IS will identify this claim to be a boolean. From then onwards it will be displayed as a check box in the UI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM