简体   繁体   中英

roles and permissions in WSO2 and ANGULAR

I am creating an application with Angular and using the authentication provider with WSO2, when logging in from the application getting the following in the console: respuesta

I want to make the users who access my application have the necessary permissions, for example: I have a price list on a route, this list can only be edited by a person who has the edit: price permission, if the user has this permission the application allows the user to edit the price list. How can I get this type of permission when I log in with WSO2?

Your application level permissions should not be defined/stored in the WSO2 side. Rather, you can create some roles on WSO2 side. (No need to assign any permission to these roles) Ex. editorRole managerRole

You can then assign your users to their respective roles from the WSO2 Identity Server.

When you authenticate, you can get the authenticated user's roles(not permissions, roles.) in the ID_TOKEN.

Your application logic should decode the received token and take the decision whether to allow or not a particular operation, by checking the roles claim of the token.

To make that decision, you application logic needs to have a mapping of WSO2_ROLE against your APPLICATION_OPERATIONS . (Or against the APPLICATION_PERMISSIONS )

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