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: Add methods for checking roles and authorities #18700

Merged
merged 11 commits into from
Feb 16, 2024

Conversation

peholmst
Copy link
Member

This PR adds methods for checking the user's roles and authorities. The purpose is to make the AuthenticationContext more in line with the useAuth hook in Hilla and reduce the need for implementing a custom "security service". In many cases, it should be enough to inject and use the AuthenticationContext directly.

@CLAassistant
Copy link

CLAassistant commented Feb 14, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

github-actions bot commented Feb 14, 2024

Test Results

1 094 files  ± 0  1 094 suites  ±0   1h 18m 43s ⏱️ - 2m 4s
6 910 tests +39  6 864 ✅ +39  46 💤 ±0  0 ❌ ±0 
7 257 runs  +27  7 199 ✅ +27  58 💤 ±0  0 ❌ ±0 

Results for commit 909c4fe. ± Comparison against base commit 8dad559.

♻️ This comment has been updated with latest results.

@mcollovati mcollovati added the Contribution PRs coming from the community or external to the team label Feb 14, 2024
Copy link
Collaborator

@mcollovati mcollovati left a comment

Choose a reason for hiding this comment

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

Some nits, but other than that, look good to me

@mcollovati mcollovati changed the title Add methods for checking roles and authorities feat: Add methods for checking roles and authorities Feb 15, 2024
Copy link

sonarcloud bot commented Feb 16, 2024

Quality Gate Passed Quality Gate passed

Issues
2 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Collaborator

@mcollovati mcollovati left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @peholmst for adding this feature!

@mcollovati
Copy link
Collaborator

I'll create a ticket on docs repository to add a note about this new utility methods in https://vaadin.com/docs/latest/security/enabling-security#security-utilities

@mcollovati mcollovati merged commit cf4abb0 into main Feb 16, 2024
25 of 26 checks passed
@mcollovati mcollovati deleted the improve_spring_auth_context branch February 16, 2024 07:17
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution PRs coming from the community or external to the team Released with Vaadin 24.4.0 +0.0.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants