You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/rbac-backend/README.md
+27-10Lines changed: 27 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,12 @@ To effectively utilize the RBAC plugin, you must have the Backstage permission f
16
16
17
17
You need to [set up the permission framework in Backstage](https://backstage.io/docs/permissions/getting-started/).Since this plugin provides a dynamic policy that replaces the traditional one, there's no need to create a policy manually. Please note that one of the requirements for permission framework is enabling the [service-to-service authentication](https://backstage.io/docs/auth/service-to-service-auth/#setup). Ensure that you complete these authentication setup steps as well.
18
18
19
-
Note: Red Hat Developer Hub users enjoy the benefit of Permission Framework and backend-to-backend authentication being enabled by default
20
-
21
19
### Configuring the Backend
22
20
23
21
To connect the RBAC framework to your backend use the `PolicyBuilder` class in your backend permissions plugin (typically `packages/backend/src/plugins/permissions.ts`) as follows:
24
22
25
23
```ts
24
+
/* highlight-add-start */
26
25
import { Router } from'express';
27
26
28
27
import {
@@ -48,18 +47,32 @@ export default async function createPlugin(
48
47
pluginIdProvider,
49
48
);
50
49
}
50
+
/* highlight-add-end */
51
51
```
52
52
53
53
Secondly, in your backend router (typically `packages/backend/src/index.ts`) add a route for `/permission` specifying the list of plugin id's that support permissions:
54
54
55
55
```ts
56
-
apiRouter.use(
57
-
'/permission',
58
-
awaitpermission(permissionEnv, {
59
-
// return list static plugin which supports Backstage permissions.
For more information on the available API endpoints, refer to the [API documentation](./docs/apis.md).
113
+
99
114
### Configuring policies via file
100
115
101
116
The RBAC plugin also allows you to import policies from an external file. These policies are defined in the [Casbin rules format](https://casbin.org/docs/category/the-basics), known for its simplicity and clarity. For a quick start, please refer to the format details in the provided link.
@@ -104,7 +119,7 @@ Here's an example of an external permission policies configuration file named `r
0 commit comments