What problem does it solve?
This skill helps Backstage frontend developers control UI visibility by delegating authorization decisions to Open Policy Agent, making client-side gating consistent with centralized policy logic and reducing hard-coded checks.
Core Features & Use Cases
- RequireOpaAuthz component renders children only when the evaluated Rego entry point returns allow:true, ideal for hiding buttons and sensitive UI elements.
- useOpaAuthz and useOpaAuthzManual hooks enable on-mount and on-demand policy evaluations to implement custom auth flows, conditional dialogs, and guarded actions.
- API factory wiring and testing guidance demonstrates registering OpaAuthzClientReact in apis.ts, shaping input for Rego, and mocking the hooks for unit tests and CI validation.
Quick Start
Install the frontend package, register the OpaAuthzClientReact API factory in packages/app/src/apis.ts, and wrap the protected UI with RequireOpaAuthz referencing your Rego entry point.