Skip to content

Commit 274f165

Browse files
authored
Merge branch 'spring-projects:main' into patch-1
2 parents 3c56899 + 97923eb commit 274f165

File tree

9 files changed

+44
-89
lines changed

9 files changed

+44
-89
lines changed

.github/workflows/codeql.yml

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,13 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
121
name: "CodeQL Advanced"
132

143
on:
15-
push: # run if we update the workflow
4+
push:
5+
pull_request:
166
workflow_dispatch:
177
schedule:
18-
- cron: '39 13 * * 4'
8+
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
9+
- cron: '0 5 * * *'
1910

2011
jobs:
21-
analyze:
22-
name: Analyze (${{ matrix.language }})
23-
# Runner size impacts CodeQL analysis time. To learn more, please see:
24-
# - https://gh.io/recommended-hardware-resources-for-running-codeql
25-
# - https://gh.io/supported-runners-and-hardware-resources
26-
# - https://gh.io/using-larger-runners (github.com only)
27-
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
28-
runs-on: ubuntu-latest
29-
permissions:
30-
# required for all workflows
31-
security-events: write
32-
33-
# required to fetch internal or private CodeQL packs
34-
packages: read
35-
36-
# only required for workflows in private repositories
37-
actions: read
38-
contents: read
39-
40-
strategy:
41-
fail-fast: false
42-
matrix:
43-
include:
44-
- language: actions
45-
build-mode: none
46-
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
47-
# Use `c-cpp` to analyze code written in C, C++ or both
48-
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
49-
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
50-
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
51-
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
52-
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
53-
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
54-
steps:
55-
- name: Checkout repository
56-
uses: actions/checkout@v4
57-
58-
# Add any setup steps before running the `github/codeql-action/init` action.
59-
# This includes steps like installing compilers or runtimes (`actions/setup-node`
60-
# or others). This is typically only required for manual builds.
61-
# - name: Setup runtime (example)
62-
# uses: actions/setup-example@v1
63-
64-
# Initializes the CodeQL tools for scanning.
65-
- name: Initialize CodeQL
66-
uses: github/codeql-action/init@v3
67-
with:
68-
languages: ${{ matrix.language }}
69-
build-mode: ${{ matrix.build-mode }}
70-
# If you wish to specify custom queries, you can do so here or in a config file.
71-
# By default, queries listed here will override any specified in a config file.
72-
# Prefix the list here with "+" to use these queries and those in the config file.
73-
74-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
75-
queries: security-extended,security-and-quality
76-
77-
- name: Perform CodeQL Analysis
78-
uses: github/codeql-action/analyze@v3
79-
with:
80-
category: "/language:${{matrix.language}}"
12+
codeql-analysis-call:
13+
uses: spring-io/github-actions/.github/workflows/codeql-analysis.yml@1

aspects/src/test/java/org/springframework/security/authorization/method/aspectj/PreAuthorizeAspectTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -144,7 +144,7 @@ private void privateMethod() {
144144
protected void protectedMethod() {
145145
}
146146

147-
@PreAuthorize("hasRole('X')")
147+
@PreAuthorize("hasRole('A')")
148148
void publicCallsPrivate() {
149149
privateMethod();
150150
}

config/src/main/java/org/springframework/security/config/web/server/OidcBackChannelLogoutWebFilter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,12 +18,12 @@
1818

1919
import java.util.Collections;
2020

21-
import jakarta.servlet.http.HttpServletResponse;
2221
import org.apache.commons.logging.Log;
2322
import org.apache.commons.logging.LogFactory;
2423
import reactor.core.publisher.Mono;
2524

2625
import org.springframework.core.ResolvableType;
26+
import org.springframework.http.HttpStatus;
2727
import org.springframework.http.MediaType;
2828
import org.springframework.http.codec.EncoderHttpMessageWriter;
2929
import org.springframework.http.codec.HttpMessageWriter;
@@ -47,6 +47,7 @@
4747
* A filter for the Client-side OIDC Back-Channel Logout endpoint
4848
*
4949
* @author Josh Cummings
50+
* @author Andrey Litvitski
5051
* @since 6.2
5152
* @see <a target="_blank" href=
5253
* "https://openid.net/specs/openid-connect-backchannel-1_0.html">OIDC Back-Channel Logout
@@ -108,7 +109,7 @@ public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
108109

109110
private Mono<Void> handleAuthenticationFailure(ServerWebExchange exchange, Exception ex) {
110111
this.logger.debug("Failed to process OIDC Back-Channel Logout", ex);
111-
exchange.getResponse().setRawStatusCode(HttpServletResponse.SC_BAD_REQUEST);
112+
exchange.getResponse().setRawStatusCode(HttpStatus.BAD_REQUEST.value());
112113
return this.errorHttpMessageConverter.write(Mono.just(oauth2Error(ex)), ResolvableType.forClass(Object.class),
113114
ResolvableType.forClass(Object.class), MediaType.APPLICATION_JSON, exchange.getRequest(),
114115
exchange.getResponse(), Collections.emptyMap());

config/src/main/java/org/springframework/security/config/web/server/OidcBackChannelServerLogoutHandler.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,13 +22,13 @@
2222
import java.util.Map;
2323
import java.util.concurrent.atomic.AtomicInteger;
2424

25-
import jakarta.servlet.http.HttpServletResponse;
2625
import org.apache.commons.logging.Log;
2726
import org.apache.commons.logging.LogFactory;
2827
import reactor.core.publisher.Mono;
2928

3029
import org.springframework.core.ResolvableType;
3130
import org.springframework.http.HttpHeaders;
31+
import org.springframework.http.HttpStatus;
3232
import org.springframework.http.MediaType;
3333
import org.springframework.http.ResponseEntity;
3434
import org.springframework.http.codec.EncoderHttpMessageWriter;
@@ -54,7 +54,8 @@
5454
* Back-Channel Logout Token and invalidates each one.
5555
*
5656
* @author Josh Cummings
57-
* @since 6.4
57+
* @author Andrey Litvitski
58+
* @since 6.2
5859
* @see <a target="_blank" href=
5960
* "https://openid.net/specs/openid-connect-backchannel-1_0.html">OIDC Back-Channel Logout
6061
* Spec</a>
@@ -170,7 +171,7 @@ private OAuth2Error oauth2Error(Collection<?> errors) {
170171
}
171172

172173
private Mono<Void> handleLogoutFailure(ServerWebExchange exchange, OAuth2Error error) {
173-
exchange.getResponse().setRawStatusCode(HttpServletResponse.SC_BAD_REQUEST);
174+
exchange.getResponse().setRawStatusCode(HttpStatus.BAD_REQUEST.value());
174175
return this.errorHttpMessageConverter.write(Mono.just(error), ResolvableType.forClass(Object.class),
175176
ResolvableType.forClass(Object.class), MediaType.APPLICATION_JSON, exchange.getRequest(),
176177
exchange.getResponse(), Collections.emptyMap());

core/src/main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -267,7 +267,7 @@ private List<MergedAnnotation<A>> findDirectAnnotations(AnnotatedElement element
267267

268268
private static Method findMethod(Method method, Class<?> targetClass) {
269269
for (Method candidate : targetClass.getDeclaredMethods()) {
270-
if (candidate == method) {
270+
if (candidate.equals(method)) {
271271
return candidate;
272272
}
273273
if (isOverride(method, candidate)) {

docs/modules/ROOT/pages/servlet/authentication/session-management.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,13 @@ public class MaximumSessionsPreventLoginTests {
589589
If you are using a customized authentication filter for form-based login, then you have to configure concurrent session control support explicitly.
590590
You can try it using the {gh-samples-url}/servlet/spring-boot/java/session-management/maximum-sessions-prevent-login[Maximum Sessions Prevent Login sample].
591591

592+
[NOTE]
593+
=====
594+
If you are using a custom implementation of `UserDetails`, ensure you override the **equals()** and **hashCode()** methods.
595+
The default `SessionRegistry` implementation in Spring Security relies on an in-memory Map that uses these methods to correctly identify and manage user sessions.
596+
Failing to override them may lead to issues where session tracking and user comparison behave unexpectedly.
597+
=====
598+
592599
== Detecting Timeouts
593600

594601
Sessions expire on their own, and there is nothing that needs to be done to ensure that a security context gets removed.

gradle.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
<<<<<<< HEAD
1617
springBootVersion=4.0.0-SNAPSHOT
1718
version=7.0.0-SNAPSHOT
19+
=======
20+
springBootVersion=3.3.3
21+
<<<<<<< HEAD
22+
version=6.5.1-SNAPSHOT
23+
=======
24+
version=6.4.7-SNAPSHOT
25+
>>>>>>> origin/6.4.x
26+
>>>>>>> 6.5.x
1827
samplesBranch=main
1928
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError
2029
org.gradle.parallel=true

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
22
com-squareup-okhttp3 = "3.14.9"
33
io-rsocket = "1.1.5"
4-
io-spring-javaformat = "0.0.43"
4+
io-spring-javaformat = "0.0.45"
55
io-spring-nohttp = "0.0.11"
66
jakarta-websocket = "2.2.0"
77
org-apache-directory-server = "1.5.5"
@@ -71,7 +71,7 @@ org-bouncycastle-bcprov-jdk15on = { module = "org.bouncycastle:bcprov-jdk18on",
7171
org-eclipse-jetty-jetty-server = { module = "org.eclipse.jetty:jetty-server", version.ref = "org-eclipse-jetty" }
7272
org-eclipse-jetty-jetty-servlet = { module = "org.eclipse.jetty:jetty-servlet", version.ref = "org-eclipse-jetty" }
7373
org-hamcrest = "org.hamcrest:hamcrest:2.2"
74-
org-hibernate-orm-hibernate-core = "org.hibernate.orm:hibernate-core:7.0.0.CR2"
74+
org-hibernate-orm-hibernate-core = "org.hibernate.orm:hibernate-core:7.0.0.Final"
7575
org-hsqldb = "org.hsqldb:hsqldb:2.7.4"
7676
org-jetbrains-kotlin-kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "org-jetbrains-kotlin" }
7777
org-jetbrains-kotlin-kotlin-gradle-plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25"

web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -79,6 +79,10 @@
7979
* raised by the <tt>AuthenticationManager</tt> will the be re-thrown. Note that this will
8080
* not affect cases where the principal returned by {@link #getPreAuthenticatedPrincipal}
8181
* is null, when the chain will still proceed as normal.
82+
* <p>
83+
* The filter saves the {@link SecurityContext} using the configured
84+
* {@link SecurityContextRepository}, which can be set via
85+
* {@link #setSecurityContextRepository}.
8286
*
8387
* @author Luke Taylor
8488
* @author Ruud Senden
@@ -253,8 +257,8 @@ public void setApplicationEventPublisher(ApplicationEventPublisher anApplication
253257

254258
/**
255259
* Sets the {@link SecurityContextRepository} to save the {@link SecurityContext} on
256-
* authentication success. The default action is not to save the
257-
* {@link SecurityContext}.
260+
* authentication success. The default action is to save the {@link SecurityContext}
261+
* in {@link HttpSession} using {@link HttpSessionSecurityContextRepository}.
258262
* @param securityContextRepository the {@link SecurityContextRepository} to use.
259263
* Cannot be null.
260264
*/

0 commit comments

Comments
 (0)