Skip to content

Commit d04f707

Browse files
committed
Add Missing Serialization Samples
Closes gh-17038
1 parent 8726e54 commit d04f707

5 files changed

+13
-1
lines changed

config/src/test/java/org/springframework/security/SpringSecurityCoreVersionSerializableTests.java

+13
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@
139139
import org.springframework.security.oauth2.client.authentication.OAuth2LoginAuthenticationToken;
140140
import org.springframework.security.oauth2.client.authentication.TestOAuth2AuthenticationTokens;
141141
import org.springframework.security.oauth2.client.authentication.TestOAuth2AuthorizationCodeAuthenticationTokens;
142+
import org.springframework.security.oauth2.client.event.OAuth2AuthorizedClientRefreshedEvent;
143+
import org.springframework.security.oauth2.client.oidc.authentication.event.OidcUserRefreshedEvent;
142144
import org.springframework.security.oauth2.client.oidc.authentication.logout.OidcLogoutToken;
143145
import org.springframework.security.oauth2.client.oidc.authentication.logout.TestOidcLogoutTokens;
144146
import org.springframework.security.oauth2.client.oidc.session.OidcSessionInformation;
@@ -160,6 +162,7 @@
160162
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationExchange;
161163
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;
162164
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationResponse;
165+
import org.springframework.security.oauth2.core.endpoint.TestOAuth2AccessTokenResponses;
163166
import org.springframework.security.oauth2.core.endpoint.TestOAuth2AuthorizationExchanges;
164167
import org.springframework.security.oauth2.core.endpoint.TestOAuth2AuthorizationRequests;
165168
import org.springframework.security.oauth2.core.endpoint.TestOAuth2AuthorizationResponses;
@@ -184,6 +187,7 @@
184187
import org.springframework.security.oauth2.server.resource.InvalidBearerTokenException;
185188
import org.springframework.security.oauth2.server.resource.authentication.BearerTokenAuthentication;
186189
import org.springframework.security.oauth2.server.resource.authentication.BearerTokenAuthenticationToken;
190+
import org.springframework.security.oauth2.server.resource.authentication.DPoPAuthenticationToken;
187191
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
188192
import org.springframework.security.oauth2.server.resource.introspection.BadOpaqueTokenException;
189193
import org.springframework.security.oauth2.server.resource.introspection.OAuth2IntrospectionAuthenticatedPrincipal;
@@ -364,6 +368,13 @@ class SpringSecurityCoreVersionSerializableTests {
364368
new RuntimeException()));
365369
generatorByClassName.put(ClientAuthorizationRequiredException.class,
366370
(r) -> new ClientAuthorizationRequiredException("id"));
371+
generatorByClassName
372+
.put(OAuth2AuthorizedClientRefreshedEvent.class, (r) -> new OAuth2AuthorizedClientRefreshedEvent(
373+
TestOAuth2AccessTokenResponses.accessTokenResponse().build(),
374+
new OAuth2AuthorizedClient(clientRegistration, "principal", TestOAuth2AccessTokens.noScopes())));
375+
generatorByClassName.put(OidcUserRefreshedEvent.class,
376+
(r) -> new OidcUserRefreshedEvent(TestOAuth2AccessTokenResponses.accessTokenResponse().build(),
377+
TestOidcUsers.create(), TestOidcUsers.create(), authentication));
367378

368379
// oauth2-jose
369380
generatorByClassName.put(BadJwtException.class, (r) -> new BadJwtException("token", new RuntimeException()));
@@ -411,6 +422,8 @@ class SpringSecurityCoreVersionSerializableTests {
411422
(r) -> new BadOpaqueTokenException("message", new RuntimeException()));
412423
generatorByClassName.put(OAuth2IntrospectionException.class,
413424
(r) -> new OAuth2IntrospectionException("message", new RuntimeException()));
425+
generatorByClassName.put(DPoPAuthenticationToken.class,
426+
(r) -> applyDetails(new DPoPAuthenticationToken("token", "proof", "method", "uri")));
414427

415428
// config
416429
generatorByClassName.put(AlreadyBuiltException.class, (r) -> new AlreadyBuiltException("message"));

core/src/main/java/org/springframework/security/authorization/event/AuthorizationGrantedEvent.java

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
* @author Josh Cummings
3434
* @since 5.7
3535
*/
36-
@SuppressWarnings("serial")
3736
public class AuthorizationGrantedEvent<T> extends AuthorizationEvent implements ResolvableTypeProvider {
3837

3938
@Serial

0 commit comments

Comments
 (0)