Create ABAC Rule
POST /obp/v7.0.0/management/abac-rules
OBPv6.0.0-createAbacRule Roles: CanCreateAbacRule ABAC
Create a new ABAC (Attribute-Based Access Control) rule.
ABAC rules are Scala functions that return a Boolean value indicating whether access should be granted.
Documentation:
- here - Getting started with ABAC rules
- here - Complete list of all 18 parameters
- here - Detailed property reference
- here - Testing examples and patterns
The rule function receives 18 parameters including authenticatedUser, attributes, auth context, and optional objects (bank, account, transaction, etc.).
Example rule code:
// Allow access only if authenticated user is admin
authenticatedUser.emailAddress.contains("admin")
// Allow access only to accounts with balance > 1000
accountOpt.exists(_.balance.toDouble > 1000.0)
User Authentication is Required. The User must be logged in. The Application must also be authenticated.
JSON request body fields (5)
- description
- Description of the object. Maximum length is 2000. It can be any characters here.
- is_active
- false
- policy
- policy
- rule_code
- rule_code
- rule_name
- rule_name
JSON response body fields (8)
- abac_rule_id
- abac_rule_id
- created_by_user_id
- description
- Description of the object. Maximum length is 2000. It can be any characters here.
- is_active
- false
- policy
- policy
- rule_code
- rule_code
- rule_name
- rule_name
- updated_by_user_id
- updated_by_user_id
Example request body
{
"rule_name": "admin_only",
"rule_code": "user.emailAddress.contains(\"admin\")",
"description": "Only allow access to users with admin email",
"policy": "user-access,admin",
"is_active": true
}Example success response
{
"abac_rule_id": "abc123",
"rule_name": "admin_only",
"rule_code": "user.emailAddress.contains(\"admin\")",
"is_active": true,
"description": "Only allow access to users with admin email",
"policy": "user-access,admin",
"created_by_user_id": "user123",
"updated_by_user_id": "user123"
}Possible errors (4)
- OBP-20001: User not logged in. Authentication is required!
- OBP-20006: User is missing one or more roles:
- OBP-10001: Incorrect json format.
- OBP-50000: Unknown Error.