1468 Commits

Author SHA1 Message Date
Marcus Hert Da Coregio
15306c1007 Merge branch '6.1.x' into 6.2.x 2024-02-16 13:21:15 -03:00
Rob Winch
750cb30ce4 Add AuthenticationTrustResolver.isAuthenticated 2024-02-16 13:08:29 -03:00
DingHao
b0da37d4fa Have Method Security Start at Target Class
Closes gh-13783
2024-02-01 09:33:25 -07:00
Sam Brannen
2b7d296994 Revise AuthorizationAnnotationUtils
This commit revises AuthorizationAnnotationUtils as follows.

- Removes code duplication by treating both Class and Method as
  AnnotatedElement.

- Avoids duplicated annotation searches by processing merged
  annotations in a single Stream instead of first using the
  MergedAnnotations API to find possible duplicates and then again
  searching for a single annotation via AnnotationUtils (which
  effectively performs the same search using the MergedAnnotations API
  internally).

- Uses `.distinct()` within the Stream to avoid the need for the
  workaround introduced in gh-13625. Note that the semantics here
  result in duplicate "equivalent" annotations being ignored. In other
  words, if @⁠PreAuthorize("hasRole('someRole')") is present multiple
  times as a meta-annotation, no exception will be thrown and the first
  such annotation found will be used.

- Improves the error message when competing annotations are found by
  including the competing annotations in the error message.

- Updates AuthorizationAnnotationUtilsTests to cover all known,
  supported use cases.

- Configures correct role in @⁠RequireUserRole.

Please note this commit uses
`.map(MergedAnnotation::withNonMergedAttributes)` to retain backward
compatibility with previous versions of Spring Security. However, that
line can be deleted if the Spring Security team decides that it wishes
to support merged annotation attributes via custom composed
annotations. If that decision is made, the
composedMergedAnnotationsAreNotSupported() test should be renamed and
updated as explained in the comment in that method.

See gh-13625
See https://github.com/spring-projects/spring-framework/issues/31803
2024-01-18 07:42:58 -07:00
Marcus Hert Da Coregio
85177c0178 Merge branch '6.2.x'
Closes gh-14408
2024-01-05 14:22:49 -03:00
Taehong Kim
ec02c22459 Add Request Path Extraction Support
Closes gh-13256
2023-12-19 18:15:49 -07:00
Josh Cummings
4a50d5aab3
Merge branch '6.2.x' 2023-12-09 11:52:31 -07:00
Josh Cummings
6e636e6abb
Merge branch '6.1.x' into 6.2.x
Closes gh-14267
2023-12-09 11:50:58 -07:00
Josh Cummings
9f90661b6f
Merge branch '5.8.x' into 6.1.x
Closes gh-14266
2023-12-09 11:43:04 -07:00
Josh Cummings
be11812fe4
Account for Super-super-interface Inheritance
Closes gh-13625
2023-12-09 11:41:02 -07:00
Josh Cummings
92be497d24 Polish RoleHierachyImpl#of
- Change to #fromHierarchy to match naming convention
- Keep existing test methods the same
- Deprecate setHierarchy and default constructor
- Add private Map constructor
- Change Adjust RoleHierarchyBuilder to use Map constructor

Issue gh-13788
2023-12-08 11:49:50 -07:00
Toshiaki Maki
c1b3351569 Add RoleHierarchyImpl#of
Closes gh-13788
2023-12-08 11:49:50 -07:00
Josh Cummings
bb6b55aca3 Add Not Support
Closes gh-14058
2023-12-07 16:24:19 -07:00
Yuriy Savchenko
e49ae096e6 Add AuthorizationManager factory methods
Factory methods to create AuthorizationManager with a configurable default AuthorizationDecision.

Closes gh-13085
2023-12-07 15:20:08 -07:00
Josh Cummings
ee8bc78cbc Polish RoleHierarchyImpl#Builder
- Added documentation
- Removed withNoRolePrefix for now; let's see how folks
use the minimal API first
- Adjusted class hierarchy to match AuthorizeHttpRequests more
closely
- Adjusted to match Spring Security style guide
- Added needed @since attributes

Issue gh-13300
2023-12-07 15:18:13 -07:00
Federico Herrera
7d366242ce Add RoleHierarchyImpl.Builder
Closes gh-13300
2023-12-07 15:18:13 -07:00
Marcus Hert Da Coregio
e3ab1c94d7 Use assertj assertions 2023-11-17 09:04:50 -03:00
Marcus Hert Da Coregio
a7da9491d9 Use assertj assertions 2023-11-17 09:03:36 -03:00
Josh Cummings
24abf45128
Merge remote-tracking branch 'origin/6.1.x' 2023-11-07 13:13:29 -07:00
Josh Cummings
f295e9d28f
Merge branch '6.0.x' into 6.1.x
Closes gh-14111
2023-11-07 13:09:20 -07:00
Josh Cummings
bb354f1895
Merge branch '5.8.x' into 6.0.x
Closes gh-14110
2023-11-07 13:07:25 -07:00
Josh Cummings
11a21896dd
Defer SecurityContextHolderStrategy Lookup
Due to how early method interceptors are loaded during startup
it's reasonable to consider scenarios where applications are
changing the global security context holder strategy during
startup.

Closes gh-12877
2023-11-07 12:36:16 -07:00
Steve Riesenberg
447f40949c
Revert unnecessary merges on 6.1.x
This commit removes unnecessary main-branch merges starting from
9f8db22b774fe78fef3598c07e184c371892c1c7 and adds the following
needed commit(s) that were made afterward:

- 4d6ff49b9d663d0f25454f3704a45c83b35da689
- ed6ff670d102736eea0ac360921c9015151ac630
- c823b007942a04a27d02c0a28bc2ad85e8790084
- 44fad21363bef1b06422be28c9bbfadde5e44804
2023-10-31 15:22:15 -05:00
Steve Riesenberg
9db33f33c7
Revert unnecessary merges on 6.0.x
This commit removes unnecessary main-branch merges starting from
8750608b5bca45525c99d0a41a20ed02de93d8c7 and adds the following
needed commit(s) that were made afterward:

- 5dce82c48bc0b174838501c5a111b2de70822914
2023-10-31 15:11:45 -05:00
Martin Lukas
1589d19c8b Fix typos in spring-security core module 2023-10-31 09:48:43 -03:00
Marcus Da Coregio
07b6c451fd Merge branch '6.1.x'
Closes gh-13884
2023-09-29 11:47:38 -03:00
Marcus Da Coregio
8adfc9b463 Merge branch '6.0.x' into 6.1.x
Closes gh-13883
2023-09-29 11:46:48 -03:00
Marcus Da Coregio
92c82191c9 Merge branch '5.8.x' into 6.0.x
Closes gh-13882
2023-09-29 11:46:00 -03:00
Marcus Da Coregio
64e2a2ff8b Apply updated Code Style
Closes gh-13881
2023-09-29 11:44:32 -03:00
Steve Riesenberg
7f61d40415
Fix code style 2023-09-27 10:51:08 -05:00
Marcus Da Coregio
33fb37e134 Fix Tests on JDK 21
Issue gh-13811
2023-09-27 11:59:09 -03:00
Steve Riesenberg
ff374935fb
Verify ReactorContext when using Virtual Threads
Closes gh-12791
2023-09-25 12:01:31 -05:00
Steve Riesenberg
247ce5dcab
Add integration tests for virtual threads
Closes gh-12790
2023-09-19 10:39:05 -05:00
Steve Riesenberg
ecf8467cac
Fix tests on JDK 21
Issue gh-12790
Issue gh-13811
2023-09-19 10:39:04 -05:00
Tim te Beek
9df9cb5aed refactor: AssertJ best practices
Use this link to re-run the recipe: https://app.moderne.io/recipes/builder/bGVuS?organizationId=RGVmYXVsdA%3D%3D

Co-authored-by: Moderne <team@moderne.io>
2023-09-12 16:18:14 -06:00
maimate-dev
7b2cb59dab
Localize AccessDeniedException message
Closes gh-13419
2023-07-27 16:50:41 -05:00
Josh Cummings
6c3636d780
Update Removed Usages
Issue gh-13544
2023-07-14 18:38:58 -06:00
Josh Cummings
b62dd851a2
Merge branch '6.1.x'
Closes gh-13489
2023-07-11 17:03:53 -06:00
Josh Cummings
0579be0d25
Merge branch '6.0.x' into 6.1.x
Closes gh-13488
2023-07-11 17:02:59 -06:00
Josh Cummings
6393702e70
Fix allOf/anyOf Abstain Logic
Closes gh-13487
2023-07-11 17:02:07 -06:00
Claudio Nave
52e12ad64b Replace deprecated methods 2023-06-22 13:19:55 -06:00
Evgeniy Cheban
0cefb27928 Simplify RequestMatcherDelegatingAuthorizationManager.Builder matcher registration
Closes gh-11624
2023-06-22 16:07:30 -03:00
kandaguru17
fa2bc745f7 Use AuthoritiesAuthorizationManager in Jsr250AuthorizationManager
Closes gh-12782
2023-06-22 11:25:54 -06:00
Krzysztof Krason
9b603b99ab Using modern Java features 2023-06-22 11:24:25 -06:00
Steve Riesenberg
1f04baa4a3
Polish gh-13290
Issue gh-12533
2023-06-13 14:17:40 -05:00
Dmitry Korotych
4def405067
Allow authorities to be overridden in UserBuilder
Issue gh-12533
2023-06-13 14:12:47 -05:00
Josh Cummings
613165b86c
Merge branch '6.0.x' 2023-05-11 11:46:10 -06:00
Josh Cummings
c6c091b12e
Merge branch '5.8.x' into 6.0.x 2023-05-11 11:43:37 -06:00
Josh Cummings
05ef215b88 Align Formatting
Issue gh-13132
2023-05-11 11:42:51 -06:00
Florian Cramer
9669747245 Ignore synthetic methods when checking for duplicate annotations
Closes gh-13132
2023-05-11 11:42:51 -06:00