forked from janus-idp/backstage-showcase
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rbac): integrate RBAC plugin (janus-idp#588)
* Integrate RBAC plugin * add changeset * adjust to token manager changes Updates to the new version of the RBAC plugin and adjust the API change. * update rbac to 1.6.1 --------- Co-authored-by: Tomas Kral <tkral@redhat.com>
- Loading branch information
Showing
6 changed files
with
372 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'backend': major | ||
--- | ||
|
||
Integrate latest RBAC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,16 @@ | ||
import { createRouter } from '@backstage/plugin-permission-backend'; | ||
import { | ||
AuthorizeResult, | ||
PolicyDecision, | ||
} from '@backstage/plugin-permission-common'; | ||
import { PermissionPolicy } from '@backstage/plugin-permission-node'; | ||
import type { Router } from 'express'; | ||
import type { PluginEnvironment } from '../types'; | ||
|
||
class DefaultPermissionPolicy implements PermissionPolicy { | ||
async handle(): Promise<PolicyDecision> { | ||
return { result: AuthorizeResult.ALLOW }; | ||
} | ||
} | ||
import { PolicyBuilder } from '@janus-idp/backstage-plugin-rbac-backend'; | ||
|
||
export default async function createPlugin( | ||
env: PluginEnvironment, | ||
): Promise<Router> { | ||
return await createRouter({ | ||
return await PolicyBuilder.build({ | ||
config: env.config, | ||
logger: env.logger, | ||
discovery: env.discovery, | ||
policy: new DefaultPermissionPolicy(), | ||
identity: env.identity, | ||
permissions: env.permissions, | ||
tokenManager: env.tokenManager, | ||
}); | ||
} |
Oops, something went wrong.