okta-oidc-js
okta-oidc-js copied to clipboard
Add support for checking roles/groups in a directive to show/hide elements
Here's how it's implemented in JHipster:
https://github.com/jhipster/generator-jhipster/blob/master/generators/client/templates/angular/src/main/webapp/app/shared/auth/has-any-authority.directive.ts.ejs
Do you have an idea of when this feature will be available? Thank you.
Can whip up a structural directive for the Angular piece of this.
@cmckni3 I’d love to see your code if you’ve already implemented this.
@mraible I have not gotten around to it. There's an example of a structural directive in the Angular docs
@mraible - Can you give an example of what SDK support you're looking for here?
It'd be a directive like this:
<div *hasGroup="'ROLE_ADMIN'">...</div>
Or:
<div *hasGroup="['Administrator', 'Manager']">...</div>
Where the values would need to exist in the groups claim of the ID token. JHipster has a similar directive (noted in this issue's description) and it works well with Okta providing you configure the groups claim.
internal ref: OKTA-277249