Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support role based auth directive - OKTA-277249 #66

Closed
wants to merge 3 commits into from

Conversation

shuowu
Copy link
Contributor

@shuowu shuowu commented Sep 17, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Adding Tests
  • Build related changes
  • CI related changes
  • Documentation changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Reviewers

const value = groups[key];

// groups or custom claims is avaiable in idToken
if (idToken.claims[key]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would verifying ID token before checking the claims be useful for this feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's checked at the beginning of this method. around line 39

@Input() set oktaHasAnyGroup(groups: Groups) {
this.authStateService.hasAnyGroups(groups)
.subscribe(isAuthorized => {
// not update UI if no state change
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// not update UI if no state change
// don't update UI if no state change

const key = Object.keys(groups)[0];
const value = groups[key];

// groups or custom claims is avaiable in idToken
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// groups or custom claims is avaiable in idToken
// groups or custom claims is available in idToken

Copy link
Contributor

@mraible mraible left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typos

@shuowu-okta shuowu-okta force-pushed the sw-role-based-auth-directive-new-OKTA-277249 branch from 1834a11 to f4b6860 Compare September 27, 2021 16:45
eng-prod-CI-bot-okta pushed a commit that referenced this pull request Sep 27, 2021
OKTA-277249
<<<Jenkins Check-In of Tested SHA: f4b6860 for eng_productivity_ci_bot_okta@okta.com>>>
Artifact: okta-angular
Files changed count: 13
PR Link: "#66"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants