Commit Graph

34 Commits

Author SHA1 Message Date
Phillip Webb
bcbcafaab2 Polish "Use method references when possible in test code"
See gh-40974
2024-06-11 12:58:04 -07:00
Ahmed Ashour
207327d97c Use method references when possible in test code
See gh-40974
2024-06-11 12:58:00 -07:00
Phillip Webb
65af35c1ac Revert "Temporarily disable failing test"
This reverts commit bb37a868b3.

Closes gh-38659
2023-12-15 07:42:00 -08:00
Phillip Webb
bb37a868b3 Temporarily disable failing test
See gh-gh-38822
2023-12-14 20:33:28 -08:00
Phillip Webb
00dc942e94 Migrate to Spring Security lambda config
Closes gh-35011
2023-04-14 17:39:48 -07:00
Phillip Webb
c4de86c244 Merge branch '2.7.x' into 3.0.x 2023-02-21 23:17:57 -08:00
Phillip Webb
df5898a146 Reformat code following spring-javaformat upgrade 2023-02-21 22:53:27 -08:00
Madhura Bhave
8cb615e9b6 Remove workarounds for SecurityContextRepository 2022-11-10 14:23:17 -08:00
Madhura Bhave
f4cf722c27 Align default security filter dispatcher types with Spring Security
Fixes gh-33090
2022-11-10 13:53:47 -08:00
Madhura Bhave
ce3c933f77 Adapt to Spring Security changes
Closes gh-32604
2022-10-19 11:46:27 -07:00
Madhura Bhave
cedd553b83 Remove error page security filter
Spring Security now re-applies the authorization rules
to the error page by default. Additionally, it configures
RequestAttributeSecurityContextRepository as the default for
stateless applications allowing those applications to have access
to the original authentication during an error dispatch.

Closes gh-31703
2022-10-19 11:46:27 -07:00
Brian Clozel
5fb2a50ad0 Adapt build dependencies to httpclient5
As htttpclient 4.x is not supported anymore by `RestTemplate`, this
commit changes such dependencies to httpclient5 instead. In some cases,
the httpclient 4.x was transitively brought by a non-Spring dependency.

See gh-32461
2022-09-29 18:55:41 +02:00
Vedran Pavic
230f2cda84 Migrate to AuthorizationFilter in Spring Security auto-config
This commit updates Servlet based Spring Security auto-configuration
to use AuthorizationFilter, which is intended to supersede
FilterSecurityInterceptor.

See gh-31255
2022-09-22 13:53:54 +01:00
Andy Wilkinson
4bd3534b7d Adapt to change in Security's filtering behavior
Spring Security now filters every dispatch by default and not only
once-per-request. Security configuration has been updated in a number of
places to restore the old behavior as needed for the tests to pass.
gh-31703 has been opened to review this and to investigate if we can
now remove the error page security filter and rely on the filtering of
every dispatch instead.

In addition to switching to once-per-request filtering where needed,
this commit also restructures the configuration of the error page
security filter. The restructuring was necessary to ensure that the
privilege evaluator bean has been defined before the conditions on the
error page security filter are evaluated. Without the change, the filter
was no longer being configured as the privilege evaluator hadn't been
defined before the on bean condition was evaluated. We may want to back
port this change as the ordering doesn't appear to have been defined
before and we were just getting lucky.

See gh-31622
See spring-projects/spring-security#11466
2022-07-13 12:09:46 +01:00
Andy Wilkinson
48f8021d88 Migrate @Local*Port annotations to spring-boot-test
Closes gh-29589
2022-04-12 08:48:43 +01:00
Madhura Bhave
3460c24a16 Ignore context path when calling privilege evaluator
Previously, the error page security filter passed the request's URI
to the privilege evaluator. This was incorrect in applications with
a custom context path as the privilege evaluator must be passed a
path that does not include the context path and the request URI
includes the context path.

This commit updates the filter to use UrlPathHelper's
pathWithinApplication instead. The path within the application does
not include the context path. In addition, pathWithinAppliation
also correctly handles applications configured with a servlet
mapping other than the default of /.

Closes gh-29299

Co-Authored-By: Andy Wilkinson <wilkinsona@vmware.com>
2022-01-20 12:36:18 +00:00
Madhura Bhave
d9d161cd6b Allow previously authorized users to access the error page
Prior to this commit, the `ErrorPageSecurityFilter` verified if
access to the error page was allowed by invoking the
`WebInvocationPrivilegeEvaluator` with the Authentication from the
`SecurityContextHolder`.
This meant that access to the error page was denied for a `null` Authentication
 or `AnonymousAuthenticationToken` in cases where the error page required
authenticated access. This prevented authorized users from accessing the
error page in case the Authentication wasn't retrievable for the error dispatch,
which is the case for `@Transient` authentication or stateless session policy.

This commit updates the `ErrorPageSecurityFilter` to check access to the error page
only if the error is an authn or authz error in cases where an authentication object
is not found in the SecurityContextHolder. This makes the error response consistent
when bad credentials or no credentials are used while also allowing access to previously
authorized users.

Fixes gh-28953
2021-12-17 16:58:58 -08:00
Scott Frederick
4eed637481 Merge branch '2.5.x'
Closes gh-28789
2021-11-23 12:45:46 -06:00
Scott Frederick
12244a8edd Remove use of Thymeleaf from smoke tests
Closes gh-28788
2021-11-23 12:13:05 -06:00
Madhura Bhave
dd1d1482dc Deny unauthorized access to the error page
Fixes gh-26356

Co-authored-by Andy Wilkinson <wilkinsona@vmware.com>
2021-11-18 15:41:38 -08:00
Andy Wilkinson
2cec3971d7 Prohibit unwanted dependencies in all modules not just starters
Closes gh-28658
2021-11-12 20:04:35 +00:00
Andy Wilkinson
788a42d694 Merge branch '2.3.x' into 2.4.x
See gh-25076
2021-02-02 15:12:27 +00:00
Andy Wilkinson
67479b6380 Add junit-platform-launcher dependency by convention
Closes gh-25074
2021-02-02 13:03:21 +00:00
Phillip Webb
257608a3a3 Merge branch '2.3.x' into 2.4.x
Closes gh-25076
2021-02-01 16:03:43 -08:00
Phillip Webb
939b5dfc26 Add junit-platform-launcher dependency
Update `build.gradle` files to ensure that `junit-platform-launcher` is
a `testRuntimeOnly` dependency. This ensures that tests can be run from
Eclipse.

Closes gh-25074
2021-02-01 15:31:28 -08:00
Madhura Bhave
0818f27f44 Configure WebSecurity using WebSecurityCustomizer
Replace `WebSecurityConfigurer` and `WebSecurityConfigurerAdapter`
configurations with `WebSecurityCustomizer` or `SecurityFilterChain`
beans.

Closes gh-23421
2020-10-26 23:47:14 -07:00
Phillip Webb
e0013454b5 Use parentheses when declaring dependencies
Update all dependencies declarations to use the form `scope(reference)`
rather than `scope reference`.

Prior to this commit we declared dependencies without parentheses unless
we were forced to add them due to an `exclude`.
2020-01-22 16:02:38 -08:00
Phillip Webb
0209cd3e4c Polish quote form used in Gradle scripts
Replace Gradle single quote strings with the double quote form
whenever possible. The change helps to being consistency to the
dependencies section where mostly single quotes were used, but
occasionally double quotes were required due to `${}` references.
2020-01-22 15:49:52 -08:00
Andy Wilkinson
abbad9973a Polish smoke tests' Gradle configuration 2020-01-13 20:07:05 +00:00
Andy Wilkinson
ce99db1902 Port the build to Gradle
Closes gh-19609
Closes gh-19608
2020-01-10 14:15:35 +00:00
Stephane Nicoll
4d21efcc0a Remove outdated comment in smoke tests
Closes gh-17741
2019-08-01 10:36:08 +02:00
Phillip Webb
6675f49334 Switch to multi-line security configuration
Now that we have lambda style security configuration we can further
improve readability by switching to one statement per line.

See gh-17525
2019-07-29 11:28:51 +01:00
Madhura Bhave
39a7b9da38 Switch to lambda style security configuration
Closes gh-17525
2019-07-26 14:41:49 -07:00
Madhura Bhave
d9466f5659 Move smoke tests under spring-boot-test
See gh-17393
2019-07-02 15:55:58 -07:00