okta-oidc-js icon indicating copy to clipboard operation
okta-oidc-js copied to clipboard

Add support for checking roles/groups in a directive to show/hide elements

Open mraible opened this issue 8 years ago • 7 comments
trafficstars

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

mraible avatar Nov 04 '17 21:11 mraible

Do you have an idea of when this feature will be available? Thank you.

s-toussaint avatar May 04 '18 17:05 s-toussaint

Can whip up a structural directive for the Angular piece of this.

cmckni3 avatar Aug 08 '18 14:08 cmckni3

@cmckni3 I’d love to see your code if you’ve already implemented this.

mraible avatar Nov 29 '18 01:11 mraible

@mraible I have not gotten around to it. There's an example of a structural directive in the Angular docs

cmckni3 avatar Dec 20 '18 18:12 cmckni3

@mraible - Can you give an example of what SDK support you're looking for here?

swiftone avatar Jan 31 '20 21:01 swiftone

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.

mraible avatar Jan 31 '20 21:01 mraible

internal ref: OKTA-277249

aarongranick-okta avatar Jun 30 '21 17:06 aarongranick-okta