Switch the shared demo token and navigate through the guarded pages to see how the same OPA permissions drive both routed access and in-page UI state.

Directive demo

Template access checks

The shared token in the app shell flows through provideAuthz() as defaultInput .

Organisationsverwaltung

Requires ADMIN .

Access denied

Kundenverwaltung

Allows ADMIN and MODERATOR .

Access allowed

Directive
<ng-container *authz="'test/Organisationsverwaltung'; loading: organisationsLoading; else: organisationsDenied">
  <p>Access allowed</p>
</ng-container>
<ng-template #organisationsLoading>
  <p>Loading policy result...</p>
</ng-template>
<ng-template #organisationsDenied>
  <p>Access denied</p>
</ng-template>

Hook demo

Interactive useAuthz playground


Result
true
Error
Loading
false
Shell token
MODERATOR
Hook
protected readonly testPath = signal('test/Organisationsverwaltung');
protected readonly testToken = signal('ADMIN');

protected readonly useAuthzTest = useAuthz<boolean>({
  path: this.testPath,
  input: computed(() => ({ token: this.testToken() })),
});
$pnpm add dfx-opa