RBAC Reference

    There are 4 basic entities involving RBAC.

    • User: The entity interacting with the system. Can be associated with zero, one or more roles. Example: user has token 1234.
    • Role: Set of permissions (role_endpoint and role_entity). Has a name and can be associated with zero, one or more permissions. Example: user bob is associated with role developer.
    • role_endpoint: A set of enabled or disabled (see negative parameter) actions (read, create, update, delete) endpoint. Example: Role developer has 1 role_endpoint: read & write to endpoint /routes
    • role_entity: A set of enabled or disabled (see negative parameter) actions (read, create, update, delete) entity. Example: Role developer has 1 role_entity: read & write & delete to entity 283fccff-2d4f-49a9-8730-dc8b71ec2245.

    Endpoint

    /rbac/users

    Request Body

    Response

    1. {
    2. "comment": null,
    3. "created_at": 1557522650,
    4. "enabled": true,
    5. "id": "fa6881b2-f49f-4007-9475-577cd21d34f4",
    6. "name": "doc_knight",
    7. "user_token": "$2b$09$Za30VKAAAmyoB9zF2PNEF.9hgKcN2BdKkptPMCubPK/Ps08lzZjYG",
    8. "user_token_ident": "4d870"
    9. }

    Retrieve a User

    Endpoint

    /rbac/users/{name_or_id}

    AttributeDescription
    name_or_idThe RBAC user name or UUID.

    Response

    1. HTTP 200 OK
    1. {
    2. "created_at": 1557522650,
    3. "enabled": true,
    4. "id": "fa6881b2-f49f-4007-9475-577cd21d34f4",
    5. "name": "doc_lord",
    6. "user_token": "$2b$09$Za30VKAAAmyoB9zF2PNEF.9hgKcN2BdKkptPMCubPK/Ps08lzZjYG",
    7. "user_token_ident": "4d870"
    8. }

    List Users

    Endpoint

    /rbac/users/

    Response

    1. HTTP 200 OK
    1. {
    2. "data": [
    3. {
    4. "comment": null,
    5. "created_at": 1557512629,
    6. "enabled": true,
    7. "id": "f035f120-a95e-4327-b2ae-8fa264601d75",
    8. "name": "doc_lord",
    9. "user_token": "$2b$09$TIMneYcTosdG9WbzRsqcweAS2zote8g6I8HqXAtbFHR1pds2ymsh6",
    10. "user_token_ident": "88ea3"
    11. },
    12. {
    13. "comment": null,
    14. "created_at": 1557522650,
    15. "enabled": true,
    16. "id": "fa6881b2-f49f-4007-9475-577cd21d34f4",
    17. "name": "doc_knight",
    18. "user_token": "$2b$09$Za30VKAAAmyoB9zF2PNEF.9hgKcN2BdKkptPMCubPK/Ps08lzZjYG",
    19. "user_token_ident": "4d870"
    20. }
    21. ],
    22. "next": null
    23. }

    ⚠️ Note: RBAC Users associated with Admins will not be listed with GET /rbac/users. Instead, use GET /admins to list all Admins.


    Update a User

    Endpoint

    /rbac/users/{name_or_id}

    AttributeDescription
    name_or_idThe RBAC user name or UUID.

    Request Body

    AttributeDescription
    user_token
    optional
    The authentication token to be presented to the Admin API. If this value is not present, the token will automatically be generated.
    enabled
    optional
    A flag to enable or disable the user. By default, users are enabled.
    comment
    optional
    A string describing the RBAC user object.

    Response

    1. HTTP 200 OK
    1. {
    2. "comment": "this comment came from a patch request",
    3. "created_at": 1557522650,
    4. "enabled": true,
    5. "id": "fa6881b2-f49f-4007-9475-577cd21d34f4",
    6. "name": "donut_lord",
    7. "user_token": "$2b$09$Za30VKAAAmyoB9zF2PNEF.9hgKcN2BdKkptPMCubPK/Ps08lzZjYG",
    8. "user_token_ident": "4d870"
    9. }

    Delete a User

    Endpoint

    /rbac/users/{name_or_id}

    AttributeDescription
    name_or_idThe RBAC user name or UUID.

    Response

    1. HTTP 204 No Content

    Add a Role

    Endpoint

    /rbac/roles

    AttributeDescription
    nameThe RBAC role name.
    comment
    optional
    A string describing the RBAC user object.

    Response

    1. HTTP 201 Created
    1. {
    2. "comment": null,
    3. "created_at": 1557532241,
    4. "id": "b5c5cfd4-3330-4796-9b7b-6026e91e3ad6",
    5. "is_default": false,
    6. "name": "service_reader"
    7. }

    Retrieve a Role

    Endpoint

    /rbac/roles/{name_or_id}

    AttributeDescription
    name_or_idThe RBAC role name or UUID.

    Response

    1. HTTP 200 OK
    1. {
    2. "created_at": 1557532241,
    3. "id": "b5c5cfd4-3330-4796-9b7b-6026e91e3ad6",
    4. "is_default": false,
    5. "name": "service_reader"
    6. }

    List Roles

    Endpoint

    /rbac/roles

    Response

    1. HTTP 200 OK
    1. {
    2. "data": [
    3. {
    4. "comment": "Full access to all endpoints, across all workspaces—except RBAC Admin API",
    5. "created_at": 1557506249,
    6. "id": "38a03d47-faae-4366-b430-f6c10aee5029",
    7. "name": "admin"
    8. },
    9. {
    10. "comment": "Read access to all endpoints, across all workspaces",
    11. "created_at": 1557506249,
    12. "id": "4141675c-8beb-41a5-aa04-6258ab2d2f7f",
    13. "name": "read-only"
    14. },
    15. {
    16. "comment": "Full access to all endpoints, across all workspaces",
    17. "created_at": 1557506249,
    18. "id": "888117e0-f2b3-404d-823b-dee595423505",
    19. "name": "super-admin"
    20. },
    21. {
    22. "comment": null,
    23. "created_at": 1557532241,
    24. "id": "b5c5cfd4-3330-4796-9b7b-6026e91e3ad6",
    25. "name": "doc_lord"
    26. }
    27. ],
    28. }

    Endpoint

    /rbac/roles/{name_or_id}

    Request Body

    AttributeDescription
    nameThe RBAC role name.
    comment
    optional
    A string describing the RBAC user object.

    Response

    If creating the entity:

    1. HTTP 201 Created

    If replacing the entity:

    1. {
    2. "comment": "the best",
    3. "created_at": 1557532566,
    4. "id": "b5c5cfd4-3330-4796-9b7b-6026e91e3ad6",
    5. "is_default": false,
    6. "name": "doc_lord"

    Update a Role

    Endpoint

    /rbac/roles/{name_or_id}

    AttributeDescription
    name_or_idThe RBAC role or UUID.

    Request Body

    AttributeDescription
    comment
    optional
    A string describing the RBAC role object.

    Response

    1. HTTP 200 OK
    1. {
    2. "comment": "comment from patch request",
    3. "created_at": 1557532566,
    4. "id": "b5c5cfd4-3330-4796-9b7b-6026e91e3ad6",
    5. "is_default": false,
    6. "name": "service_reader"
    7. }

    Delete a Role

    Endpoint

    /rbac/roles/{name_or_id}

    Response

    1. HTTP 204 No Content

    Add a Role Endpoint Permission

    Endpoint

    /rbac/roles/{name_or_id}/endpoints

    AttributeDescription
    name_or_idThe RBAC role name.

    Request Body

    AttributeDescription
    workspaceWorkspace tied to the endpoint. Defaults to the default permission. Special value of “*” means all workspaces are affected
    endpointEndpoint associated with this permission.
    negativeIf true, explicitly disallow the actions associated with the permissions tied to this endpoint. By default this value is false.
    actionsOne or more actions associated with this permission. This is a comma separated string (read,create,update,delete)
    comment
    optional
    A string describing the RBAC permission object.

    endpoint must be the path of the associated endpoint. They can be exact matches, or contain wildcards, represented by *.

    • Exact matches:
      • /services/
      • /services/foo
    • Wildcards:
      • /services/*
      • /services/*/plugins

    Where * replaces exactly one segment between slashes (or the end of the path).

    Note that wildcards can be nested (/rbac/*, /rbac/*/*, /rbac/*/*/* would refer to all paths under /rbac/)

    Response

    1. HTTP 201 Created
    1. {
    2. "actions": [
    3. "delete",
    4. "create",
    5. "update",
    6. "read"
    7. ],
    8. "created_at": 1557764505,
    9. "endpoint": "/consumers",
    10. "negative": false,
    11. "role": {
    12. "id": "23df9f20-e7cc-4da4-bc89-d3a08f976e50"
    13. },
    14. "workspace": "default"
    15. }

    Retrieve a Role Endpoint Permission

    Endpoint

    /rbac/roles/{name_or_id}/endpoints/{workspace_name_or_id}/{endpoint}

    AttributeDescription
    name_or_idThe RBAC role name or UUID.
    workspace_name_or_idThe workspace name or UUID.
    endpointThe endpoint associated with this permission.

    Response

    1. HTTP 200 OK
    1. {
    2. "actions": [
    3. "delete",
    4. "create",
    5. "update",
    6. "read"
    7. ],
    8. "created_at": 1557764505,
    9. "endpoint": "/consumers",
    10. "negative": false,
    11. "role": {
    12. "id": "23df9f20-e7cc-4da4-bc89-d3a08f976e50"
    13. },
    14. "workspace": "default"
    15. }

    List Role Endpoints Permissions

    Endpoint

    /rbac/roles/{role_name_or_id}/endpoints

    AttributeDescription
    role_name_or_idThe RBAC role name or UUID.

    Response

    1. HTTP 200 OK
    1. {
    2. "data": [
    3. {
    4. "actions": [
    5. "delete",
    6. "create",
    7. "update",
    8. "read"
    9. ],
    10. "created_at": 1557764505,
    11. "endpoint": "/consumers",
    12. "negative": false,
    13. "role": {
    14. "id": "23df9f20-e7cc-4da4-bc89-d3a08f976e50"
    15. },
    16. "workspace": "default"
    17. },
    18. {
    19. "actions": [
    20. "read"
    21. ],
    22. "created_at": 1557764438,
    23. "endpoint": "/services",
    24. "negative": false,
    25. "role": {
    26. "id": "23df9f20-e7cc-4da4-bc89-d3a08f976e50"
    27. },
    28. "workspace": "default"
    29. }
    30. ]
    31. }

    Update a Role Endpoint Permission

    Endpoint

    /rbac/roles/{name_or_id}/endpoints/{workspace_name_or_id}/{endpoint}

    AttributeDescription
    name_or_idThe RBAC role name or UUID.
    workspace_name_or_idThe workspace name or UUID.
    endpointThe endpoint associated with this permission.

    Request Body

    AttributeDescription
    negativeIf true, explicitly disallow the actions associated with the permissions tied to this resource. By default this value is false.
    actionsOne or more actions associated with this permission.

    Response

    1. HTTP 200 OK
    1. {
    2. "actions": [
    3. "delete",
    4. "create",
    5. "update",
    6. "read"
    7. ],
    8. "created_at": 1557764438,
    9. "endpoint": "/services",
    10. "negative": false,
    11. "role": {
    12. "id": "23df9f20-e7cc-4da4-bc89-d3a08f976e50"
    13. },
    14. "workspace": "default"
    15. }

    Delete a Role Endpoint Permission

    Endpoint

    /rbac/roles/{name_or_id}/endpoints/{workspace_name_or_id}/{endpoint}

    AttributeDescription
    name_or_idThe RBAC role name or UUID.
    workspace_name_or_idThe workspace name or UUID.
    endpointThe endpoint associated with this permission.

    Response

    1. HTTP 204 No Content

    Endpoint

    AttributeDescription
    name_or_idThe RBAC role name or UUID.

    Request Body

    AttributeDescription
    negativeIf true, explicitly disallow the actions associated with the permissions tied to this resource. By default this value is false.
    entity_idid of the entity associated with this permission.
    entity_typeType of the entity of a given entity_id.
    actionsOne or more actions associated with this permission.
    comment
    optional
    A string describing the RBAC permission object

    entity_id must be the ID of an entity in Kong; if the ID of a workspace is given, the permission will apply to all entities in that workspace. Future entities belonging to that workspace will get the same permissions. A wildcard * will be interpreted as all entities in the system.

    Response

    1. HTTP 201 Created
    1. {
    2. "actions": [
    3. "delete",
    4. "create",
    5. "read"
    6. ],
    7. "created_at": 1557771505,
    8. "entity_id": "*",
    9. "entity_type": "wildcard",
    10. "negative": false,
    11. "role": {
    12. "id": "bba049fa-bf7e-40ef-8e89-553dda292e99"
    13. }
    14. }

    Retrieve a Role Entity Permission

    Endpoint

    /rbac/roles/{name_or_id}/entities/{entity_id}

    Response

    1. {
    2. "delete",
    3. "create",
    4. "read"
    5. ],
    6. "entity_id": "*",
    7. "entity_type": "wildcard",
    8. "negative": false,
    9. "role": {
    10. "id": "bba049fa-bf7e-40ef-8e89-553dda292e99"
    11. }
    12. }

    List Entity Permissions

    Endpoint

    /rbac/roles/{name_or_id}/entities

    AttributeDescription
    name_or_idThe RBAC permission name or UUID.

    Response

    1. HTTP 200 Ok
    1. {
    2. "data": [
    3. {
    4. "actions": [
    5. "delete",
    6. "create",
    7. "read"
    8. ],
    9. "created_at": 1557771505,
    10. "entity_id": "*",
    11. "entity_type": "wildcard",
    12. "negative": false,
    13. "role": {
    14. "id": "bba049fa-bf7e-40ef-8e89-553dda292e99"
    15. }
    16. }
    17. ]
    18. }

    Update an Entity Permission

    Endpoint

    /rbac/roles/{name_or_id}/entities/{entity_id}

    AttributeDescription
    name_or_idThe RBAC role name or UUID.
    entity_idThe entity name or UUID.

    Request Body

    AttributeDescription
    negativeIf true, explicitly disallow the actions associated with the permissions tied to this resource. By default this value is false.
    actionsOne or more actions associated with this permission.

    Response

    1. HTTP 200 OK
    1. {
    2. "actions": [
    3. "update"
    4. ],
    5. "created_at": 1557771505,
    6. "entity_id": "*",
    7. "entity_type": "wildcard",
    8. "negative": false,
    9. "role": {
    10. "id": "bba049fa-bf7e-40ef-8e89-553dda292e99"
    11. }
    12. }

    Delete an Entity Permission

    Endpoint

    /rbac/roles/{name_or_id}/entities/{entity_id}

    AttributeDescription
    name_or_idThe RBAC role name or UUID.
    entity_idThe entity name or UUID.

    Response

    1. HTTP 204 No Content

    List Role Permissions

    Endpoint

    /rbac/roles/{name_or_id}/permissions/

    AttributeDescription
    name_or_idThe RBAC role name or UUID.

    Response

    1. HTTP 200 OK
    1. {
    2. "endpoints": {
    3. "*": {
    4. "*": {
    5. "actions": [
    6. "delete",
    7. "create",
    8. "update",
    9. "read"
    10. ],
    11. "negative": false
    12. },
    13. "/*/rbac/*": {
    14. "actions": [
    15. "delete",
    16. "create",
    17. "update",
    18. "read"
    19. ],
    20. "negative": true
    21. }
    22. }
    23. },
    24. "entities": {}
    25. }

    Add a User to a Role

    Endpoint

    /rbac/users/{name_or_id}/roles

    AttributeDescription
    name_or_idThe RBAC role name or UUID.

    Request Body

    AttributeDescription
    rolesComma-separated list of role names to assign to the user.

    Response

    1. HTTP 201 Created
    1. {
    2. "roles": [
    3. {
    4. "created_at": 1557772263,
    5. "id": "aae80073-095f-4553-ba9a-bee5ed3b8b91",
    6. "name": "doc-knight"
    7. }
    8. ],
    9. "user": {
    10. "comment": null,
    11. "created_at": 1557772232,
    12. "enabled": true,
    13. "id": "b65ca712-7ceb-4114-87f4-5c310492582c",
    14. "name": "gruce-wayne",
    15. "user_token": "$2b$09$gZnMKK/mm/d2rAXN7gL63uL43mjdX/62iwMqdyCQwLyC0af3ce/1K",
    16. "user_token_ident": "88ea3"
    17. }
    18. }

    List a User’s Roles

    Endpoint

    /rbac/users/{name_or_id}/roles

    AttributeDescription
    name_or_idThe RBAC role name or UUID.

    Response

    1. HTTP 200 OK
    1. {
    2. "roles": [
    3. {
    4. "comment": "Read access to all endpoints, across all workspaces",
    5. "created_at": 1557765500,
    6. "id": "a1c810ee-8366-4654-ba0c-963ffb9ccf2e",
    7. "name": "read-only"
    8. },
    9. {
    10. "created_at": 1557772263,
    11. "id": "aae80073-095f-4553-ba9a-bee5ed3b8b91",
    12. "name": "doc-knight"
    13. }
    14. ],
    15. "user": {
    16. "comment": null,
    17. "created_at": 1557772232,
    18. "enabled": true,
    19. "id": "b65ca712-7ceb-4114-87f4-5c310492582c",
    20. "name": "gruce-wayne",
    21. "user_token": "$2b$09$gZnMKK/mm/d2rAXN7gL63uL43mjdX/62iwMqdyCQwLyC0af3ce/1K",
    22. "user_token_ident": "88ea3"
    23. }
    24. }

    Endpoint

    /rbac/users/{name_or_id}/roles

    AttributeDescription
    name_or_idThe RBAC role name or UUID.

    Request Body

    Response

    1. HTTP 204 No Content

    List a User’s Permissions

    Endpoint

    AttributeDescription
    name_or_idThe RBAC role name or UUID.

    Response

    1. HTTP 200 OK
    1. {
    2. "endpoints": {
    3. "*": {
    4. "*": {
    5. "actions": [
    6. "read"
    7. ],
    8. "negative": false
    9. }
    10. }
    11. },
    12. "entities": {}
    13. }