|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright 2002-2017 the original author or authors.
|
|
|
+ * Copyright 2002-2024 the original author or authors.
|
|
|
*
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -16,6 +16,10 @@
|
|
|
|
|
|
package org.springframework.security.oauth2.core.endpoint;
|
|
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.ObjectOutputStream;
|
|
|
+
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
@@ -50,4 +54,15 @@ public class OAuth2AuthorizationExchangeTests {
|
|
|
assertThat(authorizationExchange.getAuthorizationResponse()).isEqualTo(authorizationResponse);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void oauth2AuthorizationExchangeShouldBeSerializable() throws IOException {
|
|
|
+ OAuth2AuthorizationExchange exchange = TestOAuth2AuthorizationExchanges.success();
|
|
|
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
+ ObjectOutputStream objectOutputStream = new ObjectOutputStream(baos)) {
|
|
|
+ objectOutputStream.writeObject(exchange);
|
|
|
+ objectOutputStream.flush();
|
|
|
+ assertThat(baos.size()).isNotZero();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|