Docs

Sample Use Cases: Rules with Authorization

With rules, you can modify or complement the outcome of the decision made by the pre-configured authorization policy to handle more complicated cases than is possible with role-based access control (RBAC) alone. Based on the order in which they run, rules can change the outcome of the authorization decision prior to the permissions being added to the Access Token. They can also allow you to customize the content of your tokens.

Allow access only on weekdays for a specific application

Let's say you have an application that you want to make sure is only accessible during weekdays. To do this, you would create the following rule:

If it is weekend, a user will be denied access to the specified application even if they successfully authenticate and have the appropriate privileges.

Allow access only to users who are inside the corporate network

Let's say you want to allow access to an application, but only for users who are accessing the application from inside your corporate network. To do this, you would create the following rule:

If the user is outside the corporate network, they will be denied access even if they successfully authenticate and have the appropriate privileges.

Add user roles to tokens

If you enable RBAC for APIs and set the Token Dialect appropriately, you will receive user permissions in your Access Tokens. To add user roles to tokens, you would use the context.authorization object in the following rule:

Keep reading