Create and Get Custom Roles and assign them to users - fusionauth

I can't understand how to create custom roles in fusionauth. I want to create my own set of roles and put them in respective groups.
Are roles and groups are synonymous in fusionauth ? I see roleIds object inside groups but can't find much detailed documentation on that.
Also jwt token has roles[]. Is it possible to return those custom roles in jwt token?
Any help is appreciated.

You may use the UI or the API to create roles for an application. When you create an Application in FusionAuth you may create the roles at the same time. The UI link above is a tutorial to create an application in the UI.
The roles for the default application FusionAuth cannot be modified. This application represents the admin user interface. You will create at least one application that represents your application.
Are roles and groups are synonymous in fusionauth ?
No. Roles belong to an Application. An application in FusionAuth represents and authenticate resource. A Group is a logical grouping of users, and a way to manage roles across multiple applications.
To manage roles for an Application once it has been created navigate to the Application Roles. Settings --> Applications --> Manage Roles The Manage Roles button is the dark blue one in the row action.
The FusionAuth Group can be used to assign roles from multiple applications to a user through Group membership.
For example, assume you have multiple Applications, Support Portal and Workday, and each of these applications contains an admin role.
A FusionAuth Group could be created called Admins and it would be assigned the admin role from Support Portal and Workday.
A User can be assigned the admin role for both of these Applications through Group membership. The user will still require a registration to the application to receive the roles assigned to the Group. This mechanism provides a way to manage role assignment for groupings of users.
The roleIds inside of the Group object is how the API will interact with Application Roles. If you utilize the UI you can just point and click.
Also jwt token has roles[]. Is it possible to return those custom roles in jwt token?
The roles assigned directly through a User Registration or by Group Membership will come back in the JWT in the roles claim when logging into a specific Application.

Related

Users inherit client roles in keycloak?

In keycloak does the user inherit roles from the clients ?
If so, is this configurable ?
Thank you.
Yes, user can assign client's role by UI of Keycloak or REST API.
User can get inherit roles from multiple clients.
It is configurable with combination clients roles.
I will demo assign a roles by UI
#1 Assigned four roles from three clients and default role.
#2 Get roles mapping for specific user by API
GET http://{keycloak-IP}/auth/admin/realms/{my-realm}/users/{user-uuid}/role-mappings
Using post man and master token.

Authenticate AZURE Ad user by App role assigned to the user group

I have created an App role for my AZURE AD Backend Api and assigned this role to a group. Now I want to authenticate user in my .net core backend application on the basis if user has a group which has this role. I am getting the group ids in the access token but how can I get app roles assigned to these groups.
Please check how you enabled group claims in Azure Portal.
If you check the Emit groups as role claims option like below you cannot see application roles, but you can see group ids.
If the above option is enabled, make sure to uncheck the box.
Note
If you use the option to emit group data as roles, only groups will
appear in the role claim. Any application roles that the user is assigned to won't appear in the role claim.
Also, I would suggest you refer to this Microsoft official documentation below which states that if you add a service principal to a group, and then assign an app role to that group, Azure AD does not add the roles claim to tokens it issues.You can modify the “groupMembershipClaims” field in application manifest if you want to include groups claim in your token like below: -
Add app roles to your application and receive them in the token
For more in detail, please refer below link:
Configure group claims for applications by using Azure Active Directory

how to do authentication and authorization for the users for the specific regions in azure AD?

net core application. I am trying to implement authentication and authorization. I have users they are split into multiple regions. For example I have below regions.
GE GSAS
- user1
- user2
APAC
-user3
-user4
SE&A
-user5
-user6
These users have different permissions or roles. For example, RegionalAdmin,GlobalAdmin,Users etc
These users will be creating some orders in the portal. For example, Regional head can reassign orders within that region only to other users. For global head he/she can reassign orders to anyone. Users can create orders and view delete and users cannot reassign orders. All these users are part of Azure AD tenant. Now I am trying to implement authentication and authorization. I started thinking the design strategy like this, I can create groups as per regions and add users to groups. Based on the groups I can have authentication or authorization. But these users have different permissions like RegionalAdmin,GlobalAdmin etc and these users have some extra functionalities aloowed in web/api permission. Can someone help me regarding this and how to organize groups or roles with respect to above scenario. Any help owuld be greatly appreciated. Thank you
Assuming regional admin you mentioned as a custom role in your application(as there is no such role in AAD), it is always better to use the administrative-units and a suggestable approach would be to create groups separately for regional admin, global admin users and assign roles to these groups accordingly.
A user can be assigned to multiple groups and roles can be assigned to individual users/groups.
Authorize applications based on the role permissions granted by the administrator to groups. Please refer this link for the detailed documentation on how to create/manage roles for an application in Azure AD.

Azure Ad segregation between roles and groups

net core application and trying to implement authentication and authorization. I have set of users and these users belong to different regions. For example I have region APAC and I have some users in it. Then I have roles like global admin or regional admin. Now these users are type of regional admin global admin etc. Now I want to return role claim in my token. To return role claim in my JWT token I should add app roles in manifest. So how should I return app roles now. If I select as group then all users belong to that group emits this role details. I am little bit confused here. I have grouped users according to regions. Inside each region users are of type regional admin, global admin etc and they have different permissions inside app. Segregation of these groups vs roles I am finding lot of challenge and no use full document also I found. Can some one help me to segregate these groups vs roles.
As I understand you have users with different roles under the groups segregated by the regions. When you are trying to authorize by group all the users with different roles of the group emit the group role details.
Assuming regional admin you mentioned as a custom role for your application(as there is no such role in AAD) following is a suggestable approach.
A user can be assigned to multiple groups and Roles can be assigned to individual users/groups.
Create groups separately for regional admin, global admin users and assign roles to these groups accordingly.
If you are using the role claim in the token for role-based access control, authorize applications based on the role permissions granted by the administrator to groups. Please refer this link for the detailed documentation on how to create/manage roles for an application in Azure AD.

How to assign a role to users authenticated through specific web logic provider

Weblogic contains a lot of security providers. It's feasible to make more than one authentication provider active at a time. The problem is we need to assign a different role to the user whenever he is authenticated through one of the providers. Is it possible to assign a specific role to the user each time he got authenticated through one of the providers?
A user can only have a given set of roles at any given time. Roles can be changed in the admin console but can not be done dynamic and for good reason. One would not want an unauthorized user to be able to become the Admin to a server. You can assign all the roles the user requires but you cannot dynamically, using code, perform such compromising tasks.
In short, a user can only perform tasks to the ability that the role provides him at any given time.