diff --git a/config/spring-authorization-server-config.gradle b/config/spring-security-config2.gradle similarity index 67% rename from config/spring-authorization-server-config.gradle rename to config/spring-security-config2.gradle index 3a88f2a..c7e94c0 100644 --- a/config/spring-authorization-server-config.gradle +++ b/config/spring-security-config2.gradle @@ -4,12 +4,15 @@ dependencies { compile 'org.springframework.security:spring-security-core' compile 'org.springframework.security:spring-security-config' compile springCoreDependency - compile project(':spring-authorization-server-core') + + optional project(':spring-security-oauth2-authorization-server') + optional project(path: ':spring-security-oauth2-authorization-server', configuration: 'tests') testCompile 'org.springframework.security:spring-security-test' testCompile 'junit:junit' testCompile 'org.assertj:assertj-core' testCompile 'org.mockito:mockito-core' + testCompile 'com.jayway.jsonpath:json-path' provided 'javax.servlet:javax.servlet-api' } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/oauth2/server/authorization/OAuth2AuthorizationServerConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerConfiguration.java similarity index 97% rename from config/src/main/java/org/springframework/security/config/annotation/web/configuration/oauth2/server/authorization/OAuth2AuthorizationServerConfiguration.java rename to config/src/main/java/org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerConfiguration.java index a2faabf..ca10cfa 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/oauth2/server/authorization/OAuth2AuthorizationServerConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerConfiguration.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.security.config.annotation.web.configuration.oauth2.server.authorization; +package org.springframework.security.config.annotation.web.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/oauth2/server/authorization/OAuth2AuthorizationServerSecurity.java b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerSecurity.java similarity index 91% rename from config/src/main/java/org/springframework/security/config/annotation/web/configuration/oauth2/server/authorization/OAuth2AuthorizationServerSecurity.java rename to config/src/main/java/org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerSecurity.java index 44392ae..102078f 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/oauth2/server/authorization/OAuth2AuthorizationServerSecurity.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerSecurity.java @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.security.config.annotation.web.configuration.oauth2.server.authorization; +package org.springframework.security.config.annotation.web.configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer; import static org.springframework.security.config.Customizer.withDefaults; diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationCodeGrantTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OAuth2AuthorizationCodeGrantTests.java similarity index 93% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationCodeGrantTests.java rename to config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OAuth2AuthorizationCodeGrantTests.java index 4c9b431..6207ad0 100644 --- a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationCodeGrantTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OAuth2AuthorizationCodeGrantTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.security.oauth2.server.authorization.web; +package org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization; import org.junit.Before; import org.junit.BeforeClass; @@ -24,7 +24,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.http.HttpHeaders; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.oauth2.server.authorization.OAuth2AuthorizationServerConfiguration; +import org.springframework.security.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration; import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.oauth2.core.AuthorizationGrantType; import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationResponseType; @@ -37,8 +37,11 @@ import org.springframework.security.oauth2.server.authorization.TokenType; import org.springframework.security.oauth2.server.authorization.client.RegisteredClient; import org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository; import org.springframework.security.oauth2.server.authorization.client.TestRegisteredClients; +import org.springframework.security.oauth2.server.authorization.web.OAuth2AuthorizationEndpointFilter; +import org.springframework.security.oauth2.server.authorization.web.OAuth2TokenEndpointFilter; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.util.StringUtils; @@ -59,7 +62,6 @@ import static org.mockito.Mockito.when; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -98,7 +100,7 @@ public class OAuth2AuthorizationCodeGrantTests { when(registeredClientRepository.findByClientId(eq(registeredClient.getClientId()))) .thenReturn(registeredClient); - MvcResult mvcResult = this.mvc.perform(get(OAuth2AuthorizationEndpointFilter.DEFAULT_AUTHORIZATION_ENDPOINT_URI) + MvcResult mvcResult = this.mvc.perform(MockMvcRequestBuilders.get(OAuth2AuthorizationEndpointFilter.DEFAULT_AUTHORIZATION_ENDPOINT_URI) .params(getAuthorizationRequestParameters(registeredClient))) .andExpect(status().is3xxRedirection()) .andReturn(); @@ -141,7 +143,7 @@ public class OAuth2AuthorizationCodeGrantTests { eq(TokenType.AUTHORIZATION_CODE))) .thenReturn(authorization); - this.mvc.perform(post(OAuth2TokenEndpointFilter.DEFAULT_TOKEN_ENDPOINT_URI) + this.mvc.perform(MockMvcRequestBuilders.post(OAuth2TokenEndpointFilter.DEFAULT_TOKEN_ENDPOINT_URI) .params(getTokenRequestParameters(registeredClient, authorization)) .header(HttpHeaders.AUTHORIZATION, "Basic " + encodeBasicAuth( registeredClient.getClientId(), registeredClient.getClientSecret())) diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientCredentialsGrantTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OAuth2ClientCredentialsGrantTests.java similarity index 92% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientCredentialsGrantTests.java rename to config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OAuth2ClientCredentialsGrantTests.java index 3cf938f..97d039a 100644 --- a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientCredentialsGrantTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OAuth2ClientCredentialsGrantTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.security.oauth2.server.authorization.web; +package org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization; import org.junit.Before; import org.junit.BeforeClass; @@ -24,7 +24,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.http.HttpHeaders; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.oauth2.server.authorization.OAuth2AuthorizationServerConfiguration; +import org.springframework.security.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration; import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.oauth2.core.AuthorizationGrantType; import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; @@ -32,7 +32,9 @@ import org.springframework.security.oauth2.server.authorization.OAuth2Authorizat import org.springframework.security.oauth2.server.authorization.client.RegisteredClient; import org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository; import org.springframework.security.oauth2.server.authorization.client.TestRegisteredClients; +import org.springframework.security.oauth2.server.authorization.web.OAuth2TokenEndpointFilter; import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; @@ -81,7 +83,7 @@ public class OAuth2ClientCredentialsGrantTests { public void requestWhenTokenRequestNotAuthenticatedThenUnauthorized() throws Exception { this.spring.register(AuthorizationServerConfiguration.class).autowire(); - this.mvc.perform(post(OAuth2TokenEndpointFilter.DEFAULT_TOKEN_ENDPOINT_URI) + this.mvc.perform(MockMvcRequestBuilders.post(OAuth2TokenEndpointFilter.DEFAULT_TOKEN_ENDPOINT_URI) .param(OAuth2ParameterNames.GRANT_TYPE, AuthorizationGrantType.CLIENT_CREDENTIALS.getValue()) .with(csrf())) .andExpect(status().isUnauthorized()); diff --git a/core/spring-security-core2.gradle b/core/spring-security-core2.gradle new file mode 100644 index 0000000..4b9572c --- /dev/null +++ b/core/spring-security-core2.gradle @@ -0,0 +1,14 @@ +apply plugin: 'io.spring.convention.spring-module' + +dependencies { + compile 'org.springframework.security:spring-security-core' + compile springCoreDependency + + testCompile 'junit:junit' + testCompile 'org.assertj:assertj-core' + testCompile 'org.mockito:mockito-core' +} + +jacoco { + toolVersion = '0.8.5' +} diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/Version.java b/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion2.java similarity index 92% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/Version.java rename to core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion2.java index 19d55ab..888be23 100644 --- a/core/src/main/java/org/springframework/security/oauth2/server/authorization/Version.java +++ b/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion2.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.security.oauth2.server.authorization; +package org.springframework.security.core; /** * Internal class used for serialization across Spring Security Authorization Server classes. @@ -21,7 +21,7 @@ package org.springframework.security.oauth2.server.authorization; * @author Anoop Garlapati * @since 0.0.1 */ -public final class Version { +public final class SpringSecurityCoreVersion2 { private static final int MAJOR = 0; private static final int MINOR = 0; private static final int PATCH = 1; diff --git a/core/spring-authorization-server-core.gradle b/oauth2-authorization-server/spring-security-oauth2-authorization-server.gradle similarity index 59% rename from core/spring-authorization-server-core.gradle rename to oauth2-authorization-server/spring-security-oauth2-authorization-server.gradle index 1d1df05..836253b 100644 --- a/core/spring-authorization-server-core.gradle +++ b/oauth2-authorization-server/spring-security-oauth2-authorization-server.gradle @@ -1,27 +1,17 @@ apply plugin: 'io.spring.convention.spring-module' dependencies { + compile project(':spring-security-core2') compile 'org.springframework.security:spring-security-core' compile 'org.springframework.security:spring-security-web' compile 'org.springframework.security:spring-security-oauth2-core' compile springCoreDependency - compile 'com.nimbusds:oauth2-oidc-sdk' compile 'com.fasterxml.jackson.core:jackson-databind' - optional 'com.nimbusds:nimbus-jose-jwt' - optional 'org.springframework.security:spring-security-oauth2-jose' - - testCompile project(path: ':spring-authorization-server-config', configuration: 'tests') testCompile 'org.springframework:spring-webmvc' testCompile 'junit:junit' testCompile 'org.assertj:assertj-core' testCompile 'org.mockito:mockito-core' - testCompile 'com.squareup.okhttp3:mockwebserver' - testCompile 'com.jayway.jsonpath:json-path' provided 'javax.servlet:javax.servlet-api' } - -jacoco { - toolVersion = '0.8.5' -} diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/InMemoryOAuth2AuthorizationService.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/InMemoryOAuth2AuthorizationService.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/InMemoryOAuth2AuthorizationService.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/InMemoryOAuth2AuthorizationService.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2Authorization.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2Authorization.java similarity index 96% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2Authorization.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2Authorization.java index bc05a07..0738d3f 100644 --- a/core/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2Authorization.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2Authorization.java @@ -15,6 +15,7 @@ */ package org.springframework.security.oauth2.server.authorization; +import org.springframework.security.core.SpringSecurityCoreVersion2; import org.springframework.security.oauth2.core.OAuth2AccessToken; import org.springframework.security.oauth2.server.authorization.client.RegisteredClient; import org.springframework.util.Assert; @@ -38,7 +39,7 @@ import java.util.function.Consumer; * @see OAuth2AccessToken */ public class OAuth2Authorization implements Serializable { - private static final long serialVersionUID = Version.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; private String registeredClientId; private String principalName; private OAuth2AccessToken accessToken; @@ -145,7 +146,7 @@ public class OAuth2Authorization implements Serializable { * A builder for {@link OAuth2Authorization}. */ public static class Builder implements Serializable { - private static final long serialVersionUID = Version.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; private String registeredClientId; private String principalName; private OAuth2AccessToken accessToken; diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationAttributeNames.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationAttributeNames.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationAttributeNames.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationAttributeNames.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationService.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationService.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationService.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationService.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/TokenType.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/TokenType.java similarity index 97% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/TokenType.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/TokenType.java index 19b8096..d975550 100644 --- a/core/src/main/java/org/springframework/security/oauth2/server/authorization/TokenType.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/TokenType.java @@ -15,7 +15,7 @@ */ package org.springframework.security.oauth2.server.authorization; -import org.springframework.security.core.SpringSecurityCoreVersion; +import org.springframework.security.core.SpringSecurityCoreVersion2; import org.springframework.util.Assert; import java.io.Serializable; @@ -24,7 +24,7 @@ import java.io.Serializable; * @author Joe Grandja */ public final class TokenType implements Serializable { - private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; public static final TokenType ACCESS_TOKEN = new TokenType("access_token"); public static final TokenType AUTHORIZATION_CODE = new TokenType("authorization_code"); private final String value; diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationToken.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationToken.java similarity index 94% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationToken.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationToken.java index 01b4eb3..dffe329 100644 --- a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationToken.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationToken.java @@ -17,8 +17,8 @@ package org.springframework.security.oauth2.server.authorization.authentication; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.Authentication; +import org.springframework.security.core.SpringSecurityCoreVersion2; import org.springframework.security.oauth2.core.OAuth2AccessToken; -import org.springframework.security.oauth2.server.authorization.Version; import org.springframework.security.oauth2.server.authorization.client.RegisteredClient; import org.springframework.util.Assert; @@ -37,7 +37,7 @@ import java.util.Collections; * @see OAuth2ClientAuthenticationToken */ public class OAuth2AccessTokenAuthenticationToken extends AbstractAuthenticationToken { - private static final long serialVersionUID = Version.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; private final RegisteredClient registeredClient; private final Authentication clientPrincipal; private final OAuth2AccessToken accessToken; diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationProvider.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationProvider.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationProvider.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationProvider.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationToken.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationToken.java similarity index 95% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationToken.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationToken.java index 28d2f2f..fab21e8 100644 --- a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationToken.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationToken.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.server.authorization.authentication; import org.springframework.lang.Nullable; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.Authentication; -import org.springframework.security.oauth2.server.authorization.Version; +import org.springframework.security.core.SpringSecurityCoreVersion2; import org.springframework.util.Assert; import java.util.Collections; @@ -34,7 +34,7 @@ import java.util.Collections; * @see OAuth2ClientAuthenticationToken */ public class OAuth2AuthorizationCodeAuthenticationToken extends AbstractAuthenticationToken { - private static final long serialVersionUID = Version.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; private String code; private Authentication clientPrincipal; private String clientId; diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationProvider.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationProvider.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationProvider.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationProvider.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationToken.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationToken.java similarity index 94% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationToken.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationToken.java index efcabf2..cc5ffa7 100644 --- a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationToken.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationToken.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.server.authorization.authentication; import org.springframework.lang.Nullable; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.Authentication; -import org.springframework.security.oauth2.server.authorization.Version; +import org.springframework.security.core.SpringSecurityCoreVersion2; import org.springframework.security.oauth2.server.authorization.client.RegisteredClient; import org.springframework.util.Assert; @@ -35,7 +35,7 @@ import java.util.Collections; * @see OAuth2ClientAuthenticationProvider */ public class OAuth2ClientAuthenticationToken extends AbstractAuthenticationToken { - private static final long serialVersionUID = Version.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; private String clientId; private String clientSecret; private RegisteredClient registeredClient; diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProvider.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProvider.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProvider.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProvider.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationToken.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationToken.java similarity index 94% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationToken.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationToken.java index 7b27ea2..d3a72d5 100644 --- a/core/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationToken.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationToken.java @@ -17,7 +17,7 @@ package org.springframework.security.oauth2.server.authorization.authentication; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.Authentication; -import org.springframework.security.oauth2.server.authorization.Version; +import org.springframework.security.core.SpringSecurityCoreVersion2; import org.springframework.util.Assert; import java.util.Collections; @@ -34,7 +34,7 @@ import java.util.Set; * @see OAuth2ClientAuthenticationToken */ public class OAuth2ClientCredentialsAuthenticationToken extends AbstractAuthenticationToken { - private static final long serialVersionUID = Version.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; private final Authentication clientPrincipal; private final Set scopes; diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/client/InMemoryRegisteredClientRepository.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/InMemoryRegisteredClientRepository.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/client/InMemoryRegisteredClientRepository.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/InMemoryRegisteredClientRepository.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClient.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClient.java similarity index 97% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClient.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClient.java index 2e289a5..b15d5dd 100644 --- a/core/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClient.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClient.java @@ -15,9 +15,9 @@ */ package org.springframework.security.oauth2.server.authorization.client; +import org.springframework.security.core.SpringSecurityCoreVersion2; import org.springframework.security.oauth2.core.AuthorizationGrantType; import org.springframework.security.oauth2.core.ClientAuthenticationMethod; -import org.springframework.security.oauth2.server.authorization.Version; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; @@ -38,7 +38,7 @@ import java.util.function.Consumer; * @since 0.0.1 */ public class RegisteredClient implements Serializable { - private static final long serialVersionUID = Version.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; private String id; private String clientId; private String clientSecret; @@ -152,7 +152,7 @@ public class RegisteredClient implements Serializable { * A builder for {@link RegisteredClient}. */ public static class Builder implements Serializable { - private static final long serialVersionUID = Version.SERIAL_VERSION_UID; + private static final long serialVersionUID = SpringSecurityCoreVersion2.SERIAL_VERSION_UID; private String id; private String clientId; private String clientSecret; diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClientRepository.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClientRepository.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClientRepository.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClientRepository.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/web/ClientSecretBasicAuthenticationConverter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/ClientSecretBasicAuthenticationConverter.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/web/ClientSecretBasicAuthenticationConverter.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/ClientSecretBasicAuthenticationConverter.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/web/DelegatingAuthorizationGrantAuthenticationConverter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/DelegatingAuthorizationGrantAuthenticationConverter.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/web/DelegatingAuthorizationGrantAuthenticationConverter.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/DelegatingAuthorizationGrantAuthenticationConverter.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilter.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilter.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilter.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilter.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilter.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilter.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2EndpointUtils.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2EndpointUtils.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2EndpointUtils.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2EndpointUtils.java diff --git a/core/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilter.java similarity index 100% rename from core/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilter.java rename to oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilter.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/InMemoryOAuth2AuthorizationServiceTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/InMemoryOAuth2AuthorizationServiceTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/InMemoryOAuth2AuthorizationServiceTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/InMemoryOAuth2AuthorizationServiceTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/TestOAuth2Authorizations.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/TestOAuth2Authorizations.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/TestOAuth2Authorizations.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/TestOAuth2Authorizations.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationTokenTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationTokenTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationTokenTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AccessTokenAuthenticationTokenTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationProviderTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationProviderTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationProviderTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationProviderTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationTokenTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationTokenTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationTokenTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeAuthenticationTokenTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationProviderTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationProviderTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationProviderTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationProviderTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationTokenTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationTokenTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationTokenTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientAuthenticationTokenTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProviderTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProviderTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProviderTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProviderTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationTokenTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationTokenTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationTokenTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationTokenTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/client/InMemoryRegisteredClientRepositoryTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/InMemoryRegisteredClientRepositoryTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/client/InMemoryRegisteredClientRepositoryTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/InMemoryRegisteredClientRepositoryTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClientTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClientTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClientTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClientTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/client/TestRegisteredClients.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/TestRegisteredClients.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/client/TestRegisteredClients.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/client/TestRegisteredClients.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/ClientSecretBasicAuthenticationConverterTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/ClientSecretBasicAuthenticationConverterTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/web/ClientSecretBasicAuthenticationConverterTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/ClientSecretBasicAuthenticationConverterTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/DelegatingAuthorizationGrantAuthenticationConverterTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/DelegatingAuthorizationGrantAuthenticationConverterTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/web/DelegatingAuthorizationGrantAuthenticationConverterTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/DelegatingAuthorizationGrantAuthenticationConverterTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilterTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilterTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilterTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilterTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilterTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilterTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilterTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilterTests.java diff --git a/core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilterTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilterTests.java similarity index 100% rename from core/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilterTests.java rename to oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilterTests.java diff --git a/samples/boot/minimal/spring-authorization-server-samples-boot-minimal.gradle b/samples/boot/minimal/spring-security-samples2-boot-minimal.gradle similarity index 85% rename from samples/boot/minimal/spring-authorization-server-samples-boot-minimal.gradle rename to samples/boot/minimal/spring-security-samples2-boot-minimal.gradle index e1cface..620835a 100644 --- a/samples/boot/minimal/spring-authorization-server-samples-boot-minimal.gradle +++ b/samples/boot/minimal/spring-security-samples2-boot-minimal.gradle @@ -3,8 +3,8 @@ apply plugin: 'io.spring.convention.spring-sample-boot' dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-security' + implementation project(':spring-security-oauth2-authorization-server') implementation 'com.nimbusds:oauth2-oidc-sdk' - implementation project(':spring-authorization-server-core') testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' diff --git a/samples/boot/oauth2resourceserver/spring-authorization-server-samples-boot-oauth2resourceserver.gradle b/samples/boot/oauth2resourceserver/spring-security-samples2-boot-oauth2resourceserver.gradle similarity index 100% rename from samples/boot/oauth2resourceserver/spring-authorization-server-samples-boot-oauth2resourceserver.gradle rename to samples/boot/oauth2resourceserver/spring-security-samples2-boot-oauth2resourceserver.gradle