├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .mvn ├── jvm.config ├── maven.config └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .travis.yml ├── CODE_OF_CONDUCT.adoc ├── README.md ├── docker-compose.yml ├── etc └── nohttp │ ├── checkstyle.xml │ └── whitelist.lines ├── license.txt ├── mvnw ├── mvnw.cmd ├── notice.txt ├── pom.xml ├── samples ├── README.md ├── oauth │ ├── sparklr │ │ ├── ant-macros.xml │ │ ├── build.xml │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── security │ │ │ │ └── oauth │ │ │ │ └── examples │ │ │ │ └── sparklr │ │ │ │ ├── PhotoInfo.java │ │ │ │ ├── PhotoService.java │ │ │ │ ├── impl │ │ │ │ └── PhotoServiceImpl.java │ │ │ │ ├── mvc │ │ │ │ ├── AccessConfirmationController.java │ │ │ │ └── PhotoController.java │ │ │ │ └── oauth │ │ │ │ └── SparklrConsumerDetails.java │ │ │ ├── resources │ │ │ ├── commons-logging.properties │ │ │ ├── org │ │ │ │ └── springframework │ │ │ │ │ └── security │ │ │ │ │ └── oauth │ │ │ │ │ └── examples │ │ │ │ │ └── sparklr │ │ │ │ │ ├── certs │ │ │ │ │ └── igoogle.cert │ │ │ │ │ └── impl │ │ │ │ │ └── resources │ │ │ │ │ ├── photo1.jpg │ │ │ │ │ ├── photo2.jpg │ │ │ │ │ ├── photo3.jpg │ │ │ │ │ ├── photo4.jpg │ │ │ │ │ ├── photo5.jpg │ │ │ │ │ └── photo6.jpg │ │ │ └── simplelog.properties │ │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ ├── appengine-web.xml │ │ │ ├── applicationContext.xml │ │ │ ├── jsp │ │ │ │ └── access_confirmation.jsp │ │ │ ├── spring-servlet.xml │ │ │ └── web.xml │ │ │ ├── images │ │ │ ├── bg.gif │ │ │ └── header.jpg │ │ │ ├── index.jsp │ │ │ ├── login.jsp │ │ │ ├── request_token_authorized.jsp │ │ │ ├── sparklr_gadget.xml │ │ │ └── style.css │ └── tonr │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── security │ │ │ └── oauth │ │ │ └── examples │ │ │ └── tonr │ │ │ ├── GoogleService.java │ │ │ ├── SparklrException.java │ │ │ ├── SparklrService.java │ │ │ ├── impl │ │ │ ├── GoogleServiceImpl.java │ │ │ └── SparklrServiceImpl.java │ │ │ └── mvc │ │ │ ├── PicasaController.java │ │ │ └── SparklrController.java │ │ ├── resources │ │ ├── commons-logging.properties │ │ ├── example_picasa_feed.xml │ │ └── simplelog.properties │ │ └── webapp │ │ ├── WEB-INF │ │ ├── applicationContext.xml │ │ ├── jsp │ │ │ ├── picasa.jsp │ │ │ └── sparklr.jsp │ │ ├── sparklr.properties │ │ ├── spring-servlet.xml │ │ └── web.xml │ │ ├── images │ │ ├── bg.gif │ │ ├── header.jpg │ │ └── xbg.gif │ │ ├── index.jsp │ │ ├── login.jsp │ │ ├── main.css │ │ ├── oauth_error.jsp │ │ ├── style.css │ │ └── template.html ├── oauth2 │ ├── sparklr │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── org │ │ │ │ │ └── springframework │ │ │ │ │ └── security │ │ │ │ │ └── oauth │ │ │ │ │ └── examples │ │ │ │ │ └── sparklr │ │ │ │ │ ├── PhotoInfo.java │ │ │ │ │ ├── PhotoService.java │ │ │ │ │ ├── PhotoServiceUser.java │ │ │ │ │ ├── config │ │ │ │ │ ├── MethodSecurityConfig.java │ │ │ │ │ ├── OAuth2ServerConfig.java │ │ │ │ │ ├── SecurityConfiguration.java │ │ │ │ │ ├── ServletInitializer.java │ │ │ │ │ └── WebMvcConfig.java │ │ │ │ │ ├── impl │ │ │ │ │ └── PhotoServiceImpl.java │ │ │ │ │ ├── mvc │ │ │ │ │ ├── AccessConfirmationController.java │ │ │ │ │ ├── AdminController.java │ │ │ │ │ ├── PhotoController.java │ │ │ │ │ └── PhotoServiceUserController.java │ │ │ │ │ └── oauth │ │ │ │ │ └── SparklrUserApprovalHandler.java │ │ │ ├── resources │ │ │ │ ├── commons-logging.properties │ │ │ │ ├── org │ │ │ │ │ └── springframework │ │ │ │ │ │ └── security │ │ │ │ │ │ └── oauth │ │ │ │ │ │ └── examples │ │ │ │ │ │ └── sparklr │ │ │ │ │ │ └── impl │ │ │ │ │ │ └── resources │ │ │ │ │ │ ├── photo1.jpg │ │ │ │ │ │ ├── photo2.jpg │ │ │ │ │ │ ├── photo3.jpg │ │ │ │ │ │ ├── photo4.jpg │ │ │ │ │ │ ├── photo5.jpg │ │ │ │ │ │ └── photo6.jpg │ │ │ │ └── simplelog.properties │ │ │ └── webapp │ │ │ │ ├── WEB-INF │ │ │ │ └── jsp │ │ │ │ │ ├── access_confirmation.jsp │ │ │ │ │ └── oauth_error.jsp │ │ │ │ ├── browse.html │ │ │ │ ├── index.jsp │ │ │ │ └── login.jsp │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── springframework │ │ │ └── security │ │ │ ├── oauth2 │ │ │ └── provider │ │ │ │ ├── AdminEndpointsTests.java │ │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ │ ├── ImplicitProviderTests.java │ │ │ │ ├── RefreshTokenSupportTests.java │ │ │ │ ├── ResourceOwnerPasswordProviderTests.java │ │ │ │ └── ServerRunning.java │ │ │ └── samples │ │ │ └── config │ │ │ └── ApplicationConfigurationTests.java │ └── tonr │ │ ├── .springBeans │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── security │ │ │ │ └── oauth │ │ │ │ └── examples │ │ │ │ ├── config │ │ │ │ ├── SecurityConfig.java │ │ │ │ ├── ServletInitializer.java │ │ │ │ └── WebMvcConfig.java │ │ │ │ └── tonr │ │ │ │ ├── SparklrException.java │ │ │ │ ├── SparklrService.java │ │ │ │ ├── converter │ │ │ │ └── AccessTokenRequestConverter.java │ │ │ │ ├── impl │ │ │ │ └── SparklrServiceImpl.java │ │ │ │ └── mvc │ │ │ │ ├── FacebookController.java │ │ │ │ ├── SparklrController.java │ │ │ │ └── SparklrRedirectController.java │ │ ├── resources │ │ │ ├── commons-logging.properties │ │ │ ├── simplelog.properties │ │ │ └── sparklr.properties │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── jsp │ │ │ │ ├── facebook.jsp │ │ │ │ └── sparklr.jsp │ │ │ ├── demo.html │ │ │ ├── index.jsp │ │ │ ├── js │ │ │ └── libs │ │ │ │ └── jso.js │ │ │ ├── login.jsp │ │ │ └── oauth_error.jsp │ │ └── test │ │ └── java │ │ └── org │ │ └── springframework │ │ └── security │ │ ├── oauth │ │ └── examples │ │ │ └── tonr │ │ │ ├── AuthorizationCodeGrantTests.java │ │ │ ├── ClientCredentialsGrantTests.java │ │ │ ├── RefreshTokenGrantTests.java │ │ │ ├── ResourceOwnerPasswordGrantTests.java │ │ │ └── ServerRunning.java │ │ └── samples │ │ └── config │ │ ├── AdHocTests.java │ │ └── SecurityConfigTests.java └── pom.xml ├── spring-eclipse-code-conventions.xml ├── spring-intellij-code-style.xml ├── spring-security-jwt ├── .mvn │ ├── jvm.config │ ├── maven.config │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── springframework │ │ └── security │ │ └── jwt │ │ ├── AlgorithmMetadata.java │ │ ├── BinaryFormat.java │ │ ├── Jwt.java │ │ ├── JwtAlgorithms.java │ │ ├── JwtHelper.java │ │ ├── codec │ │ ├── Base64Codec.java │ │ └── Codecs.java │ │ └── crypto │ │ ├── cipher │ │ └── CipherMetadata.java │ │ └── sign │ │ ├── EllipticCurveKeyHelper.java │ │ ├── EllipticCurveSignatureHelper.java │ │ ├── EllipticCurveVerifier.java │ │ ├── InvalidSignatureException.java │ │ ├── MacSigner.java │ │ ├── RsaKeyHelper.java │ │ ├── RsaSigner.java │ │ ├── RsaVerifier.java │ │ ├── SignatureVerifier.java │ │ ├── Signer.java │ │ └── SignerVerifier.java │ └── test │ └── java │ └── org │ └── springframework │ └── security │ └── jwt │ ├── JwtSpecData.java │ ├── JwtTests.java │ ├── RubyJwtIntegrationTests.java │ └── crypto │ ├── cipher │ └── RsaTestKeyData.java │ └── sign │ ├── EllipticCurveVerifierTests.java │ └── RsaSigningTests.java ├── spring-security-oauth ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── security │ │ │ └── oauth │ │ │ ├── common │ │ │ ├── OAuthCodec.java │ │ │ ├── OAuthConsumerParameter.java │ │ │ ├── OAuthException.java │ │ │ ├── OAuthProviderParameter.java │ │ │ ├── StringSplitUtils.java │ │ │ └── signature │ │ │ │ ├── CoreOAuthSignatureMethodFactory.java │ │ │ │ ├── HMAC_SHA1SignatureMethod.java │ │ │ │ ├── InvalidSignatureException.java │ │ │ │ ├── OAuthSignatureMethod.java │ │ │ │ ├── OAuthSignatureMethodFactory.java │ │ │ │ ├── PlainTextSignatureMethod.java │ │ │ │ ├── RSAKeySecret.java │ │ │ │ ├── RSA_SHA1SignatureMethod.java │ │ │ │ ├── SaltedConsumerSecret.java │ │ │ │ ├── SharedConsumerSecret.java │ │ │ │ ├── SharedConsumerSecretImpl.java │ │ │ │ ├── SignatureSecret.java │ │ │ │ ├── SignatureSecretEditor.java │ │ │ │ └── UnsupportedSignatureMethodException.java │ │ │ ├── config │ │ │ ├── ConfigUtils.java │ │ │ ├── ConsumerDetailsFactoryBean.java │ │ │ ├── ConsumerServiceBeanDefinitionParser.java │ │ │ ├── ExpressionHandlerBeanDefinitionParser.java │ │ │ ├── OAuthConsumerBeanDefinitionParser.java │ │ │ ├── OAuthProviderBeanDefinitionParser.java │ │ │ ├── OAuthSecurityNamespaceHandler.java │ │ │ ├── ProtectedResourceDetailsBeanDefinitionParser.java │ │ │ ├── ProtectedResourceDetailsServiceFactoryBean.java │ │ │ ├── TokenServiceBeanDefinitionParser.java │ │ │ └── VerifierServiceBeanDefinitionParser.java │ │ │ ├── consumer │ │ │ ├── AccessTokenRequiredException.java │ │ │ ├── BaseProtectedResourceDetails.java │ │ │ ├── InMemoryProtectedResourceDetailsService.java │ │ │ ├── InvalidOAuthRealmException.java │ │ │ ├── OAuthConsumerSupport.java │ │ │ ├── OAuthConsumerToken.java │ │ │ ├── OAuthRequestFailedException.java │ │ │ ├── OAuthSecurityContext.java │ │ │ ├── OAuthSecurityContextHolder.java │ │ │ ├── OAuthSecurityContextImpl.java │ │ │ ├── ProtectedResourceDetails.java │ │ │ ├── ProtectedResourceDetailsService.java │ │ │ ├── UnverifiedRequestTokenException.java │ │ │ ├── client │ │ │ │ ├── CoreOAuthConsumerSupport.java │ │ │ │ ├── OAuthClientHttpRequestFactory.java │ │ │ │ └── OAuthRestTemplate.java │ │ │ ├── filter │ │ │ │ ├── OAuthConsumerContextFilter.java │ │ │ │ └── OAuthConsumerProcessingFilter.java │ │ │ ├── net │ │ │ │ ├── DefaultOAuthURLStreamHandlerFactory.java │ │ │ │ ├── OAuthOverHttpURLStreamHandler.java │ │ │ │ ├── OAuthOverHttpsURLStreamHandler.java │ │ │ │ └── OAuthURLStreamHandlerFactory.java │ │ │ ├── nonce │ │ │ │ ├── NonceFactory.java │ │ │ │ └── UUIDNonceFactory.java │ │ │ ├── rememberme │ │ │ │ ├── HttpSessionOAuthRememberMeServices.java │ │ │ │ ├── NoOpOAuthRememberMeServices.java │ │ │ │ └── OAuthRememberMeServices.java │ │ │ └── token │ │ │ │ ├── HttpSessionBasedTokenServices.java │ │ │ │ └── OAuthConsumerTokenServices.java │ │ │ └── provider │ │ │ ├── BaseConsumerDetails.java │ │ │ ├── ConsumerAuthentication.java │ │ │ ├── ConsumerCredentials.java │ │ │ ├── ConsumerDetails.java │ │ │ ├── ConsumerDetailsService.java │ │ │ ├── DefaultAuthenticationHandler.java │ │ │ ├── ExtraTrustConsumerDetails.java │ │ │ ├── InMemoryConsumerDetailsService.java │ │ │ ├── InvalidOAuthParametersException.java │ │ │ ├── OAuthAuthenticationDetails.java │ │ │ ├── OAuthAuthenticationHandler.java │ │ │ ├── OAuthProcessingFilterEntryPoint.java │ │ │ ├── OAuthProviderSupport.java │ │ │ ├── OAuthVersionUnsupportedException.java │ │ │ ├── ResourceSpecificConsumerDetails.java │ │ │ ├── attributes │ │ │ ├── ConsumerKeysAllowed.java │ │ │ ├── ConsumerRolesAllowed.java │ │ │ ├── ConsumerSecurityConfig.java │ │ │ ├── ConsumerSecurityMetadataSource.java │ │ │ ├── ConsumerSecurityVoter.java │ │ │ ├── DenyAllConsumers.java │ │ │ └── PermitAllConsumers.java │ │ │ ├── expression │ │ │ └── OAuthMethodSecurityExpressionHandler.java │ │ │ ├── filter │ │ │ ├── AccessTokenProcessingFilter.java │ │ │ ├── CoreOAuthProviderSupport.java │ │ │ ├── OAuthProviderProcessingFilter.java │ │ │ ├── ProtectedResourceProcessingFilter.java │ │ │ ├── UnauthenticatedRequestTokenProcessingFilter.java │ │ │ ├── UserAuthorizationProcessingFilter.java │ │ │ └── UserAuthorizationSuccessfulAuthenticationHandler.java │ │ │ ├── nonce │ │ │ ├── ExpiringTimestampNonceServices.java │ │ │ ├── InMemoryNonceServices.java │ │ │ ├── NonceAlreadyUsedException.java │ │ │ ├── NullNonceServices.java │ │ │ └── OAuthNonceServices.java │ │ │ ├── token │ │ │ ├── ExpiredOAuthTokenException.java │ │ │ ├── InMemoryProviderTokenServices.java │ │ │ ├── InMemorySelfCleaningProviderTokenServices.java │ │ │ ├── InvalidOAuthTokenException.java │ │ │ ├── OAuthAccessProviderToken.java │ │ │ ├── OAuthProviderToken.java │ │ │ ├── OAuthProviderTokenImpl.java │ │ │ ├── OAuthProviderTokenServices.java │ │ │ ├── OAuthTokenLifecycleListener.java │ │ │ ├── OAuthTokenLifecycleRegistry.java │ │ │ └── RandomValueProviderTokenServices.java │ │ │ └── verifier │ │ │ ├── OAuthVerifierServices.java │ │ │ ├── RandomValueVerifierServices.java │ │ │ └── VerificationFailedException.java │ └── resources │ │ ├── META-INF │ │ ├── spring.handlers │ │ └── spring.schemas │ │ └── org │ │ └── springframework │ │ └── security │ │ └── oauth │ │ └── spring-security-oauth-1.0.xsd │ └── test │ ├── java │ ├── net │ │ └── oauth │ │ │ └── signature │ │ │ └── GoogleCodeCompatibilityTests.java │ └── org │ │ └── springframework │ │ └── security │ │ └── oauth │ │ ├── common │ │ ├── OAuthCodecTests.java │ │ └── signature │ │ │ ├── CoreOAuthSignatureMethodFactoryTests.java │ │ │ ├── HMAC_SHA1SignatureMethodTests.java │ │ │ ├── PlainTextSignatureMethodTests.java │ │ │ └── RSA_SHA1SignatureMethodTests.java │ │ ├── config │ │ ├── AuthorizationServerBeanDefinitionParserTests.java │ │ ├── ConsumerServiceBeanDefinitionParserTests.java │ │ └── FilterChainInitializationTests.java │ │ ├── consumer │ │ ├── GoogleOAuthTests.java │ │ ├── client │ │ │ ├── CoreOAuthConsumerSupportTests.java │ │ │ └── OAuthRestTemplateTests.java │ │ ├── filter │ │ │ └── OAuthConsumerContextFilterTests.java │ │ └── rememberme │ │ │ └── HttpSessionOAuthRememberMeServicesTests.java │ │ └── provider │ │ ├── CoreOAuthProviderSupportTests.java │ │ ├── filter │ │ ├── AccessTokenProcessingFilterTests.java │ │ ├── OAuthProcessingFilterTests.java │ │ ├── OAuthUserAuthorizationProcessingFilterTests.java │ │ ├── ProtectedResourceProcessingFilterTests.java │ │ ├── UnauthenticatedRequestTokenProcessingFilterTests.java │ │ └── UserAuthorizationSuccessfulAuthenticationHandlerTests.java │ │ └── nonce │ │ └── InMemoryNonceServicesTests.java │ └── resources │ ├── commons-logging.properties │ ├── data.sql │ ├── org │ └── springframework │ │ └── security │ │ └── oauth │ │ └── config │ │ ├── AuthorizationServerBeanDefinitionParserTests-context.xml │ │ ├── ConsumerServiceBeanDefinitionParserTests-context.xml │ │ ├── FilterChainInitializationTests-context.xml │ │ └── igoogle.cert │ ├── schema.sql │ └── simplelog.properties ├── spring-security-oauth2 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── security │ │ │ └── oauth2 │ │ │ ├── client │ │ │ ├── DefaultOAuth2ClientContext.java │ │ │ ├── DefaultOAuth2RequestAuthenticator.java │ │ │ ├── OAuth2ClientContext.java │ │ │ ├── OAuth2RequestAuthenticator.java │ │ │ ├── OAuth2RestOperations.java │ │ │ ├── OAuth2RestTemplate.java │ │ │ ├── discovery │ │ │ │ ├── ProviderConfiguration.java │ │ │ │ └── ProviderDiscoveryClient.java │ │ │ ├── filter │ │ │ │ ├── OAuth2AuthenticationFailureEvent.java │ │ │ │ ├── OAuth2ClientAuthenticationProcessingFilter.java │ │ │ │ ├── OAuth2ClientContextFilter.java │ │ │ │ └── state │ │ │ │ │ ├── DefaultStateKeyGenerator.java │ │ │ │ │ └── StateKeyGenerator.java │ │ │ ├── http │ │ │ │ ├── AccessTokenRequiredException.java │ │ │ │ ├── OAuth2ErrorHandler.java │ │ │ │ └── StringSplitUtils.java │ │ │ ├── resource │ │ │ │ ├── BaseOAuth2ProtectedResourceDetails.java │ │ │ │ ├── OAuth2AccessDeniedException.java │ │ │ │ ├── OAuth2ProtectedResourceDetails.java │ │ │ │ ├── UserApprovalRequiredException.java │ │ │ │ └── UserRedirectRequiredException.java │ │ │ ├── test │ │ │ │ ├── BeforeOAuth2Context.java │ │ │ │ ├── OAuth2ContextConfiguration.java │ │ │ │ ├── OAuth2ContextSetup.java │ │ │ │ ├── RestTemplateHolder.java │ │ │ │ └── TestAccounts.java │ │ │ └── token │ │ │ │ ├── AccessTokenProvider.java │ │ │ │ ├── AccessTokenProviderChain.java │ │ │ │ ├── AccessTokenRequest.java │ │ │ │ ├── ClientKeyGenerator.java │ │ │ │ ├── ClientTokenServices.java │ │ │ │ ├── DefaultAccessTokenRequest.java │ │ │ │ ├── DefaultClientKeyGenerator.java │ │ │ │ ├── DefaultRequestEnhancer.java │ │ │ │ ├── JdbcClientTokenServices.java │ │ │ │ ├── OAuth2AccessTokenSupport.java │ │ │ │ ├── RequestEnhancer.java │ │ │ │ ├── auth │ │ │ │ ├── ClientAuthenticationHandler.java │ │ │ │ └── DefaultClientAuthenticationHandler.java │ │ │ │ └── grant │ │ │ │ ├── client │ │ │ │ ├── ClientCredentialsAccessTokenProvider.java │ │ │ │ └── ClientCredentialsResourceDetails.java │ │ │ │ ├── code │ │ │ │ ├── AuthorizationCodeAccessTokenProvider.java │ │ │ │ └── AuthorizationCodeResourceDetails.java │ │ │ │ ├── implicit │ │ │ │ ├── ImplicitAccessTokenProvider.java │ │ │ │ └── ImplicitResourceDetails.java │ │ │ │ ├── password │ │ │ │ ├── ResourceOwnerPasswordAccessTokenProvider.java │ │ │ │ └── ResourceOwnerPasswordResourceDetails.java │ │ │ │ └── redirect │ │ │ │ └── AbstractRedirectResourceDetails.java │ │ │ ├── common │ │ │ ├── AuthenticationScheme.java │ │ │ ├── DefaultExpiringOAuth2RefreshToken.java │ │ │ ├── DefaultOAuth2AccessToken.java │ │ │ ├── DefaultOAuth2RefreshToken.java │ │ │ ├── DefaultThrowableAnalyzer.java │ │ │ ├── ExpiringOAuth2RefreshToken.java │ │ │ ├── OAuth2AccessToken.java │ │ │ ├── OAuth2AccessTokenJackson2Deserializer.java │ │ │ ├── OAuth2AccessTokenJackson2Serializer.java │ │ │ ├── OAuth2RefreshToken.java │ │ │ ├── exceptions │ │ │ │ ├── BadClientCredentialsException.java │ │ │ │ ├── ClientAuthenticationException.java │ │ │ │ ├── InsufficientScopeException.java │ │ │ │ ├── InvalidClientException.java │ │ │ │ ├── InvalidGrantException.java │ │ │ │ ├── InvalidRequestException.java │ │ │ │ ├── InvalidScopeException.java │ │ │ │ ├── InvalidTokenException.java │ │ │ │ ├── OAuth2Exception.java │ │ │ │ ├── OAuth2ExceptionJackson2Deserializer.java │ │ │ │ ├── OAuth2ExceptionJackson2Serializer.java │ │ │ │ ├── RedirectMismatchException.java │ │ │ │ ├── SerializationException.java │ │ │ │ ├── UnapprovedClientAuthenticationException.java │ │ │ │ ├── UnauthorizedClientException.java │ │ │ │ ├── UnauthorizedUserException.java │ │ │ │ ├── UnsupportedGrantTypeException.java │ │ │ │ ├── UnsupportedResponseTypeException.java │ │ │ │ └── UserDeniedAuthorizationException.java │ │ │ └── util │ │ │ │ ├── DefaultJdbcListFactory.java │ │ │ │ ├── DefaultSerializationStrategy.java │ │ │ │ ├── Jackson2JsonParser.java │ │ │ │ ├── JdbcListFactory.java │ │ │ │ ├── JsonDateDeserializer.java │ │ │ │ ├── JsonDateSerializer.java │ │ │ │ ├── JsonParser.java │ │ │ │ ├── JsonParserFactory.java │ │ │ │ ├── OAuth2Utils.java │ │ │ │ ├── ProxyCreator.java │ │ │ │ ├── RandomValueStringGenerator.java │ │ │ │ ├── SerializationStrategy.java │ │ │ │ ├── SerializationUtils.java │ │ │ │ └── WhitelistedSerializationStrategy.java │ │ │ ├── config │ │ │ ├── annotation │ │ │ │ ├── builders │ │ │ │ │ ├── ClientDetailsServiceBuilder.java │ │ │ │ │ ├── InMemoryClientDetailsServiceBuilder.java │ │ │ │ │ └── JdbcClientDetailsServiceBuilder.java │ │ │ │ ├── configuration │ │ │ │ │ └── ClientDetailsServiceConfiguration.java │ │ │ │ ├── configurers │ │ │ │ │ └── ClientDetailsServiceConfigurer.java │ │ │ │ └── web │ │ │ │ │ ├── configuration │ │ │ │ │ ├── AuthorizationServerConfigurer.java │ │ │ │ │ ├── AuthorizationServerConfigurerAdapter.java │ │ │ │ │ ├── AuthorizationServerEndpointsConfiguration.java │ │ │ │ │ ├── AuthorizationServerSecurityConfiguration.java │ │ │ │ │ ├── EnableAuthorizationServer.java │ │ │ │ │ ├── EnableOAuth2Client.java │ │ │ │ │ ├── EnableResourceServer.java │ │ │ │ │ ├── OAuth2ClientConfiguration.java │ │ │ │ │ ├── ResourceServerConfiguration.java │ │ │ │ │ ├── ResourceServerConfigurer.java │ │ │ │ │ └── ResourceServerConfigurerAdapter.java │ │ │ │ │ └── configurers │ │ │ │ │ ├── AuthorizationServerEndpointsConfigurer.java │ │ │ │ │ ├── AuthorizationServerSecurityConfigurer.java │ │ │ │ │ └── ResourceServerSecurityConfigurer.java │ │ │ └── xml │ │ │ │ ├── AuthorizationServerBeanDefinitionParser.java │ │ │ │ ├── ClientBeanDefinitionParser.java │ │ │ │ ├── ClientDetailsServiceBeanDefinitionParser.java │ │ │ │ ├── ConfigUtils.java │ │ │ │ ├── ExpressionHandlerBeanDefinitionParser.java │ │ │ │ ├── OAuth2ClientContextFactoryBean.java │ │ │ │ ├── OAuth2SecurityNamespaceHandler.java │ │ │ │ ├── ProviderBeanDefinitionParser.java │ │ │ │ ├── ResourceBeanDefinitionParser.java │ │ │ │ ├── ResourceServerBeanDefinitionParser.java │ │ │ │ ├── RestTemplateBeanDefinitionParser.java │ │ │ │ └── WebExpressionHandlerBeanDefinitionParser.java │ │ │ ├── http │ │ │ └── converter │ │ │ │ ├── FormOAuth2AccessTokenMessageConverter.java │ │ │ │ ├── FormOAuth2ExceptionHttpMessageConverter.java │ │ │ │ └── jaxb │ │ │ │ ├── AbstractJaxbMessageConverter.java │ │ │ │ ├── JaxbOAuth2AccessToken.java │ │ │ │ ├── JaxbOAuth2AccessTokenMessageConverter.java │ │ │ │ ├── JaxbOAuth2Exception.java │ │ │ │ └── JaxbOAuth2ExceptionMessageConverter.java │ │ │ └── provider │ │ │ ├── AuthorizationRequest.java │ │ │ ├── BaseRequest.java │ │ │ ├── ClientAlreadyExistsException.java │ │ │ ├── ClientDetails.java │ │ │ ├── ClientDetailsService.java │ │ │ ├── ClientRegistrationException.java │ │ │ ├── ClientRegistrationService.java │ │ │ ├── CompositeTokenGranter.java │ │ │ ├── DefaultSecurityContextAccessor.java │ │ │ ├── NoSuchClientException.java │ │ │ ├── OAuth2Authentication.java │ │ │ ├── OAuth2Request.java │ │ │ ├── OAuth2RequestFactory.java │ │ │ ├── OAuth2RequestValidator.java │ │ │ ├── SecurityContextAccessor.java │ │ │ ├── TokenGranter.java │ │ │ ├── TokenRequest.java │ │ │ ├── approval │ │ │ ├── Approval.java │ │ │ ├── ApprovalStore.java │ │ │ ├── ApprovalStoreUserApprovalHandler.java │ │ │ ├── DefaultUserApprovalHandler.java │ │ │ ├── InMemoryApprovalStore.java │ │ │ ├── JdbcApprovalStore.java │ │ │ ├── TokenApprovalStore.java │ │ │ ├── TokenStoreUserApprovalHandler.java │ │ │ └── UserApprovalHandler.java │ │ │ ├── authentication │ │ │ ├── BearerTokenExtractor.java │ │ │ ├── OAuth2AuthenticationDetails.java │ │ │ ├── OAuth2AuthenticationDetailsSource.java │ │ │ ├── OAuth2AuthenticationManager.java │ │ │ ├── OAuth2AuthenticationProcessingFilter.java │ │ │ └── TokenExtractor.java │ │ │ ├── client │ │ │ ├── BaseClientDetails.java │ │ │ ├── ClientCredentialsTokenEndpointFilter.java │ │ │ ├── ClientCredentialsTokenGranter.java │ │ │ ├── ClientDetailsUserDetailsService.java │ │ │ ├── InMemoryClientDetailsService.java │ │ │ ├── Jackson2ArrayOrStringDeserializer.java │ │ │ └── JdbcClientDetailsService.java │ │ │ ├── code │ │ │ ├── AuthorizationCodeServices.java │ │ │ ├── AuthorizationCodeTokenGranter.java │ │ │ ├── InMemoryAuthorizationCodeServices.java │ │ │ ├── JdbcAuthorizationCodeServices.java │ │ │ ├── RandomValueAuthorizationCodeServices.java │ │ │ └── RedisAuthorizationCodeServices.java │ │ │ ├── endpoint │ │ │ ├── AbstractEndpoint.java │ │ │ ├── AuthorizationEndpoint.java │ │ │ ├── CheckTokenEndpoint.java │ │ │ ├── DefaultRedirectResolver.java │ │ │ ├── ExactMatchRedirectResolver.java │ │ │ ├── FrameworkEndpoint.java │ │ │ ├── FrameworkEndpointHandlerMapping.java │ │ │ ├── RedirectResolver.java │ │ │ ├── TokenEndpoint.java │ │ │ ├── TokenEndpointAuthenticationFilter.java │ │ │ ├── TokenKeyEndpoint.java │ │ │ ├── WhitelabelApprovalEndpoint.java │ │ │ └── WhitelabelErrorEndpoint.java │ │ │ ├── error │ │ │ ├── AbstractOAuth2SecurityExceptionHandler.java │ │ │ ├── DefaultOAuth2ExceptionRenderer.java │ │ │ ├── DefaultWebResponseExceptionTranslator.java │ │ │ ├── OAuth2AccessDeniedHandler.java │ │ │ ├── OAuth2AuthenticationEntryPoint.java │ │ │ ├── OAuth2ExceptionRenderer.java │ │ │ └── WebResponseExceptionTranslator.java │ │ │ ├── expression │ │ │ ├── OAuth2ExpressionParser.java │ │ │ ├── OAuth2ExpressionUtils.java │ │ │ ├── OAuth2MethodSecurityExpressionHandler.java │ │ │ ├── OAuth2SecurityExpressionMethods.java │ │ │ └── OAuth2WebSecurityExpressionHandler.java │ │ │ ├── implicit │ │ │ ├── ImplicitGrantService.java │ │ │ ├── ImplicitTokenGranter.java │ │ │ ├── ImplicitTokenRequest.java │ │ │ └── InMemoryImplicitGrantService.java │ │ │ ├── password │ │ │ └── ResourceOwnerPasswordTokenGranter.java │ │ │ ├── refresh │ │ │ └── RefreshTokenGranter.java │ │ │ ├── request │ │ │ ├── DefaultOAuth2RequestFactory.java │ │ │ └── DefaultOAuth2RequestValidator.java │ │ │ ├── token │ │ │ ├── AbstractTokenGranter.java │ │ │ ├── AccessTokenConverter.java │ │ │ ├── AuthenticationKeyGenerator.java │ │ │ ├── AuthorizationServerTokenServices.java │ │ │ ├── ConsumerTokenServices.java │ │ │ ├── DefaultAccessTokenConverter.java │ │ │ ├── DefaultAuthenticationKeyGenerator.java │ │ │ ├── DefaultTokenServices.java │ │ │ ├── DefaultUserAuthenticationConverter.java │ │ │ ├── RemoteTokenServices.java │ │ │ ├── ResourceServerTokenServices.java │ │ │ ├── TokenEnhancer.java │ │ │ ├── TokenEnhancerChain.java │ │ │ ├── TokenStore.java │ │ │ ├── UserAuthenticationConverter.java │ │ │ └── store │ │ │ │ ├── DelegatingJwtClaimsSetVerifier.java │ │ │ │ ├── InMemoryTokenStore.java │ │ │ │ ├── IssuerClaimVerifier.java │ │ │ │ ├── JdbcTokenStore.java │ │ │ │ ├── JwtAccessTokenConverter.java │ │ │ │ ├── JwtClaimsSetVerifier.java │ │ │ │ ├── JwtTokenStore.java │ │ │ │ ├── KeyStoreKeyFactory.java │ │ │ │ ├── jwk │ │ │ │ ├── EllipticCurveJwkDefinition.java │ │ │ │ ├── JwkAttributes.java │ │ │ │ ├── JwkDefinition.java │ │ │ │ ├── JwkDefinitionSource.java │ │ │ │ ├── JwkException.java │ │ │ │ ├── JwkSetConverter.java │ │ │ │ ├── JwkTokenStore.java │ │ │ │ ├── JwkVerifyingJwtAccessTokenConverter.java │ │ │ │ ├── JwtHeaderConverter.java │ │ │ │ └── RsaJwkDefinition.java │ │ │ │ └── redis │ │ │ │ ├── BaseRedisTokenStoreSerializationStrategy.java │ │ │ │ ├── JdkSerializationStrategy.java │ │ │ │ ├── RedisTokenStore.java │ │ │ │ ├── RedisTokenStoreSerializationStrategy.java │ │ │ │ └── StandardStringSerializationStrategy.java │ │ │ └── vote │ │ │ ├── ClientScopeVoter.java │ │ │ └── ScopeVoter.java │ └── resources │ │ ├── META-INF │ │ ├── spring.handlers │ │ └── spring.schemas │ │ └── org │ │ └── springframework │ │ └── security │ │ └── oauth2 │ │ ├── spring-security-oauth2-1.0.xsd │ │ └── spring-security-oauth2-2.0.xsd │ └── test │ ├── java │ └── org │ │ ├── company │ │ └── oauth2 │ │ │ ├── CustomAuthentication.java │ │ │ ├── CustomOAuth2AccessToken.java │ │ │ └── CustomOAuth2Authentication.java │ │ └── springframework │ │ └── security │ │ └── oauth2 │ │ ├── AdhocTestSuite.java │ │ ├── client │ │ ├── DefaultOAuth2ClientContextTests.java │ │ ├── DefaultOAuth2RequestAuthenticatorTests.java │ │ ├── OAuth2RestTemplateTests.java │ │ ├── discovery │ │ │ └── ProviderDiscoveryClientTest.java │ │ ├── filter │ │ │ ├── OAuth2ClientAuthenticationProcessingFilterTests.java │ │ │ └── OAuth2ClientContextFilterTests.java │ │ ├── http │ │ │ └── OAuth2ErrorHandlerTests.java │ │ └── token │ │ │ ├── AccessTokenProviderChainTests.java │ │ │ ├── JdbcClientTokenServicesTests.java │ │ │ ├── OAuth2AccessTokenSupportTests.java │ │ │ └── grant │ │ │ ├── code │ │ │ ├── AuthorizationCodeAccessTokenProviderTests.java │ │ │ ├── AuthorizationCodeAccessTokenProviderWithConversionTests.java │ │ │ └── AuthorizationCodeResourceDetailsTests.java │ │ │ ├── implicit │ │ │ └── ImplicitAccessTokenProviderTests.java │ │ │ └── password │ │ │ └── ResourceOwnerPasswordAccessTokenProviderTests.java │ │ ├── common │ │ ├── BaseOAuth2AccessTokenJacksonTest.java │ │ ├── DefaultOAuth2SerializationServiceTests.java │ │ ├── JsonSerializationTests.java │ │ ├── OAuth2AccessTokenJackson2DeserializerTests.java │ │ ├── OAuth2AccessTokenJackson2SerializerTests.java │ │ ├── exception │ │ │ ├── OAuth2ExceptionDeserializerTests.java │ │ │ ├── OAuth2ExceptionJackson2DeserializerTests.java │ │ │ └── OAuth2ExceptionSerializerTests.java │ │ └── util │ │ │ ├── CustomSerializationStrategyTests.java │ │ │ ├── RandomValueStringGeneratorTests.java │ │ │ └── SerializationUtilsTests.java │ │ ├── config │ │ ├── annotation │ │ │ ├── AuthorizationServerConfigurationTests.java │ │ │ ├── ClientConfigurationTests.java │ │ │ ├── Gh501EnableAuthorizationServerTests.java │ │ │ ├── Gh808EnableAuthorizationServerTests.java │ │ │ ├── ResourceServerConfigurationTests.java │ │ │ └── TokenServicesMultipleBeansTests.java │ │ └── xml │ │ │ ├── AuthorizationServerBeanDefinitionParserTests.java │ │ │ ├── AuthorizationServerClientCredentialsPasswordInvalidXmlTests.java │ │ │ ├── AuthorizationServerClientCredentialsPasswordValidXmlTests.java │ │ │ ├── AuthorizationServerCustomGrantParserTests.java │ │ │ ├── AuthorizationServerInvalidParserTests.java │ │ │ ├── ClientDetailsServiceBeanDefinitionParserTests.java │ │ │ ├── InvalidResourceBeanDefinitionParserTests.java │ │ │ ├── ResourceBeanDefinitionParserTests.java │ │ │ └── ResourceServerBeanDefinitionParserTests.java │ │ ├── http │ │ └── converter │ │ │ └── jaxb │ │ │ ├── BaseJaxbMessageConverterTest.java │ │ │ ├── JaxbOAuth2AccessTokenMessageConverterTests.java │ │ │ └── JaxbOAuth2ExceptionMessageConverterTests.java │ │ └── provider │ │ ├── AuthorizationRequestTests.java │ │ ├── OAuth2AuthenticationTests.java │ │ ├── OAuth2RequestTests.java │ │ ├── RequestTokenFactory.java │ │ ├── approval │ │ ├── AbstractTestApprovalStore.java │ │ ├── ApprovalStoreUserApprovalHandlerTests.java │ │ ├── DefaultUserApprovalHandlerTests.java │ │ ├── InMemoryApprovalStoreTests.java │ │ ├── JdbcApprovalStoreTests.java │ │ ├── TokenApprovalStoreTests.java │ │ └── TokenStoreUserApprovalHandlerTests.java │ │ ├── authentication │ │ ├── OAuth2AuthenticationDetailsTests.java │ │ ├── OAuth2AuthenticationManagerTests.java │ │ └── OAuth2AuthenticationProcessingFilterTests.java │ │ ├── client │ │ ├── BaseClientDetailsTests.java │ │ ├── ClientCredentialsTokenEndpointFilterTests.java │ │ ├── ClientDetailsUserDetailsServiceTests.java │ │ └── JdbcClientDetailsServiceTests.java │ │ ├── code │ │ ├── AuthorizationCodeServicesBaseTests.java │ │ ├── AuthorizationCodeTokenGranterTests.java │ │ ├── InMemoryAuthorizationCodeServicesTests.java │ │ ├── JdbcAuthorizationCodeServicesTests.java │ │ ├── RedisAuthorizationCodeServicesTests.java │ │ └── SubdomainRedirectResolverTests.java │ │ ├── endpoint │ │ ├── AuthorizationEndpointTests.java │ │ ├── CheckTokenEndpointTest.java │ │ ├── DefaultRedirectResolverTests.java │ │ ├── ExactMatchRedirectResolverTests.java │ │ ├── FrameworkEndpointHandlerMappingTests.java │ │ ├── TokenEndpointAuthenticationFilterTests.java │ │ ├── TokenEndpointTests.java │ │ ├── WhitelabelApprovalEndpointTests.java │ │ └── WhitelabelErrorEndpointTests.java │ │ ├── error │ │ ├── DefaultWebResponseExceptionTranslatorTests.java │ │ ├── OAuth2AccessDeniedHandlerTests.java │ │ └── OAuth2AuthenticationEntryPointTests.java │ │ ├── expression │ │ ├── OAuth2ExpressionParserTests.java │ │ ├── OAuth2MethodSecurityExpressionHandlerTests.java │ │ ├── OAuth2SecurityExpressionMethodsTests.java │ │ └── OAuth2WebSecurityExpressionHandlerTests.java │ │ ├── implicit │ │ └── InMemoryImplicitGrantServiceTests.java │ │ ├── password │ │ └── ResourceOwnerPasswordTokenGranterTests.java │ │ ├── refresh │ │ └── RefreshTokenGranterTests.java │ │ ├── request │ │ ├── DefaultAuthorizationRequestFactoryTests.java │ │ └── DefaultOAuth2RequestValidatorTests.java │ │ ├── test │ │ └── OAuth2RequestTests.java │ │ ├── token │ │ ├── AbstractDefaultTokenServicesTests.java │ │ ├── AbstractPersistentDefaultTokenServicesTests.java │ │ ├── DefaultAccessTokenConverterTests.java │ │ ├── DefaultAuthenticationKeyGeneratorTest.java │ │ ├── DefaultTokenServicesAuthoritiesChangeTests.java │ │ ├── DefaultTokenServicesTests.java │ │ ├── DefaultTokenServicesWithInMemoryTests.java │ │ ├── DefaultTokenServicesWithJdbcTests.java │ │ ├── DefaultTokenServicesWithJwtTests.java │ │ ├── DefaultUserAuthenticationConverterTests.java │ │ ├── RemoteTokenServicesTest.java │ │ ├── TokenServicesWithTokenEnhancerTests.java │ │ └── store │ │ │ ├── InMemoryTokenStoreTests.java │ │ │ ├── IssuerClaimVerifierTest.java │ │ │ ├── JdbcTokenStoreTests.java │ │ │ ├── JwtAccessTokenConverterTests.java │ │ │ ├── JwtTokenStoreTests.java │ │ │ ├── TokenStoreBaseTests.java │ │ │ ├── jwk │ │ │ ├── JwkDefinitionSourceITests.java │ │ │ ├── JwkDefinitionSourceTests.java │ │ │ ├── JwkDefinitionTests.java │ │ │ ├── JwkSetConverterTests.java │ │ │ ├── JwkTokenStoreITests.java │ │ │ ├── JwkTokenStoreTests.java │ │ │ ├── JwkVerifyingJwtAccessTokenConverterTests.java │ │ │ ├── JwtHeaderConverterTests.java │ │ │ ├── JwtTestUtil.java │ │ │ └── RsaJwkDefinitionTests.java │ │ │ └── redis │ │ │ ├── RedisTokenStoreCustomTokenTests.java │ │ │ ├── RedisTokenStoreMockTests.java │ │ │ ├── RedisTokenStorePrefixTests.java │ │ │ └── RedisTokenStoreTests.java │ │ └── vote │ │ ├── ClientScopeVoterTests.java │ │ └── ScopeVoterTests.java │ └── resources │ ├── commons-logging.properties │ ├── data.sql │ ├── keystore.jks │ ├── org │ └── springframework │ │ └── security │ │ └── oauth2 │ │ ├── config │ │ └── xml │ │ │ ├── ClientDetailsServiceBeanDefinitionParserTests-context.xml │ │ │ ├── ResourceBeanDefinitionParserTests-context.xml │ │ │ ├── authorization-server-check-token-custom-endpoint.xml │ │ │ ├── authorization-server-check-token.xml │ │ │ ├── authorization-server-client-credentials-password-invalid.xml │ │ │ ├── authorization-server-client-credentials-password-valid.xml │ │ │ ├── authorization-server-custom-grant.xml │ │ │ ├── authorization-server-disable.xml │ │ │ ├── authorization-server-extras.xml │ │ │ ├── authorization-server-invalid.xml │ │ │ ├── authorization-server-types.xml │ │ │ ├── authorization-server-vanilla.xml │ │ │ ├── resource-server-authmanager-context.xml │ │ │ └── resource-server-context.xml │ │ └── provider │ │ └── token │ │ └── store │ │ └── jwk │ │ ├── jwk-set.json │ │ └── token.jwt │ ├── schema.sql │ └── simplelog.properties ├── src └── site │ ├── apt │ └── index.apt │ └── site.xml └── tests ├── annotation ├── README.md ├── approval │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ └── logback-test.xml ├── client │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── client │ │ │ │ └── ClientApplication.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── client │ │ │ ├── ApplicationTests.java │ │ │ ├── ClientServerInteractionTests.java │ │ │ └── CombinedApplication.java │ │ └── resources │ │ ├── application-combined.properties │ │ └── logback-test.xml ├── common │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── sparklr │ │ │ │ └── common │ │ │ │ ├── AbstractAuthorizationCodeProviderTests.java │ │ │ │ ├── AbstractClientCredentialsProviderTests.java │ │ │ │ ├── AbstractEmptyAuthorizationCodeProviderTests.java │ │ │ │ ├── AbstractImplicitProviderTests.java │ │ │ │ ├── AbstractIntegrationTests.java │ │ │ │ ├── AbstractProtectedResourceTests.java │ │ │ │ ├── AbstractRefreshTokenSupportTests.java │ │ │ │ ├── AbstractResourceOwnerPasswordProviderTests.java │ │ │ │ └── HttpTestUtils.java │ │ └── resources │ │ │ └── logback.xml │ │ └── test │ │ └── resources │ │ └── logback-test.xml ├── custom-authentication │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ ├── Application.java │ │ │ │ └── HardCodedAuthenticationFilter.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── ApplicationTests.java │ │ │ └── ClientCredentialsProviderTests.java │ │ └── resources │ │ └── logback-test.xml ├── custom-grant │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ ├── Application.java │ │ │ │ └── CustomTokenGranter.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── AdHocTests.java │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── CustomProviderTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ └── logback-test.xml ├── form │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── AdHocTests.java │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ └── logback-test.xml ├── jaxb │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── Converters.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ └── logback-test.xml ├── jdbc │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ ├── Application.java │ │ │ │ └── ClientApplication.java │ │ └── resources │ │ │ ├── application.yml │ │ │ └── schema.sql │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── AdHocTests.java │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ ├── logback-test.xml │ │ └── test.properties ├── jpa │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── AdHocTests.java │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderCookieTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ ├── logback-test.xml │ │ └── test.properties ├── jwt │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ └── logback-test.xml ├── mappings │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ ├── ResourceOwnerPasswordProviderTests.java │ │ │ └── ServletPathClientCredentialsProviderTests.java │ │ └── resources │ │ └── logback-test.xml ├── multi │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ └── logback-test.xml ├── pom.xml ├── resource │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── ApplicationTests.java │ │ │ └── ProtectedResourceTests.java │ │ └── resources │ │ └── logback-test.xml ├── ssl │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── demo │ │ │ │ └── Application.java │ │ └── resources │ │ │ ├── application.yml │ │ │ └── sample.jks │ │ └── test │ │ ├── java │ │ └── demo │ │ │ ├── ApplicationTests.java │ │ │ ├── AuthorizationCodeProviderCookieTests.java │ │ │ ├── AuthorizationCodeProviderTests.java │ │ │ ├── ClientCredentialsProviderTests.java │ │ │ ├── GlobalMethodSecurityTests.java │ │ │ ├── ImplicitProviderTests.java │ │ │ ├── ProtectedResourceTests.java │ │ │ ├── RefreshTokenSupportTests.java │ │ │ └── ResourceOwnerPasswordProviderTests.java │ │ └── resources │ │ └── logback-test.xml └── vanilla │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── demo │ │ │ └── Application.java │ └── resources │ │ └── application.yml │ └── test │ ├── java │ └── demo │ │ ├── AdHocTests.java │ │ ├── ApplicationTests.java │ │ ├── AuthorizationCodeProviderCookieTests.java │ │ ├── AuthorizationCodeProviderTests.java │ │ ├── ClientCredentialsProviderTests.java │ │ ├── GlobalMethodSecurityTests.java │ │ ├── ImplicitProviderTests.java │ │ ├── ProtectedResourceTests.java │ │ ├── RefreshTokenSupportTests.java │ │ └── ResourceOwnerPasswordProviderTests.java │ └── resources │ └── logback-test.xml ├── pom.xml └── xml ├── README.md ├── approval ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── demo │ │ │ └── Application.java │ └── resources │ │ ├── application.yml │ │ └── context.xml │ └── test │ └── java │ └── demo │ ├── ApplicationTests.java │ ├── AuthorizationCodeProviderTests.java │ ├── ClientCredentialsProviderTests.java │ ├── ImplicitProviderTests.java │ ├── ProtectedResourceTests.java │ ├── RefreshTokenSupportTests.java │ └── ResourceOwnerPasswordProviderTests.java ├── client ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── client │ │ │ └── ClientApplication.java │ └── resources │ │ ├── application.yml │ │ └── context.xml │ └── test │ ├── java │ └── client │ │ ├── ApplicationTests.java │ │ ├── ClientServerInteractionTests.java │ │ └── CombinedApplication.java │ └── resources │ └── application-combined.properties ├── common ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── sparklr │ │ │ └── common │ │ │ ├── AbstractAuthorizationCodeProviderTests.java │ │ │ ├── AbstractClientCredentialsProviderTests.java │ │ │ ├── AbstractImplicitProviderTests.java │ │ │ ├── AbstractIntegrationTests.java │ │ │ ├── AbstractProtectedResourceTests.java │ │ │ ├── AbstractRefreshTokenSupportTests.java │ │ │ ├── AbstractResourceOwnerPasswordProviderTests.java │ │ │ └── HttpTestUtils.java │ └── resources │ │ ├── commons-logging.properties │ │ ├── logback.xml │ │ └── simplelog.properties │ └── test │ └── resources │ └── logback-test.xml ├── form ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── demo │ │ │ └── Application.java │ └── resources │ │ ├── application.yml │ │ └── context.xml │ └── test │ └── java │ └── demo │ ├── ApplicationTests.java │ ├── AuthorizationCodeProviderTests.java │ ├── ClientCredentialsProviderTests.java │ ├── ImplicitProviderTests.java │ ├── ProtectedResourceTests.java │ ├── RefreshTokenSupportTests.java │ └── ResourceOwnerPasswordProviderTests.java ├── jdbc ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── demo │ │ │ ├── Application.java │ │ │ └── ClientApplication.java │ └── resources │ │ ├── application.yml │ │ ├── context.xml │ │ └── schema.sql │ └── test │ ├── java │ └── demo │ │ ├── AdHocTests.java │ │ ├── ApplicationTests.java │ │ ├── AuthorizationCodeProviderTests.java │ │ ├── ClientCredentialsProviderTests.java │ │ ├── ImplicitProviderTests.java │ │ ├── ProtectedResourceTests.java │ │ ├── RefreshTokenSupportTests.java │ │ └── ResourceOwnerPasswordProviderTests.java │ └── resources │ └── test.properties ├── jwt ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── demo │ │ │ └── Application.java │ └── resources │ │ ├── application.yml │ │ └── context.xml │ └── test │ └── java │ └── demo │ ├── ApplicationTests.java │ ├── AuthorizationCodeProviderTests.java │ ├── ClientCredentialsProviderTests.java │ ├── ImplicitProviderTests.java │ ├── ProtectedResourceTests.java │ ├── RefreshTokenSupportTests.java │ └── ResourceOwnerPasswordProviderTests.java ├── mappings ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── demo │ │ │ └── Application.java │ └── resources │ │ ├── application.yml │ │ └── context.xml │ └── test │ └── java │ └── demo │ ├── ApplicationTests.java │ ├── AuthorizationCodeProviderTests.java │ ├── ClientCredentialsProviderTests.java │ ├── ImplicitProviderTests.java │ ├── ProtectedResourceTests.java │ ├── RefreshTokenSupportTests.java │ └── ResourceOwnerPasswordProviderTests.java ├── pom.xml └── vanilla ├── README.md ├── pom.xml └── src ├── main ├── java │ └── demo │ │ └── Application.java └── resources │ ├── application.yml │ └── context.xml └── test └── java └── demo ├── ApplicationTests.java ├── AuthorizationCodeProviderTests.java ├── ClientCredentialsProviderTests.java ├── ImplicitProviderTests.java ├── ProtectedResourceTests.java ├── RefreshTokenSupportTests.java └── ResourceOwnerPasswordProviderTests.java /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 9 | 10 | 13 | 14 | ### Summary 15 | 16 | 19 | 20 | ### Actual Behavior 21 | 22 | 25 | 26 | ### Expected Behavior 27 | 28 | 31 | 32 | ### Configuration 33 | 34 | 37 | 38 | ### Version 39 | 40 | 43 | 44 | ### Sample 45 | 46 | 50 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 9 | 10 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *# 2 | .#* 3 | *~ 4 | _site/ 5 | */src/META-INF/ 6 | */src/main/java/META-INF/ 7 | samples/*/*/src/main/webapp/META-INF/ 8 | build/ 9 | target/ 10 | bin/ 11 | .classpath 12 | .project 13 | .DS_Store 14 | .settings/ 15 | .springBeans 16 | *.iml 17 | *.iws 18 | *.ipr 19 | .idea/ 20 | ./code/ 21 | cargo-installs/ 22 | atlassian-ide-plugin.xml 23 | -------------------------------------------------------------------------------- /.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom -------------------------------------------------------------------------------- /.mvn/maven.config: -------------------------------------------------------------------------------- 1 | -DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring 2 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | dist: trusty 4 | 5 | jdk: 6 | - openjdk8 7 | - openjdk7 8 | 9 | services: 10 | - redis-server 11 | 12 | install: ./mvnw -U install --quiet -DskipTests=true -P bootstrap 13 | 14 | script: 15 | - jdk_switcher use openjdk7 16 | - ./mvnw clean test -P bootstrap 17 | - jdk_switcher use openjdk8 18 | - ./mvnw -U clean checkstyle:check -P spring5 19 | - ./mvnw -f spring-security-oauth2 -U clean test -P spring5 20 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | redis: 2 | image: redis 3 | ports: 4 | - "6379:6379" 5 | -------------------------------------------------------------------------------- /etc/nohttp/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /etc/nohttp/whitelist.lines: -------------------------------------------------------------------------------- 1 | http://junit.sourceforge.net/javadoc/ -------------------------------------------------------------------------------- /notice.txt: -------------------------------------------------------------------------------- 1 | ====================================================================== 2 | == NOTICE file corresponding to section 4 d of the Apache License, == 3 | == Version 2.0, in this case for the spring-security-oauth == 4 | == distribution. == 5 | ====================================================================== 6 | 7 | This product includes software developed by 8 | the Apache Software Foundation (https://www.apache.org). 9 | 10 | This product includes software developed by the Spring Framework 11 | Project (https://www.springframework.org). 12 | 13 | The end-user documentation included with a redistribution, if any, 14 | must include the following acknowledgement: 15 | 16 | "This product includes software developed by Web Cohesion 17 | (https://www.webcohesion.com)." 18 | 19 | Alternately, this acknowledgement may appear in the software itself, 20 | if and wherever such third-party acknowledgements normally appear. 21 | 22 | The name spring-security-oauth must not be used to endorse or promote 23 | products derived from this software without prior written permission. 24 | For written permission, please contact ryan@webcohesion.com. -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/java/org/springframework/security/oauth/examples/sparklr/PhotoService.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.sparklr; 2 | 3 | import java.util.Collection; 4 | import java.io.InputStream; 5 | 6 | /** 7 | * Service for retrieving photos. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | public interface PhotoService { 12 | 13 | /** 14 | * Load the photos for the current user. 15 | * 16 | * @return The photos for the current user. 17 | */ 18 | Collection getPhotosForCurrentUser(); 19 | 20 | /** 21 | * Load a photo by id. 22 | * 23 | * @param id The id of the photo. 24 | * @return The photo that was read. 25 | */ 26 | InputStream loadPhoto(String id); 27 | } 28 | -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl 2 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/certs/igoogle.cert: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDBDCCAm2gAwIBAgIJAK8dGINfkSTHMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV 3 | BAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzETMBEG 4 | A1UEChMKR29vZ2xlIEluYzEXMBUGA1UEAxMOd3d3Lmdvb2dsZS5jb20wHhcNMDgx 5 | MDA4MDEwODMyWhcNMDkxMDA4MDEwODMyWjBgMQswCQYDVQQGEwJVUzELMAkGA1UE 6 | CBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxEzARBgNVBAoTCkdvb2dsZSBJ 7 | bmMxFzAVBgNVBAMTDnd3dy5nb29nbGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN 8 | ADCBiQKBgQDQUV7ukIfIixbokHONGMW9+ed0E9X4m99I8upPQp3iAtqIvWs7XCbA 9 | bGqzQH1qX9Y00hrQ5RRQj8OI3tRiQs/KfzGWOdvLpIk5oXpdT58tg4FlYh5fbhIo 10 | VoVn4GvtSjKmJFsoM8NRtEJHL1aWd++dXzkQjEsNcBXwQvfDb0YnbQIDAQABo4HF 11 | MIHCMB0GA1UdDgQWBBSm/h1pNY91bNfW08ac9riYzs3cxzCBkgYDVR0jBIGKMIGH 12 | gBSm/h1pNY91bNfW08ac9riYzs3cx6FkpGIwYDELMAkGA1UEBhMCVVMxCzAJBgNV 13 | BAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUg 14 | SW5jMRcwFQYDVQQDEw53d3cuZ29vZ2xlLmNvbYIJAK8dGINfkSTHMAwGA1UdEwQF 15 | MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAYpHTr3vQNsHHHUm4MkYcDB20a5KvcFoX 16 | gCcYtmdyd8rh/FKeZm2me7eQCXgBfJqQ4dvVLJ4LgIQiU3R5ZDe0WbW7rJ3M9ADQ 17 | FyQoRJP8OIMYW3BoMi0Z4E730KSLRh6kfLq4rK6vw7lkH9oynaHHWZSJLDAp17cP 18 | j+6znWkN9/g= 19 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo1.jpg -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo2.jpg -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo3.jpg -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo4.jpg -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo5.jpg -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo6.jpg -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/resources/simplelog.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.simplelog.defaultlog=warn 2 | #org.apache.commons.logging.simplelog.log.org.springframework.security=debug 3 | -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/webapp/WEB-INF/appengine-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ${gae.application.name} 4 | 1 5 | true 6 | 7 | -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | springSecurityFilterChain 11 | org.springframework.web.filter.DelegatingFilterProxy 12 | 13 | 14 | 15 | springSecurityFilterChain 16 | /* 17 | 18 | 19 | 20 | org.springframework.web.context.ContextLoaderListener 21 | 22 | 23 | 24 | spring 25 | org.springframework.web.servlet.DispatcherServlet 26 | 27 | 28 | 29 | spring 30 | / 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/webapp/images/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/sparklr/src/main/webapp/images/bg.gif -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/webapp/images/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/sparklr/src/main/webapp/images/header.jpg -------------------------------------------------------------------------------- /samples/oauth/sparklr/src/main/webapp/request_token_authorized.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="authz" uri="http://www.springframework.org/security/tags" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> 3 | 4 | 5 | 6 | 7 | Sparklr 8 | "/> 9 | 10 | 11 | 12 | 13 |

Sparklr

14 | 15 |
16 |

Home

17 | 18 |

You have successfully authorized the request for a protected resource.

19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/java/org/springframework/security/oauth/examples/tonr/GoogleService.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.tonr; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author Ryan Heaton 7 | */ 8 | public interface GoogleService { 9 | List getLastTenPicasaPictureURLs(); 10 | } 11 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/java/org/springframework/security/oauth/examples/tonr/SparklrException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.tonr; 2 | 3 | /** 4 | * @author Ryan Heaton 5 | */ 6 | @SuppressWarnings("serial") 7 | public class SparklrException extends Exception { 8 | 9 | public SparklrException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/java/org/springframework/security/oauth/examples/tonr/SparklrService.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.tonr; 2 | 3 | import java.io.InputStream; 4 | import java.util.List; 5 | 6 | /** 7 | * @author Ryan Heaton 8 | */ 9 | public interface SparklrService { 10 | 11 | /** 12 | * Get the list of Sparklr photo ids for the current user. 13 | * 14 | * @return The list of photo ids for the current user. 15 | */ 16 | List getSparklrPhotoIds() throws SparklrException; 17 | 18 | /** 19 | * Loads the Sparklr photo for the current user. 20 | * 21 | * @param id the id or the photo. 22 | * @return The sparklr photo. 23 | */ 24 | InputStream loadSparklrPhoto(String id) throws SparklrException; 25 | } 26 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/java/org/springframework/security/oauth/examples/tonr/mvc/PicasaController.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.tonr.mvc; 2 | 3 | import org.springframework.security.oauth.examples.tonr.GoogleService; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | 8 | /** 9 | * @author Ryan Heaton 10 | * @author Dave Syer 11 | */ 12 | @Controller 13 | public class PicasaController { 14 | 15 | private GoogleService googleService; 16 | 17 | @RequestMapping("/google/picasa") 18 | public String photos(Model model) throws Exception { 19 | model.addAttribute("photoUrls", googleService.getLastTenPicasaPictureURLs()); 20 | return "picasa"; 21 | } 22 | 23 | public void setGoogleService(GoogleService googleService) { 24 | this.googleService = googleService; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl 2 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/resources/simplelog.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.simplelog.defaultlog=warn 2 | #org.apache.commons.logging.simplelog.log.org.springframework.security=debug 3 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/webapp/WEB-INF/jsp/sparklr.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="authz" uri="http://www.springframework.org/security/tags" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> 3 | 4 | 5 | 6 | " rel="stylesheet" type="text/css"/> 7 | tonr 8 | 9 | 10 |
11 | 12 | 20 | 21 |
22 |

Your Sparklr Photos

23 | 24 |
    25 | 26 |
  • "/>
  • 27 |
    28 |
29 |
30 |
31 | 32 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/webapp/WEB-INF/sparklr.properties: -------------------------------------------------------------------------------- 1 | sparklrPhotoListURL=http://localhost:8080/sparklr/photos?format=xml 2 | sparklrPhotoURLPattern=http://localhost:8080/sparklr/photos/%s 3 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | springSecurityFilterChain 11 | org.springframework.web.filter.DelegatingFilterProxy 12 | 13 | 14 | 15 | springSecurityFilterChain 16 | /* 17 | 18 | 19 | 20 | org.springframework.web.context.ContextLoaderListener 21 | 22 | 23 | 24 | spring 25 | org.springframework.web.servlet.DispatcherServlet 26 | 27 | 28 | 29 | spring 30 | / 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/webapp/images/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/tonr/src/main/webapp/images/bg.gif -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/webapp/images/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/tonr/src/main/webapp/images/header.jpg -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/webapp/images/xbg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/tonr/src/main/webapp/images/xbg.gif -------------------------------------------------------------------------------- /samples/oauth/tonr/src/main/webapp/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth/tonr/src/main/webapp/style.css -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/java/org/springframework/security/oauth/examples/sparklr/PhotoService.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.sparklr; 2 | 3 | import java.io.InputStream; 4 | import java.util.Collection; 5 | 6 | /** 7 | * Service for retrieving photos. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | public interface PhotoService { 12 | 13 | /** 14 | * Load the photos for the current user. 15 | * 16 | * @return The photos for the current user. 17 | */ 18 | Collection getPhotosForCurrentUser(String username); 19 | 20 | /** 21 | * Load a photo by id. 22 | * 23 | * @param id The id of the photo. 24 | * @return The photo that was read. 25 | */ 26 | InputStream loadPhoto(String id); 27 | } 28 | -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/java/org/springframework/security/oauth/examples/sparklr/PhotoServiceUser.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.sparklr; 2 | 3 | /** 4 | * Photo service user information - added to enable user information to be available to Spring Social client 5 | * 6 | * @author Michael Lavelle 7 | */ 8 | public class PhotoServiceUser { 9 | 10 | private String username; 11 | private String name; 12 | 13 | /** 14 | * Create a new PhotoServiceUser 15 | * 16 | * @param username The unique username for the user 17 | * @param name The name of the user 18 | */ 19 | public PhotoServiceUser(String username,String name) 20 | { 21 | this.username = username; 22 | this.name = name; 23 | } 24 | 25 | /** 26 | * The unique username for the user 27 | * 28 | * @return username of the user 29 | */ 30 | public String getUsername() { 31 | return username; 32 | } 33 | 34 | /** 35 | * The name of the user 36 | * 37 | * @return name of the user 38 | */ 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/java/org/springframework/security/oauth/examples/sparklr/mvc/PhotoServiceUserController.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.sparklr.mvc; 2 | 3 | import java.security.Principal; 4 | 5 | import org.springframework.security.oauth.examples.sparklr.PhotoServiceUser; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.ResponseBody; 9 | 10 | /** 11 | * @author Michael Lavelle 12 | * 13 | * Added to provide an endpoint from which Spring Social can obtain authentication details 14 | */ 15 | @RequestMapping("/me") 16 | @Controller 17 | public class PhotoServiceUserController { 18 | 19 | @ResponseBody 20 | @RequestMapping("") 21 | public PhotoServiceUser getPhotoServiceUser(Principal principal) 22 | { 23 | return new PhotoServiceUser(principal.getName(),principal.getName()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl 2 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo1.jpg -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo2.jpg -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo3.jpg -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo4.jpg -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo5.jpg -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/samples/oauth2/sparklr/src/main/resources/org/springframework/security/oauth/examples/sparklr/impl/resources/photo6.jpg -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/resources/simplelog.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.simplelog.defaultlog=warn 2 | #org.apache.commons.logging.simplelog.log.org.springframework.security=debug 3 | -------------------------------------------------------------------------------- /samples/oauth2/sparklr/src/main/webapp/WEB-INF/jsp/oauth_error.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 2 | 3 | 4 | 5 | 6 | 7 | Sparklr 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 |
18 | 19 |

Sparklr OAuth2 Error

20 | 21 |

22 | 23 | ( 24 | 25 | ) 26 |

27 |

Please go back to your client application and try again, or 28 | contact the owner and ask for support

29 | 30 | 35 | 36 | 37 |
38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /samples/oauth2/tonr/.springBeans: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/oauth2/tonr/src/main/java/org/springframework/security/oauth/examples/tonr/SparklrException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.tonr; 2 | 3 | /** 4 | * @author Ryan Heaton 5 | */ 6 | @SuppressWarnings("serial") 7 | public class SparklrException extends Exception { 8 | 9 | public SparklrException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/oauth2/tonr/src/main/java/org/springframework/security/oauth/examples/tonr/SparklrService.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.examples.tonr; 2 | 3 | import java.io.InputStream; 4 | import java.util.List; 5 | 6 | /** 7 | * @author Ryan Heaton 8 | */ 9 | public interface SparklrService { 10 | 11 | /** 12 | * Get the list of Sparklr photo ids for the current user. 13 | * 14 | * @return The list of photo ids for the current user. 15 | */ 16 | List getSparklrPhotoIds() throws SparklrException; 17 | 18 | /** 19 | * Loads the Sparklr photo for the current user. 20 | * 21 | * @param id the id or the photo. 22 | * @return The sparklr photo. 23 | */ 24 | InputStream loadSparklrPhoto(String id) throws SparklrException; 25 | 26 | /** 27 | * @return a message 28 | */ 29 | String getTrustedMessage(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /samples/oauth2/tonr/src/main/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl 2 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -------------------------------------------------------------------------------- /samples/oauth2/tonr/src/main/resources/simplelog.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.simplelog.defaultlog=warn 2 | #org.apache.commons.logging.simplelog.log.org.springframework.security=debug 3 | -------------------------------------------------------------------------------- /samples/oauth2/tonr/src/main/resources/sparklr.properties: -------------------------------------------------------------------------------- 1 | sparklrPhotoListURL=http://localhost:8080/sparklr2/photos?format=xml 2 | sparklrPhotoURLPattern=http://localhost:8080/sparklr2/photos/%s 3 | sparklrTrustedMessageURL=http://localhost:8080/sparklr2/photos/trusted/message 4 | accessTokenUri=http://localhost:8080/sparklr2/oauth/token 5 | userAuthorizationUri=http://localhost:8080/sparklr2/oauth/authorize 6 | -------------------------------------------------------------------------------- /spring-security-jwt/.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom -------------------------------------------------------------------------------- /spring-security-jwt/.mvn/maven.config: -------------------------------------------------------------------------------- 1 | -DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring 2 | -------------------------------------------------------------------------------- /spring-security-jwt/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/spring-security-jwt/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-security-jwt/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip -------------------------------------------------------------------------------- /spring-security-jwt/src/main/java/org/springframework/security/jwt/AlgorithmMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.jwt; 14 | 15 | /** 16 | *

17 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 18 | * 19 | * @author Luke Taylor 20 | */ 21 | @Deprecated 22 | public interface AlgorithmMetadata { 23 | /** 24 | * @return the JCA/JCE algorithm name. 25 | */ 26 | String algorithm(); 27 | } 28 | -------------------------------------------------------------------------------- /spring-security-jwt/src/main/java/org/springframework/security/jwt/BinaryFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.jwt; 14 | 15 | /** 16 | *

17 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 18 | * 19 | * @author Luke Taylor 20 | */ 21 | @Deprecated 22 | public interface BinaryFormat { 23 | byte[] bytes(); 24 | } 25 | -------------------------------------------------------------------------------- /spring-security-jwt/src/main/java/org/springframework/security/jwt/Jwt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.jwt; 14 | 15 | import org.springframework.security.jwt.crypto.sign.SignatureVerifier; 16 | 17 | /** 18 | *

19 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 20 | * 21 | * @author Luke Taylor 22 | */ 23 | @Deprecated 24 | public interface Jwt extends BinaryFormat { 25 | String getClaims(); 26 | 27 | String getEncoded(); 28 | 29 | void verifySignature(SignatureVerifier verifier); 30 | } 31 | -------------------------------------------------------------------------------- /spring-security-jwt/src/main/java/org/springframework/security/jwt/crypto/cipher/CipherMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.jwt.crypto.cipher; 14 | 15 | import org.springframework.security.jwt.AlgorithmMetadata; 16 | 17 | /** 18 | *

19 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 20 | * 21 | * @author Luke Taylor 22 | */ 23 | @Deprecated 24 | public interface CipherMetadata extends AlgorithmMetadata { 25 | /** 26 | * @return Size of the key in bits. 27 | */ 28 | int keySize(); 29 | } 30 | -------------------------------------------------------------------------------- /spring-security-jwt/src/main/java/org/springframework/security/jwt/crypto/sign/InvalidSignatureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.jwt.crypto.sign; 14 | 15 | /** 16 | *

17 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 18 | * 19 | * @author Luke Taylor 20 | */ 21 | @Deprecated 22 | public class InvalidSignatureException extends RuntimeException { 23 | public InvalidSignatureException(String message) { 24 | super(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spring-security-jwt/src/main/java/org/springframework/security/jwt/crypto/sign/SignatureVerifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.jwt.crypto.sign; 14 | 15 | import org.springframework.security.jwt.AlgorithmMetadata; 16 | 17 | /** 18 | *

19 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 20 | * 21 | * @author Luke Taylor 22 | */ 23 | @Deprecated 24 | public interface SignatureVerifier extends AlgorithmMetadata { 25 | void verify(byte[] content, byte[] signature); 26 | } 27 | -------------------------------------------------------------------------------- /spring-security-jwt/src/main/java/org/springframework/security/jwt/crypto/sign/Signer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.jwt.crypto.sign; 14 | 15 | import org.springframework.security.jwt.AlgorithmMetadata; 16 | 17 | /** 18 | *

19 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 20 | * 21 | * @author Luke Taylor 22 | */ 23 | @Deprecated 24 | public interface Signer extends AlgorithmMetadata { 25 | byte[] sign(byte[] bytes); 26 | } 27 | -------------------------------------------------------------------------------- /spring-security-jwt/src/main/java/org/springframework/security/jwt/crypto/sign/SignerVerifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.jwt.crypto.sign; 14 | 15 | /** 16 | *

17 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 18 | * 19 | * @author Luke Taylor 20 | */ 21 | @Deprecated 22 | public interface SignerVerifier extends Signer, SignatureVerifier { 23 | } 24 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/java/org/springframework/security/oauth/common/signature/SaltedConsumerSecret.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.common.signature; 2 | 3 | /** 4 | * Marker interface for indicating that a consumer secret has some salt. 5 | * 6 | *

7 | * @deprecated The OAuth 1.0 Protocol RFC 5849 is obsoleted by the OAuth 2.0 Authorization Framework RFC 6749. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | @Deprecated 12 | public interface SaltedConsumerSecret { 13 | 14 | /** 15 | * Returns the salt to use for this consumer secret. 16 | * 17 | * @return the salt to use for this consumer secret. 18 | */ 19 | Object getSalt(); 20 | } 21 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/java/org/springframework/security/oauth/common/signature/SignatureSecret.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 Web Cohesion 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.security.oauth.common.signature; 18 | 19 | import java.io.Serializable; 20 | 21 | /** 22 | * Marker interface for OAuth signature secrets. 23 | * 24 | *

25 | * @deprecated The OAuth 1.0 Protocol RFC 5849 is obsoleted by the OAuth 2.0 Authorization Framework RFC 6749. 26 | * 27 | * @author Ryan Heaton 28 | * @author Dave Syer 29 | */ 30 | @Deprecated 31 | public interface SignatureSecret extends Serializable { 32 | } 33 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/OAuthSecurityContext.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.consumer; 2 | 3 | 4 | import java.util.Map; 5 | 6 | /** 7 | * The OAuth 2 security context (for a specific user). 8 | * 9 | *

10 | * @deprecated The OAuth 1.0 Protocol RFC 5849 is obsoleted by the OAuth 2.0 Authorization Framework RFC 6749. 11 | * 12 | * @author Ryan Heaton 13 | */ 14 | @Deprecated 15 | public interface OAuthSecurityContext { 16 | 17 | /** 18 | * Get the access tokens for the current context. 19 | * 20 | * @return The access tokens for the current context. The key to the map is the {@link ProtectedResourceDetails#getId() id of the protected resource} 21 | * for which the access token is valid. 22 | */ 23 | Map getAccessTokens(); 24 | 25 | /** 26 | * Any details for this security this context. 27 | * 28 | * @return Any details for this security context. 29 | */ 30 | Object getDetails(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/OAuthSecurityContextHolder.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.consumer; 2 | 3 | /** 4 | * Holder for the current OAuth security context. 5 | * 6 | *

7 | * @deprecated The OAuth 1.0 Protocol RFC 5849 is obsoleted by the OAuth 2.0 Authorization Framework RFC 6749. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | @Deprecated 12 | public class OAuthSecurityContextHolder { 13 | 14 | private static final ThreadLocal CURRENT_CONTEXT = new ThreadLocal(); 15 | 16 | public static OAuthSecurityContext getContext() { 17 | return CURRENT_CONTEXT.get(); 18 | } 19 | 20 | public static void setContext(OAuthSecurityContext context) { 21 | CURRENT_CONTEXT.set(context); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/OAuthSecurityContextImpl.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.consumer; 2 | 3 | 4 | import java.util.Map; 5 | 6 | /** 7 | *

8 | * @deprecated The OAuth 1.0 Protocol RFC 5849 is obsoleted by the OAuth 2.0 Authorization Framework RFC 6749. 9 | * 10 | * @author Ryan Heaton 11 | */ 12 | @Deprecated 13 | public class OAuthSecurityContextImpl implements OAuthSecurityContext { 14 | 15 | private Map accessTokens; 16 | private Object details; 17 | 18 | public Map getAccessTokens() { 19 | return accessTokens; 20 | } 21 | 22 | public void setAccessTokens(Map accessTokens) { 23 | this.accessTokens = accessTokens; 24 | } 25 | 26 | public Object getDetails() { 27 | return details; 28 | } 29 | 30 | public void setDetails(Object details) { 31 | this.details = details; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/java/org/springframework/security/oauth/provider/token/OAuthTokenLifecycleListener.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.provider.token; 2 | 3 | /** 4 | * Interface for listening to the lifecycle of a token. 5 | * 6 | *

7 | * @deprecated The OAuth 1.0 Protocol RFC 5849 is obsoleted by the OAuth 2.0 Authorization Framework RFC 6749. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | @Deprecated 12 | public interface OAuthTokenLifecycleListener { 13 | 14 | /** 15 | * Lifecycle event for a created token. 16 | * 17 | * @param token The created token. 18 | */ 19 | void tokenCreated(OAuthProviderToken token); 20 | 21 | /** 22 | * Lifecycle event for an expired token. 23 | * 24 | * @param token The expired token. 25 | */ 26 | void tokenExpired(OAuthProviderToken token); 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/java/org/springframework/security/oauth/provider/token/OAuthTokenLifecycleRegistry.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.provider.token; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | 5 | import java.util.Collection; 6 | 7 | /** 8 | * Interface for a registry of token lifecycle listeners. 9 | * 10 | *

11 | * @deprecated The OAuth 1.0 Protocol RFC 5849 is obsoleted by the OAuth 2.0 Authorization Framework RFC 6749. 12 | * 13 | * @author Ryan Heaton 14 | */ 15 | @Deprecated 16 | public interface OAuthTokenLifecycleRegistry { 17 | 18 | /** 19 | * The collection of lifecycle listeners for this registry. 20 | * 21 | * @return The collection of lifecycle listeners for this registry. 22 | */ 23 | Collection getLifecycleListeners(); 24 | 25 | /** 26 | * Register lifecycle listener(s) with this registry. 27 | * 28 | * @param lifecycleListeners The listeners. 29 | */ 30 | @Autowired ( required = false ) 31 | void register(OAuthTokenLifecycleListener... lifecycleListeners); 32 | } -------------------------------------------------------------------------------- /spring-security-oauth/src/main/java/org/springframework/security/oauth/provider/verifier/OAuthVerifierServices.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.provider.verifier; 2 | 3 | /** 4 | * Service for generating a verifier. 5 | * 6 | *

7 | * @deprecated The OAuth 1.0 Protocol RFC 5849 is obsoleted by the OAuth 2.0 Authorization Framework RFC 6749. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | @Deprecated 12 | public interface OAuthVerifierServices { 13 | 14 | /** 15 | * Create a verifier. 16 | * 17 | * @return The verifier. 18 | */ 19 | String createVerifier(); 20 | } 21 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/resources/META-INF/spring.handlers: -------------------------------------------------------------------------------- 1 | http\://www.springframework.org/schema/security/oauth=org.springframework.security.oauth.config.OAuthSecurityNamespaceHandler 2 | -------------------------------------------------------------------------------- /spring-security-oauth/src/main/resources/META-INF/spring.schemas: -------------------------------------------------------------------------------- 1 | https\://www.springframework.org/schema/security/spring-security-oauth-1.0.xsd=org/springframework/security/oauth/spring-security-oauth-1.0.xsd 2 | https\://www.springframework.org/schema/security/spring-security-oauth.xsd=org/springframework/security/oauth/spring-security-oauth-1.0.xsd 3 | -------------------------------------------------------------------------------- /spring-security-oauth/src/test/java/org/springframework/security/oauth/config/FilterChainInitializationTests.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth.config; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNotNull; 5 | 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.security.oauth.common.signature.SharedConsumerSecret; 10 | import org.springframework.security.oauth.provider.ConsumerDetails; 11 | import org.springframework.security.oauth.provider.ConsumerDetailsService; 12 | import org.springframework.test.context.ContextConfiguration; 13 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 14 | 15 | @ContextConfiguration 16 | @RunWith(SpringJUnit4ClassRunner.class) 17 | public class FilterChainInitializationTests { 18 | 19 | @Autowired 20 | private ConsumerDetailsService clientDetailsService; 21 | 22 | @Test 23 | public void testClientDetailsFromPropertyFile() { 24 | ConsumerDetails consumer = clientDetailsService.loadConsumerByConsumerKey("my-client-key"); 25 | assertNotNull(consumer); 26 | assertEquals("my-client-secret", ((SharedConsumerSecret)consumer.getSignatureSecret()).getConsumerSecret()); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-security-oauth/src/test/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl 2 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -------------------------------------------------------------------------------- /spring-security-oauth/src/test/resources/data.sql: -------------------------------------------------------------------------------- 1 | select * from oauth_client_details; -------------------------------------------------------------------------------- /spring-security-oauth/src/test/resources/org/springframework/security/oauth/config/igoogle.cert: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDBDCCAm2gAwIBAgIJAK8dGINfkSTHMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV 3 | BAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzETMBEG 4 | A1UEChMKR29vZ2xlIEluYzEXMBUGA1UEAxMOd3d3Lmdvb2dsZS5jb20wHhcNMDgx 5 | MDA4MDEwODMyWhcNMDkxMDA4MDEwODMyWjBgMQswCQYDVQQGEwJVUzELMAkGA1UE 6 | CBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxEzARBgNVBAoTCkdvb2dsZSBJ 7 | bmMxFzAVBgNVBAMTDnd3dy5nb29nbGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN 8 | ADCBiQKBgQDQUV7ukIfIixbokHONGMW9+ed0E9X4m99I8upPQp3iAtqIvWs7XCbA 9 | bGqzQH1qX9Y00hrQ5RRQj8OI3tRiQs/KfzGWOdvLpIk5oXpdT58tg4FlYh5fbhIo 10 | VoVn4GvtSjKmJFsoM8NRtEJHL1aWd++dXzkQjEsNcBXwQvfDb0YnbQIDAQABo4HF 11 | MIHCMB0GA1UdDgQWBBSm/h1pNY91bNfW08ac9riYzs3cxzCBkgYDVR0jBIGKMIGH 12 | gBSm/h1pNY91bNfW08ac9riYzs3cx6FkpGIwYDELMAkGA1UEBhMCVVMxCzAJBgNV 13 | BAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUg 14 | SW5jMRcwFQYDVQQDEw53d3cuZ29vZ2xlLmNvbYIJAK8dGINfkSTHMAwGA1UdEwQF 15 | MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAYpHTr3vQNsHHHUm4MkYcDB20a5KvcFoX 16 | gCcYtmdyd8rh/FKeZm2me7eQCXgBfJqQ4dvVLJ4LgIQiU3R5ZDe0WbW7rJ3M9ADQ 17 | FyQoRJP8OIMYW3BoMi0Z4E730KSLRh6kfLq4rK6vw7lkH9oynaHHWZSJLDAp17cP 18 | j+6znWkN9/g= 19 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /spring-security-oauth/src/test/resources/schema.sql: -------------------------------------------------------------------------------- 1 | -- used in tests that use HSQL 2 | create table oauth_client_details ( 3 | client_id VARCHAR(256) PRIMARY KEY, 4 | client_secret VARCHAR(256), 5 | scope VARCHAR(256), 6 | authorized_grant_types VARCHAR(256), 7 | web_server_redirect_uri VARCHAR(256), 8 | authorities VARCHAR(256) 9 | ); 10 | 11 | create table oauth_access_token ( 12 | token_id VARCHAR(256), 13 | token LONGVARBINARY, 14 | authentication LONGVARBINARY, 15 | refresh_token VARCHAR(256) 16 | ); 17 | 18 | create table oauth_refresh_token ( 19 | token_id VARCHAR(256), 20 | token LONGVARBINARY, 21 | authentication LONGVARBINARY 22 | ); 23 | 24 | create table oauth_code ( 25 | code VARCHAR(256), authentication LONGVARBINARY 26 | ); 27 | -------------------------------------------------------------------------------- /spring-security-oauth/src/test/resources/simplelog.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.simplelog.defaultlog=warn 2 | #org.apache.commons.logging.simplelog.log.org.springframework.security=debug 3 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/client/token/grant/client/ClientCredentialsResourceDetails.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.client.token.grant.client; 2 | 3 | import org.springframework.security.oauth2.client.resource.BaseOAuth2ProtectedResourceDetails; 4 | 5 | /** 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Dave Syer 10 | */ 11 | @Deprecated 12 | public class ClientCredentialsResourceDetails extends BaseOAuth2ProtectedResourceDetails { 13 | 14 | public ClientCredentialsResourceDetails() { 15 | setGrantType("client_credentials"); 16 | } 17 | 18 | @Override 19 | public boolean isClientOnly() { 20 | return true; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/client/token/grant/code/AuthorizationCodeResourceDetails.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.client.token.grant.code; 2 | 3 | import org.springframework.security.oauth2.client.token.grant.redirect.AbstractRedirectResourceDetails; 4 | 5 | /** 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Ryan Heaton 10 | * @author Dave Syer 11 | */ 12 | @Deprecated 13 | public class AuthorizationCodeResourceDetails extends AbstractRedirectResourceDetails { 14 | 15 | public AuthorizationCodeResourceDetails() { 16 | setGrantType("authorization_code"); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/client/token/grant/implicit/ImplicitResourceDetails.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.client.token.grant.implicit; 2 | 3 | import org.springframework.security.oauth2.client.token.grant.redirect.AbstractRedirectResourceDetails; 4 | 5 | /** 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Dave Syer 10 | */ 11 | @Deprecated 12 | public class ImplicitResourceDetails extends AbstractRedirectResourceDetails { 13 | 14 | public ImplicitResourceDetails() { 15 | setGrantType("implicit"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/DefaultExpiringOAuth2RefreshToken.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | @Deprecated 12 | public class DefaultExpiringOAuth2RefreshToken extends DefaultOAuth2RefreshToken implements ExpiringOAuth2RefreshToken { 13 | 14 | private static final long serialVersionUID = 3449554332764129719L; 15 | 16 | private final Date expiration; 17 | 18 | /** 19 | * @param value 20 | */ 21 | public DefaultExpiringOAuth2RefreshToken(String value, Date expiration) { 22 | super(value); 23 | this.expiration = expiration; 24 | } 25 | 26 | /** 27 | * The instant the token expires. 28 | * 29 | * @return The instant the token expires. 30 | */ 31 | public Date getExpiration() { 32 | return expiration; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/DefaultThrowableAnalyzer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common; 2 | 3 | import org.springframework.security.web.util.ThrowableAnalyzer; 4 | import org.springframework.security.web.util.ThrowableCauseExtractor; 5 | 6 | import javax.servlet.ServletException; 7 | 8 | /** 9 | * Default implementation of ThrowableAnalyzer which is capable of also unwrapping 10 | * ServletExceptions. 11 | * 12 | *

13 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 14 | */ 15 | @Deprecated 16 | public final class DefaultThrowableAnalyzer extends ThrowableAnalyzer { 17 | /** 18 | * @see org.springframework.security.web.util.ThrowableAnalyzer#initExtractorMap() 19 | */ 20 | protected void initExtractorMap() { 21 | super.initExtractorMap(); 22 | 23 | registerExtractor(ServletException.class, new ThrowableCauseExtractor() { 24 | public Throwable extractCause(Throwable throwable) { 25 | ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); 26 | return ((ServletException) throwable).getRootCause(); 27 | } 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/ExpiringOAuth2RefreshToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.oauth2.common; 14 | 15 | import java.util.Date; 16 | 17 | /** 18 | *

19 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 20 | * 21 | * @author Dave Syer 22 | * 23 | */ 24 | @Deprecated 25 | public interface ExpiringOAuth2RefreshToken extends OAuth2RefreshToken { 26 | 27 | Date getExpiration(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/OAuth2RefreshToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.oauth2.common; 14 | 15 | import com.fasterxml.jackson.annotation.JsonValue; 16 | 17 | /** 18 | *

19 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 20 | * 21 | * @author Dave Syer 22 | * 23 | */ 24 | @Deprecated 25 | public interface OAuth2RefreshToken { 26 | 27 | /** 28 | * The value of the token. 29 | * 30 | * @return The value of the token. 31 | */ 32 | @JsonValue 33 | String getValue(); 34 | 35 | } -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/BadClientCredentialsException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | * Exception thrown when a client was unable to authenticate. 5 | * 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Ryan Heaton 10 | * @author Dave Syer 11 | */ 12 | @SuppressWarnings("serial") 13 | @Deprecated 14 | public class BadClientCredentialsException extends ClientAuthenticationException { 15 | 16 | public BadClientCredentialsException() { 17 | super("Bad client credentials"); // Don't reveal source of error 18 | } 19 | 20 | @Override 21 | public int getHttpErrorCode() { 22 | return 401; 23 | } 24 | 25 | @Override 26 | public String getOAuth2ErrorCode() { 27 | return "invalid_client"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/ClientAuthenticationException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | * Base exception 5 | * 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Ryan Heaton 10 | * @author Dave Syer 11 | */ 12 | @SuppressWarnings("serial") 13 | @Deprecated 14 | public abstract class ClientAuthenticationException extends OAuth2Exception { 15 | 16 | public ClientAuthenticationException(String msg, Throwable t) { 17 | super(msg, t); 18 | } 19 | 20 | public ClientAuthenticationException(String msg) { 21 | super(msg); 22 | } 23 | 24 | @Override 25 | public int getHttpErrorCode() { 26 | // The spec says this is a bad request (not unauthorized) 27 | return 400; 28 | } 29 | 30 | @Override 31 | public abstract String getOAuth2ErrorCode(); 32 | } 33 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/InvalidClientException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | * Exception thrown when a client was unable to authenticate. 5 | * 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Ryan Heaton 10 | * @author Dave Syer 11 | */ 12 | @SuppressWarnings("serial") 13 | @Deprecated 14 | public class InvalidClientException extends ClientAuthenticationException { 15 | 16 | public InvalidClientException(String msg) { 17 | super(msg); 18 | } 19 | 20 | @Override 21 | public int getHttpErrorCode() { 22 | return 401; 23 | } 24 | 25 | @Override 26 | public String getOAuth2ErrorCode() { 27 | return "invalid_client"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/InvalidGrantException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | *

5 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 6 | * 7 | * @author Ryan Heaton 8 | * @author Dave Syer 9 | */ 10 | @SuppressWarnings("serial") 11 | @Deprecated 12 | public class InvalidGrantException extends ClientAuthenticationException { 13 | 14 | public InvalidGrantException(String msg, Throwable t) { 15 | super(msg, t); 16 | } 17 | 18 | public InvalidGrantException(String msg) { 19 | super(msg); 20 | } 21 | 22 | @Override 23 | public String getOAuth2ErrorCode() { 24 | return "invalid_grant"; 25 | } 26 | } -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/InvalidRequestException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | *

5 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 6 | * 7 | * @author Dave Syer 8 | */ 9 | @SuppressWarnings("serial") 10 | @Deprecated 11 | public class InvalidRequestException extends ClientAuthenticationException { 12 | 13 | public InvalidRequestException(String msg, Throwable t) { 14 | super(msg, t); 15 | } 16 | 17 | public InvalidRequestException(String msg) { 18 | super(msg); 19 | } 20 | 21 | @Override 22 | public String getOAuth2ErrorCode() { 23 | return "invalid_request"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/RedirectMismatchException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | *

5 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 6 | * 7 | * @author Ryan Heaton 8 | */ 9 | @SuppressWarnings("serial") 10 | @Deprecated 11 | public class RedirectMismatchException extends ClientAuthenticationException { 12 | 13 | public RedirectMismatchException(String msg, Throwable t) { 14 | super(msg, t); 15 | } 16 | 17 | public RedirectMismatchException(String msg) { 18 | super(msg); 19 | } 20 | 21 | @Override 22 | public String getOAuth2ErrorCode() { 23 | return "invalid_grant"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/SerializationException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | * Thrown during a problem serialization/deserialization. 5 | * 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | @SuppressWarnings("serial") 12 | @Deprecated 13 | public class SerializationException extends RuntimeException { 14 | 15 | public SerializationException() { 16 | } 17 | 18 | public SerializationException(String message) { 19 | super(message); 20 | } 21 | 22 | public SerializationException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public SerializationException(Throwable cause) { 27 | super(cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/UnapprovedClientAuthenticationException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | import org.springframework.security.authentication.InsufficientAuthenticationException; 4 | 5 | /** 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | @SuppressWarnings("serial") 12 | @Deprecated 13 | public class UnapprovedClientAuthenticationException extends InsufficientAuthenticationException { 14 | 15 | public UnapprovedClientAuthenticationException(String msg) { 16 | super(msg); 17 | } 18 | 19 | public UnapprovedClientAuthenticationException(String msg, Throwable t) { 20 | super(msg, t); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/UnauthorizedClientException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | * Exception thrown when a client was unable to authenticate. 5 | * 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Ryan Heaton 10 | */ 11 | @SuppressWarnings("serial") 12 | @Deprecated 13 | public class UnauthorizedClientException extends ClientAuthenticationException { 14 | 15 | public UnauthorizedClientException(String msg, Throwable t) { 16 | super(msg, t); 17 | } 18 | 19 | public UnauthorizedClientException(String msg) { 20 | super(msg); 21 | } 22 | 23 | @Override 24 | public int getHttpErrorCode() { 25 | // The spec says this can be unauthorized 26 | return 401; 27 | } 28 | 29 | @Override 30 | public String getOAuth2ErrorCode() { 31 | return "unauthorized_client"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/UnauthorizedUserException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | * Exception thrown when a user was unable to authenticate. 5 | * 6 | *

7 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 8 | * 9 | * @author Dave Syer 10 | */ 11 | @SuppressWarnings("serial") 12 | @Deprecated 13 | public class UnauthorizedUserException extends OAuth2Exception { 14 | 15 | public UnauthorizedUserException(String msg, Throwable t) { 16 | super(msg, t); 17 | } 18 | 19 | public UnauthorizedUserException(String msg) { 20 | super(msg); 21 | } 22 | 23 | @Override 24 | public int getHttpErrorCode() { 25 | // The spec says this can be unauthorized 26 | return 401; 27 | } 28 | 29 | @Override 30 | public String getOAuth2ErrorCode() { 31 | // Not in the spec 32 | return "unauthorized_user"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/UnsupportedGrantTypeException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | *

5 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 6 | * 7 | * @author Ryan Heaton 8 | */ 9 | @SuppressWarnings("serial") 10 | @Deprecated 11 | public class UnsupportedGrantTypeException extends OAuth2Exception { 12 | 13 | public UnsupportedGrantTypeException(String msg, Throwable t) { 14 | super(msg, t); 15 | } 16 | 17 | public UnsupportedGrantTypeException(String msg) { 18 | super(msg); 19 | } 20 | 21 | @Override 22 | public String getOAuth2ErrorCode() { 23 | return "unsupported_grant_type"; 24 | } 25 | } -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/UnsupportedResponseTypeException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | *

5 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 6 | * 7 | * @author Ryan Heaton 8 | */ 9 | @SuppressWarnings("serial") 10 | @Deprecated 11 | public class UnsupportedResponseTypeException extends OAuth2Exception { 12 | 13 | public UnsupportedResponseTypeException(String msg, Throwable t) { 14 | super(msg, t); 15 | } 16 | 17 | public UnsupportedResponseTypeException(String msg) { 18 | super(msg); 19 | } 20 | 21 | @Override 22 | public String getOAuth2ErrorCode() { 23 | return "unsupported_response_type"; 24 | } 25 | } -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/UserDeniedAuthorizationException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.common.exceptions; 2 | 3 | /** 4 | *

5 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 6 | * 7 | * @author Ryan Heaton 8 | */ 9 | @SuppressWarnings("serial") 10 | @Deprecated 11 | public class UserDeniedAuthorizationException extends OAuth2Exception { 12 | 13 | public UserDeniedAuthorizationException(String msg, Throwable t) { 14 | super(msg, t); 15 | } 16 | 17 | public UserDeniedAuthorizationException(String msg) { 18 | super(msg); 19 | } 20 | 21 | @Override 22 | public String getOAuth2ErrorCode() { 23 | return "access_denied"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/code/InMemoryAuthorizationCodeServices.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.provider.code; 2 | 3 | import java.util.concurrent.ConcurrentHashMap; 4 | 5 | import org.springframework.security.oauth2.provider.OAuth2Authentication; 6 | 7 | /** 8 | * Implementation of authorization code services that stores the codes and authentication in memory. 9 | * 10 | *

11 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 12 | * 13 | * @author Ryan Heaton 14 | * @author Dave Syer 15 | */ 16 | @Deprecated 17 | public class InMemoryAuthorizationCodeServices extends RandomValueAuthorizationCodeServices { 18 | 19 | protected final ConcurrentHashMap authorizationCodeStore = new ConcurrentHashMap(); 20 | 21 | @Override 22 | protected void store(String code, OAuth2Authentication authentication) { 23 | this.authorizationCodeStore.put(code, authentication); 24 | } 25 | 26 | @Override 27 | public OAuth2Authentication remove(String code) { 28 | OAuth2Authentication auth = this.authorizationCodeStore.remove(code); 29 | return auth; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/ExactMatchRedirectResolver.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.provider.endpoint; 2 | 3 | 4 | 5 | /** 6 | * Strict implementation for a redirect resolver which requires 7 | * an exact match between the registered and requested redirect_uri. 8 | * 9 | *

10 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 11 | * 12 | * @author Ryan Heaton 13 | * @author Dave Syer 14 | */ 15 | @Deprecated 16 | public class ExactMatchRedirectResolver extends DefaultRedirectResolver { 17 | 18 | /** 19 | * Whether the requested redirect URI "matches" the specified redirect URI. This implementation tests strict 20 | * equality. 21 | * 22 | * @param requestedRedirect The requested redirect URI. 23 | * @param redirectUri The registered redirect URI. 24 | * @return Whether the requested redirect URI "matches" the specified redirect URI. 25 | */ 26 | protected boolean redirectMatches(String requestedRedirect, String redirectUri) { 27 | return requestedRedirect.equals(redirectUri); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/RedirectResolver.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.provider.endpoint; 2 | 3 | import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; 4 | import org.springframework.security.oauth2.provider.ClientDetails; 5 | 6 | /** 7 | * Basic interface for determining the redirect URI for a user agent. 8 | * 9 | *

10 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 11 | * 12 | * @author Ryan Heaton 13 | */ 14 | @Deprecated 15 | public interface RedirectResolver { 16 | 17 | /** 18 | * Resolve the redirect for the specified client. 19 | * 20 | * @param requestedRedirect The redirect that was requested (may not be null). 21 | * @param client The client for which we're resolving the redirect. 22 | * @return The resolved redirect URI. 23 | * @throws OAuth2Exception If the requested redirect is invalid for the specified client. 24 | */ 25 | String resolveRedirect(String requestedRedirect, ClientDetails client) throws OAuth2Exception; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/implicit/InMemoryImplicitGrantService.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.provider.implicit; 2 | 3 | import java.util.concurrent.ConcurrentHashMap; 4 | 5 | import org.springframework.security.oauth2.provider.OAuth2Request; 6 | import org.springframework.security.oauth2.provider.TokenRequest; 7 | 8 | /** 9 | * In-memory implementation of the ImplicitGrantService. 10 | * 11 | *

12 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 13 | * 14 | * @author Amanda Anganes 15 | * 16 | */ 17 | @SuppressWarnings("deprecation") 18 | @Deprecated 19 | public class InMemoryImplicitGrantService implements ImplicitGrantService { 20 | 21 | protected final ConcurrentHashMap requestStore = new ConcurrentHashMap(); 22 | 23 | public void store(OAuth2Request originalRequest, TokenRequest tokenRequest) { 24 | this.requestStore.put(tokenRequest, originalRequest); 25 | } 26 | 27 | public OAuth2Request remove(TokenRequest tokenRequest) { 28 | OAuth2Request request = this.requestStore.remove(tokenRequest); 29 | return request; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/ConsumerTokenServices.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.springframework.security.oauth2.provider.token; 14 | 15 | 16 | /** 17 | *

18 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 19 | * 20 | * @author Dave Syer 21 | * 22 | */ 23 | @Deprecated 24 | public interface ConsumerTokenServices { 25 | 26 | boolean revokeToken(String tokenValue); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/store/redis/RedisTokenStoreSerializationStrategy.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.provider.token.store.redis; 2 | 3 | /** 4 | *

5 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 6 | * 7 | * @author efenderbosch 8 | */ 9 | @Deprecated 10 | public interface RedisTokenStoreSerializationStrategy { 11 | 12 | T deserialize(byte[] bytes, Class clazz); 13 | 14 | String deserializeString(byte[] bytes); 15 | 16 | byte[] serialize(Object object); 17 | 18 | byte[] serialize(String data); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/store/redis/StandardStringSerializationStrategy.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.provider.token.store.redis; 2 | 3 | import org.springframework.data.redis.serializer.StringRedisSerializer; 4 | 5 | /** 6 | * Serializes Strings using {@link StringRedisSerializer} 7 | * 8 | *

9 | * @deprecated See the OAuth 2.0 Migration Guide for Spring Security 5. 10 | * 11 | * @author efenderbosch 12 | * 13 | */ 14 | @Deprecated 15 | public abstract class StandardStringSerializationStrategy extends BaseRedisTokenStoreSerializationStrategy { 16 | 17 | private static final StringRedisSerializer STRING_SERIALIZER = new StringRedisSerializer(); 18 | 19 | @Override 20 | protected String deserializeStringInternal(byte[] bytes) { 21 | return STRING_SERIALIZER.deserialize(bytes); 22 | } 23 | 24 | @Override 25 | protected byte[] serializeInternal(String string) { 26 | return STRING_SERIALIZER.serialize(string); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/resources/META-INF/spring.handlers: -------------------------------------------------------------------------------- 1 | http\://www.springframework.org/schema/security/oauth2=org.springframework.security.oauth2.config.xml.OAuth2SecurityNamespaceHandler -------------------------------------------------------------------------------- /spring-security-oauth2/src/main/resources/META-INF/spring.schemas: -------------------------------------------------------------------------------- 1 | https\://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd=org/springframework/security/oauth2/spring-security-oauth2-1.0.xsd 2 | https\://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd=org/springframework/security/oauth2/spring-security-oauth2-2.0.xsd 3 | https\://www.springframework.org/schema/security/spring-security-oauth2.xsd=org/springframework/security/oauth2/spring-security-oauth2-2.0.xsd -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/java/org/company/oauth2/CustomOAuth2AccessToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.company.oauth2; 18 | 19 | import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; 20 | 21 | public class CustomOAuth2AccessToken extends DefaultOAuth2AccessToken { 22 | 23 | public CustomOAuth2AccessToken(String value) { 24 | super(value); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/java/org/company/oauth2/CustomOAuth2Authentication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.company.oauth2; 18 | 19 | import org.springframework.security.core.Authentication; 20 | import org.springframework.security.oauth2.provider.OAuth2Authentication; 21 | import org.springframework.security.oauth2.provider.OAuth2Request; 22 | 23 | public class CustomOAuth2Authentication extends OAuth2Authentication { 24 | 25 | public CustomOAuth2Authentication( 26 | OAuth2Request storedRequest, 27 | Authentication userAuthentication) { 28 | super(storedRequest, userAuthentication); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/java/org/springframework/security/oauth2/client/DefaultOAuth2ClientContextTests.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.client; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertNull; 7 | 8 | public class DefaultOAuth2ClientContextTests { 9 | 10 | @Test 11 | public void resetsState() { 12 | DefaultOAuth2ClientContext clientContext = new DefaultOAuth2ClientContext(); 13 | clientContext.setPreservedState("state1", "some-state-1"); 14 | clientContext.setPreservedState("state2", "some-state-2"); 15 | clientContext.setPreservedState("state3", "some-state-3"); 16 | assertNull(clientContext.removePreservedState("state1")); 17 | assertNull(clientContext.removePreservedState("state2")); 18 | assertEquals("some-state-3", clientContext.removePreservedState("state3")); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/java/org/springframework/security/oauth2/provider/approval/InMemoryApprovalStoreTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.security.oauth2.provider.approval; 18 | 19 | /** 20 | * @author Dave Syer 21 | * 22 | */ 23 | public class InMemoryApprovalStoreTests extends AbstractTestApprovalStore { 24 | 25 | private ApprovalStore store = new InMemoryApprovalStore(); 26 | 27 | @Override 28 | protected ApprovalStore getApprovalStore() { 29 | return store ; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/java/org/springframework/security/oauth2/provider/code/InMemoryAuthorizationCodeServicesTests.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.provider.code; 2 | 3 | import org.junit.Before; 4 | 5 | public class InMemoryAuthorizationCodeServicesTests extends AuthorizationCodeServicesBaseTests { 6 | 7 | private InMemoryAuthorizationCodeServices authorizationCodeServices; 8 | 9 | @Before 10 | public void setUp() throws Exception { 11 | authorizationCodeServices = new InMemoryAuthorizationCodeServices(); 12 | } 13 | 14 | @Override 15 | AuthorizationCodeServices getAuthorizationCodeServices() { 16 | return authorizationCodeServices; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/java/org/springframework/security/oauth2/provider/token/DefaultTokenServicesWithJdbcTests.java: -------------------------------------------------------------------------------- 1 | package org.springframework.security.oauth2.provider.token; 2 | 3 | import org.junit.After; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; 6 | import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; 7 | import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; 8 | 9 | /** 10 | * @author Dave Syer 11 | * 12 | */ 13 | public class DefaultTokenServicesWithJdbcTests extends AbstractPersistentDefaultTokenServicesTests { 14 | 15 | private EmbeddedDatabase db; 16 | 17 | protected TokenStore createTokenStore() { 18 | db = new EmbeddedDatabaseBuilder().addDefaultScripts().build(); 19 | return new JdbcTokenStore(db); 20 | } 21 | 22 | @After 23 | public void tearDown() throws Exception { 24 | db.shutdown(); 25 | } 26 | 27 | 28 | protected int getAccessTokenCount() { 29 | return new JdbcTemplate(db).queryForObject("SELECT COUNT(*) FROM OAUTH_ACCESS_TOKEN", Integer.class); 30 | } 31 | 32 | protected int getRefreshTokenCount() { 33 | return new JdbcTemplate(db).queryForObject("SELECT COUNT(*) FROM OAUTH_REFRESH_TOKEN", Integer.class); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl 2 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/data.sql: -------------------------------------------------------------------------------- 1 | select * from oauth_client_details; -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/spring-security-oauth2/src/test/resources/keystore.jks -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/org/springframework/security/oauth2/config/xml/authorization-server-check-token-custom-endpoint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/org/springframework/security/oauth2/config/xml/authorization-server-check-token.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/org/springframework/security/oauth2/config/xml/authorization-server-custom-grant.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/org/springframework/security/oauth2/config/xml/authorization-server-disable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/org/springframework/security/oauth2/config/xml/authorization-server-invalid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/org/springframework/security/oauth2/config/xml/authorization-server-vanilla.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/org/springframework/security/oauth2/provider/token/store/jwk/jwk-set.json: -------------------------------------------------------------------------------- 1 | { 2 | "keys": [ 3 | { 4 | "kid": "_Ci3-VfV_N0YAG22NQOgOUpFBDDcDe_rJxpu5JK702o", 5 | "kty": "RSA", 6 | "alg": "RS256", 7 | "use": "sig", 8 | "n": "rne3dowbQHcFCzg2ejWb6az5QNxWFiv6kRpd34VDzYNMhWeewfeEL5Pf5clE8Xh1KlllrDYSxtnzUQm-t9p92yEBASfV96ydTYG-ITfxfJzKtJUN-iIS5K9WGYXnDNS4eYZ_ygW-zBU_9NwFMXdwSTzRqHeJmLJrfbmmjoIuuWyfh2Ko52KzyidceR5SJxGeW0ckeyWka1lDf4cr7fv-s093Y_sd2wrNvg0-9IAkXotbxWWXcfMgXFyw0qHFT_5LrKmiwkY3HCaiV5NgEFJmC6fBIG2EOZG4rqjBoYV6LZwrfTMHknaeel9MOZesW6SR2bswtuuWN3DGq2zg0KamLw", 9 | "e": "AQAB" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/org/springframework/security/oauth2/provider/token/store/jwk/token.jwt: -------------------------------------------------------------------------------- 1 | eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJfQ2kzLVZmVl9OMFlBRzIyTlFPZ09VcEZCRERjRGVfckp4cHU1Sks3MDJvIn0.eyJqdGkiOiIzOWQxMmU1NC00MjliLTRkZjUtOTM2OS01YWVlOTFkNzAwZjgiLCJleHAiOjE0ODg5MDk1NzMsIm5iZiI6MCwiaWF0IjoxNDg4OTA5MjczLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgxODAvYXV0aC9yZWFsbXMvRGVtbyIsImF1ZCI6ImJvb3QtYXBwIiwic3ViIjoiNGM5NjE5NDQtN2VkZC00ZDZiLTg2MGUtYmJiZGNhODk0MDU4IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiYm9vdC1hcHAiLCJhdXRoX3RpbWUiOjE0ODg5MDkyNzMsInNlc3Npb25fc3RhdGUiOiJiMjdjMDZlNi02ODgwLTQxZTEtOTM2MS1jZmEzYzY2ZjYyNjAiLCJhY3IiOiIxIiwiY2xpZW50X3Nlc3Npb24iOiIyYjA5NTFiOC1iMjdkLTRlYWMtYjUxOC1kZTQ5OTA5OTY2ZDgiLCJhbGxvd2VkLW9yaWdpbnMiOltdLCJyZXNvdXJjZV9hY2Nlc3MiOnsiYm9vdC1hcGkiOnsicm9sZXMiOlsiYm9vdC1hcGktcm9sZSJdfSwiYm9vdC1hcHAiOnsicm9sZXMiOlsiYm9vdC1yb2xlIl19fSwibmFtZSI6IkFsaWNlICIsInByZWZlcnJlZF91c2VybmFtZSI6ImFsaWNlIiwiZ2l2ZW5fbmFtZSI6IkFsaWNlIiwiZmFtaWx5X25hbWUiOiIiLCJlbWFpbCI6ImFsaWNlQGV4YW1wbGUubmV0In0.NfF5rPMabu8gaigUHZnX3gIzNGAxKpmPP206U5keNtexNqsmQEFO4KT2i1JYLwvNVFnRWCa8FmYokAtzeHgLvHk2B8CZXqL6GSMGQ26wPS5RIFTak9HjfHMhodqSIdy4wZTKmEcum_uYTaCdrVRSfWU8l94xAY6OzwElZX5ulkucvgWQnpFs0HB7X54kB07OqpN8L3i1jeQoEV0iJchtxZiEOSipqMNO7cujMqB_6lf9i78URPuyExfeLzAWyDbMWSJBp3zUoS7HakwE_4oC3eVEYTxDtMRL2yl2_8R0C0g2Dc0Qb9aezFxo3-SDNuy9aicDmibEEOpIoetlrIYbNA -------------------------------------------------------------------------------- /spring-security-oauth2/src/test/resources/simplelog.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.simplelog.defaultlog=warn 2 | #org.apache.commons.logging.simplelog.log.org.springframework.security=debug 3 | -------------------------------------------------------------------------------- /src/site/apt/index.apt: -------------------------------------------------------------------------------- 1 | --- 2 | Home 3 | --- 4 | Ryan Heaton 5 | Dave Syer 6 | --- 7 | 8 | Welcome 9 | 10 | Welcome to OAuth for Spring Security! This is the static 11 | auto-generated site, including Javadocs and project reports (see 12 | sidebar). For user and develeoper documentation please see the 13 | readmes in the source code and the 14 | {{{https://github.com/spring-projects/spring-security-oauth/wiki}wiki}} 15 | on the Github site. 16 | -------------------------------------------------------------------------------- /tests/annotation/approval/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server. 3 | 4 | For the Authorization Server you need to `@EnableAuthorizationServer` 5 | and also configure at least one client registration 6 | (`OAuth2ClientDetails`). You can see this is the bulk of 7 | `Application.java`. 8 | 9 | An `AuthenticationManager` is created by Spring Boot (it has a single 10 | user, named "user", with password "password", per 11 | `application.yml`). It is needed in the Authorization Server to 12 | provide authentication for the Resource Owner Password grant type. 13 | 14 | For the Resource Server all that is needed is the 15 | `@EnableResourceServer` annotation. By default it protects all 16 | resources that are not explicitly ignored and not exposed by the 17 | `AuthorizationEndpoint` (if there is an Authorization Server in the 18 | same application). 19 | -------------------------------------------------------------------------------- /tests/annotation/approval/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: approval 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | -------------------------------------------------------------------------------- /tests/annotation/approval/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 11 | public class ApplicationTests { 12 | 13 | @Test 14 | public void contextLoads() { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /tests/annotation/approval/src/test/java/demo/AuthorizationCodeProviderTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package demo; 14 | 15 | import static org.junit.Assert.assertTrue; 16 | 17 | import sparklr.common.AbstractAuthorizationCodeProviderTests; 18 | 19 | /** 20 | * @author Dave Syer 21 | */ 22 | public class AuthorizationCodeProviderTests extends AbstractAuthorizationCodeProviderTests { 23 | 24 | protected void verifyAuthorizationPage(String page) { 25 | assertTrue(page.contains("action=\"/oauth/authorize\"")); 26 | assertTrue(page.contains(" 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/client/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an OAuth2 Client. 3 | -------------------------------------------------------------------------------- /tests/annotation/client/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: client 4 | server: 5 | port: 8081 6 | # use a different path for the client (otherwise cookies are shared) 7 | context_path: /client 8 | security: 9 | basic: 10 | enabled: false 11 | oauth2: 12 | resource: 13 | filter-order: 3 14 | -------------------------------------------------------------------------------- /tests/annotation/client/src/test/java/client/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package client; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT, classes=ClientApplication.class) 11 | public class ApplicationTests { 12 | 13 | @Test 14 | public void contextLoads() { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /tests/annotation/client/src/test/resources/application-combined.properties: -------------------------------------------------------------------------------- 1 | server.port: 8080 2 | server.context_path: 3 | security.basic.enabled: true 4 | security.user.password: password 5 | security.ignored: /,/admin/info 6 | # logging.level.org.springframework.security: DEBUG -------------------------------------------------------------------------------- /tests/annotation/client/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/common/README.md: -------------------------------------------------------------------------------- 1 | This project contains test utilities for the other projects, for 2 | instance `HttpUtils` for accessing RESTful resources and several 3 | `Abstract*Tests` base classes for testing the basic operations of an 4 | OAuth2 provider. 5 | -------------------------------------------------------------------------------- /tests/annotation/common/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/common/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/custom-authentication/README.md: -------------------------------------------------------------------------------- 1 | This project tests a basic authorization server configuration, with a custom authentication filter on the `TokenEndpoint`. 2 | The authentication mechanism only authorizes one fixed client to pass. The client_id is taken from an HTTP parameter. 3 | 4 | -------------------------------------------------------------------------------- /tests/annotation/custom-authentication/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | logging: 13 | level: 14 | # org.springframework.security: DEBUG -------------------------------------------------------------------------------- /tests/annotation/custom-authentication/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/annotation/custom-authentication/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/custom-grant/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server with a custom grant type. 3 | 4 | For the Authorization Server you need to `@EnableAuthorizationServer` 5 | and also configure at least one client registration 6 | (`OAuth2ClientDetails`). You can see this is the bulk of 7 | `Application.java`. 8 | 9 | An `AuthenticationManager` is created by Spring Boot (it has a single 10 | user, named "user", with password "password", per 11 | `application.yml`). It is needed in the Authorization Server to 12 | provide authentication for the Resource Owner Password grant type. 13 | -------------------------------------------------------------------------------- /tests/annotation/custom-grant/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | logging: 13 | level: 14 | # org.springframework.security: DEBUG -------------------------------------------------------------------------------- /tests/annotation/custom-grant/src/test/java/demo/AdHocTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 20013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.junit.Ignore; 17 | import org.junit.runner.RunWith; 18 | import org.junit.runners.Suite; 19 | import org.junit.runners.Suite.SuiteClasses; 20 | 21 | /** 22 | * @author Dave Syer 23 | * 24 | */ 25 | @RunWith(Suite.class) 26 | // @formatter:off 27 | @SuiteClasses({ 28 | RefreshTokenSupportTests.class 29 | }) 30 | // @formatter:on 31 | @Ignore("Test suite for tracking order dependencies") 32 | public class AdHocTests { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /tests/annotation/custom-grant/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/annotation/custom-grant/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractClientCredentialsProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/annotation/custom-grant/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import sparklr.common.AbstractProtectedResourceTests; 17 | 18 | /** 19 | * @author Dave Syer 20 | * 21 | */ 22 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tests/annotation/custom-grant/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractRefreshTokenSupportTests; 4 | 5 | /** 6 | * @author Ryan Heaton 7 | * @author Dave Syer 8 | */ 9 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/custom-grant/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/custom-grant/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/form/README.md: -------------------------------------------------------------------------------- 1 | In this project the Authorization Server allows form-based 2 | authentication on the /oauth/token endpoint. This is not best 3 | practice from a security point of view so it is disabled by default. 4 | 5 | In the Authorization Server we call `allowFormAuthenticationForClients()` 6 | on the configurer. That's it. 7 | 8 | -------------------------------------------------------------------------------- /tests/annotation/form/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: form 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | logging: 13 | level: 14 | org.springframework.security: WARN 15 | -------------------------------------------------------------------------------- /tests/annotation/form/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/annotation/form/src/test/java/demo/AuthorizationCodeProviderTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package demo; 14 | 15 | import sparklr.common.AbstractAuthorizationCodeProviderTests; 16 | 17 | /** 18 | * @author Dave Syer 19 | */ 20 | public class AuthorizationCodeProviderTests extends AbstractAuthorizationCodeProviderTests { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /tests/annotation/form/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractImplicitProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/form/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import sparklr.common.AbstractProtectedResourceTests; 17 | 18 | /** 19 | * @author Dave Syer 20 | * 21 | */ 22 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tests/annotation/form/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractRefreshTokenSupportTests; 4 | 5 | /** 6 | * @author Ryan Heaton 7 | * @author Dave Syer 8 | */ 9 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/form/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.security.oauth2.client.resource.BaseOAuth2ProtectedResourceDetails; 4 | import org.springframework.security.oauth2.client.test.BeforeOAuth2Context; 5 | import org.springframework.security.oauth2.common.AuthenticationScheme; 6 | 7 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 8 | 9 | /** 10 | * @author Dave Syer 11 | */ 12 | public class ResourceOwnerPasswordProviderTests extends 13 | AbstractResourceOwnerPasswordProviderTests { 14 | 15 | @BeforeOAuth2Context 16 | public void tweakClientAuthentication() { 17 | ((BaseOAuth2ProtectedResourceDetails)context.getResource()) 18 | .setClientAuthenticationScheme(AuthenticationScheme.form); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /tests/annotation/form/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/jaxb/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server with XML serialization 3 | of access tokens and error responses. 4 | 5 | You need to teach Spring how to serialize `OAuth2AccessTokens` and 6 | `OAuth2Exceptions` using the converters provided in Spring OAuth. The 7 | steps to do this can be seen in the server (`Application` configuration) 8 | and also in the client (where we inject `HttpMessageConverters` into the 9 | `RestTemplate` used to access resources in the integration tests). -------------------------------------------------------------------------------- /tests/annotation/jaxb/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | -------------------------------------------------------------------------------- /tests/annotation/jaxb/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/annotation/jaxb/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import org.springframework.http.client.ClientHttpRequestInterceptor; 7 | import org.springframework.http.converter.HttpMessageConverter; 8 | 9 | import sparklr.common.AbstractClientCredentialsProviderTests; 10 | 11 | /** 12 | * @author Dave Syer 13 | */ 14 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 15 | 16 | @Override 17 | protected Collection> getAdditionalConverters() { 18 | return Converters.getJaxbConverters(); 19 | } 20 | 21 | @Override 22 | protected List getInterceptors() { 23 | return Converters.getInterceptors(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /tests/annotation/jaxb/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import java.util.Collection; 17 | 18 | import org.springframework.http.converter.HttpMessageConverter; 19 | 20 | import sparklr.common.AbstractProtectedResourceTests; 21 | 22 | /** 23 | * @author Dave Syer 24 | * 25 | */ 26 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 27 | 28 | @Override 29 | protected Collection> getAdditionalConverters() { 30 | return Converters.getJaxbConverters(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /tests/annotation/jaxb/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.http.converter.HttpMessageConverter; 6 | 7 | import sparklr.common.AbstractRefreshTokenSupportTests; 8 | 9 | /** 10 | * @author Ryan Heaton 11 | * @author Dave Syer 12 | */ 13 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 14 | 15 | @Override 16 | protected Collection> getAdditionalConverters() { 17 | return Converters.getJaxbConverters(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/annotation/jaxb/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.http.converter.HttpMessageConverter; 6 | 7 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 8 | 9 | /** 10 | * @author Dave Syer 11 | */ 12 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 13 | 14 | @Override 15 | protected Collection> getAdditionalConverters() { 16 | return Converters.getJaxbConverters(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tests/annotation/jaxb/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/jdbc/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server with JDBC backends. 3 | 4 | The Authorization Server has JDBC backends for clients 5 | (`ClientDetailsStore`), tokens (`TokenStore`), authorization codes 6 | (`AuthorizationCodeStore`) and user accounts 7 | (`UserDetailsManager`). Even with these services, a horizontally 8 | scaled Authorization Server needs to be fronted by a load balancer 9 | with sticky sessions (or else a Spring `SessionAttributeStore` should 10 | be provided in addition to wht you see here), if the stateful grant 11 | types are used (authorization code or implicit). 12 | 13 | An `AuthenticationManager` is created (it has a single user, named 14 | "user", with password "password", per `application.yml`). It is needed 15 | in the Authorization Server to provide authentication for the Resource 16 | Owner Password grant type. 17 | 18 | The Resource Server shares the `TokenStore` with the Authorization 19 | Server, but it doesn't need to know about the other services (so they 20 | could be in-memory if there is a single instance of the Authorization 21 | Server). 22 | -------------------------------------------------------------------------------- /tests/annotation/jdbc/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: jdbc 4 | management: 5 | context_path: /admin 6 | security: 7 | oauth2: 8 | resource: 9 | filter-order: 3 10 | logging: 11 | level: 12 | # org.springframework.security: DEBUG 13 | 14 | --- 15 | 16 | spring: 17 | profiles: client 18 | server: 19 | port: 8081 -------------------------------------------------------------------------------- /tests/annotation/jdbc/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.security.oauth2.provider.ClientDetailsService; 8 | import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService; 9 | import org.springframework.security.oauth2.provider.token.TokenStore; 10 | import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; 11 | import org.springframework.test.context.ContextConfiguration; 12 | 13 | import sparklr.common.AbstractIntegrationTests; 14 | 15 | @ContextConfiguration(classes=Application.class) 16 | public class ApplicationTests extends AbstractIntegrationTests { 17 | 18 | @Autowired 19 | private TokenStore tokenStore; 20 | 21 | @Autowired 22 | private ClientDetailsService clientDetailsService; 23 | 24 | @Test 25 | public void contextLoads() { 26 | assertTrue("Wrong token store type: " + tokenStore, tokenStore instanceof JdbcTokenStore); 27 | assertTrue("Wrong client details type: " + clientDetailsService, clientDetailsService.toString().contains(JdbcClientDetailsService.class.getName())); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /tests/annotation/jdbc/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.test.context.ContextConfiguration; 4 | 5 | import sparklr.common.AbstractClientCredentialsProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @ContextConfiguration(classes=Application.class) 11 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/annotation/jdbc/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.test.context.ContextConfiguration; 4 | 5 | import sparklr.common.AbstractImplicitProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @ContextConfiguration(classes=Application.class) 11 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 12 | 13 | protected String getPassword() { 14 | return "secret"; 15 | } 16 | 17 | protected String getUsername() { 18 | return "dave"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /tests/annotation/jdbc/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.springframework.test.context.ContextConfiguration; 17 | 18 | import sparklr.common.AbstractProtectedResourceTests; 19 | 20 | /** 21 | * @author Dave Syer 22 | * 23 | */ 24 | @ContextConfiguration(classes=Application.class) 25 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/annotation/jdbc/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.test.context.ContextConfiguration; 4 | 5 | import sparklr.common.AbstractRefreshTokenSupportTests; 6 | 7 | /** 8 | * @author Ryan Heaton 9 | * @author Dave Syer 10 | */ 11 | @ContextConfiguration(classes=Application.class) 12 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 13 | protected String getPassword() { 14 | return "secret"; 15 | } 16 | 17 | protected String getUsername() { 18 | return "dave"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/annotation/jdbc/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/jdbc/src/test/resources/test.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url: jdbc:h2:mem:otherdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE -------------------------------------------------------------------------------- /tests/annotation/jpa/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server with JDBC backends. 3 | 4 | The Authorization Server has JDBC backends for clients 5 | (`ClientDetailsStore`), tokens (`TokenStore`), authorization codes 6 | (`AuthorizationCodeStore`) and user accounts 7 | (`UserDetailsManager`). Even with these services, a horizontally 8 | scaled Authorization Server needs to be fronted by a load balancer 9 | with sticky sessions (or else a Spring `SessionAttributeStore` should 10 | be provided in addition to wht you see here), if the stateful grant 11 | types are used (authorization code or implicit). 12 | 13 | An `AuthenticationManager` is created (it has a single user, named 14 | "user", with password "password", per `application.yml`). It is needed 15 | in the Authorization Server to provide authentication for the Resource 16 | Owner Password grant type. 17 | 18 | The Resource Server shares the `TokenStore` with the Authorization 19 | Server, but it doesn't need to know about the other services (so they 20 | could be in-memory if there is a single instance of the Authorization 21 | Server). 22 | -------------------------------------------------------------------------------- /tests/annotation/jpa/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: jpa 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | logging: 13 | level: 14 | # org.springframework.security: DEBUG 15 | -------------------------------------------------------------------------------- /tests/annotation/jpa/src/test/java/demo/AdHocTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 20013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.junit.Ignore; 17 | import org.junit.runner.RunWith; 18 | import org.junit.runners.Suite; 19 | import org.junit.runners.Suite.SuiteClasses; 20 | 21 | /** 22 | * @author Dave Syer 23 | * 24 | */ 25 | @RunWith(Suite.class) 26 | // @formatter:off 27 | @SuiteClasses({ 28 | RefreshTokenSupportTests.class, 29 | AuthorizationCodeProviderCookieTests.class 30 | }) 31 | // @formatter:on 32 | @Ignore("Test suite for tracking order dependencies") 33 | public class AdHocTests { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /tests/annotation/jpa/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/annotation/jpa/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractClientCredentialsProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/annotation/jpa/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import sparklr.common.AbstractProtectedResourceTests; 17 | 18 | /** 19 | * @author Dave Syer 20 | * 21 | */ 22 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tests/annotation/jpa/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractRefreshTokenSupportTests; 4 | 5 | /** 6 | * @author Ryan Heaton 7 | * @author Dave Syer 8 | */ 9 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/jpa/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/jpa/src/test/resources/test.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url: jdbc:h2:mem:otherdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE -------------------------------------------------------------------------------- /tests/annotation/jwt/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server. 3 | 4 | For the Authorization Server you need to `@EnableAuthorizationServer` 5 | and also configure at least one client registration 6 | (`OAuth2ClientDetails`). You can see this is the bulk of 7 | `Application.java`. 8 | 9 | An `AuthenticationManager` is created by Spring Boot (it has a single 10 | user, named "user", with password "password", per 11 | `application.yml`). It is needed in the Authorization Server to 12 | provide authentication for the Resource Owner Password grant type. 13 | 14 | For the Resource Server all that is needed is the 15 | `@EnableResourceServer` annotation. By default it protects all 16 | resources that are not explicitly ignored and not exposed by the 17 | `AuthorizationEndpoint` (if there is an Authorization Server in the 18 | same application). 19 | -------------------------------------------------------------------------------- /tests/annotation/jwt/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | logging: 13 | level: 14 | # org.springframework.security: DEBUG -------------------------------------------------------------------------------- /tests/annotation/jwt/src/test/java/demo/AuthorizationCodeProviderTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package demo; 14 | 15 | import sparklr.common.AbstractAuthorizationCodeProviderTests; 16 | 17 | /** 18 | * @author Dave Syer 19 | */ 20 | public class AuthorizationCodeProviderTests extends AbstractAuthorizationCodeProviderTests { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /tests/annotation/jwt/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractImplicitProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/jwt/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import sparklr.common.AbstractProtectedResourceTests; 17 | 18 | /** 19 | * @author Dave Syer 20 | * 21 | */ 22 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tests/annotation/jwt/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/mappings/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server with different 3 | endpoint paths than the defaults. 4 | 5 | For the Authorization Server, in addition to the basic "vanilla" 6 | features, we add mappings from "/oauth/token" to "/token" for 7 | instance. The target values for the mappings are injected using 8 | `@Value`, largely to make it easier to test them. You can see this is 9 | the bulk of `Application.java`. 10 | 11 | For the Resource Server, in this app we change the default protected 12 | resource patterns to "/" and "/admin/beans". The rest of the app is 13 | protected by HTTP Basic security by default because of the Spring Boot 14 | autoconfiguration features (this is verified in a test case 15 | `ProtectedResourceTests`). We also add an access rule (scope='read' is 16 | required to access both OAuth2 resources). 17 | -------------------------------------------------------------------------------- /tests/annotation/mappings/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: mappings 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | logging: 13 | level: 14 | # org.springframework.security: DEBUG 15 | oauth: 16 | paths: 17 | token: /token 18 | authorize: /authorize 19 | confirm: /approve 20 | check_token: /decode 21 | token_key: /key -------------------------------------------------------------------------------- /tests/annotation/mappings/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/annotation/mappings/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractImplicitProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/mappings/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractRefreshTokenSupportTests; 4 | 5 | /** 6 | * @author Ryan Heaton 7 | * @author Dave Syer 8 | */ 9 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/mappings/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/mappings/src/test/java/demo/ServletPathClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.Map; 6 | 7 | import org.junit.Test; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 10 | import org.springframework.boot.test.web.client.TestRestTemplate; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.http.ResponseEntity; 13 | 14 | import sparklr.common.AbstractClientCredentialsProviderTests; 15 | 16 | /** 17 | * @author Dave Syer 18 | */ 19 | @SpringBootTest(classes=Application.class, properties="server.servlet_path:/server", webEnvironment=WebEnvironment.RANDOM_PORT) 20 | public class ServletPathClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 21 | 22 | @Test 23 | public void testTokenKey() throws Exception { 24 | @SuppressWarnings("rawtypes") 25 | ResponseEntity response = new TestRestTemplate("my-client-with-secret", "secret").getForEntity( 26 | http.getUrl(tokenKeyPath()), Map.class); 27 | // This app has no token key. 28 | assertEquals(HttpStatus.FORBIDDEN, response.getStatusCode()); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /tests/annotation/mappings/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/multi/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and multiple Resource Servers in the 3 | same app. 4 | 5 | For the Resource Server all that is needed is the 6 | `@EnableResourceServer` annotation. By default it protects all 7 | resources that are not explicitly ignored and not exposed by the 8 | `AuthorizationEndpoint` (if there is an Authorization Server in the 9 | same application). 10 | -------------------------------------------------------------------------------- /tests/annotation/multi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | logging: 10 | level: 11 | # org.springframework.security: DEBUG -------------------------------------------------------------------------------- /tests/annotation/multi/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/annotation/multi/src/test/java/demo/AuthorizationCodeProviderTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package demo; 14 | 15 | import sparklr.common.AbstractAuthorizationCodeProviderTests; 16 | 17 | /** 18 | * @author Dave Syer 19 | */ 20 | public class AuthorizationCodeProviderTests extends AbstractAuthorizationCodeProviderTests { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /tests/annotation/multi/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractClientCredentialsProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/annotation/multi/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractImplicitProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/multi/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractRefreshTokenSupportTests; 4 | 5 | /** 6 | * @author Ryan Heaton 7 | * @author Dave Syer 8 | */ 9 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/multi/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.Arrays; 6 | 7 | import org.junit.Test; 8 | import org.springframework.http.HttpStatus; 9 | import org.springframework.security.oauth2.client.test.OAuth2ContextConfiguration; 10 | 11 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 12 | 13 | /** 14 | * @author Dave Syer 15 | */ 16 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 17 | 18 | @Test 19 | @OAuth2ContextConfiguration(OtherResourceOwner.class) 20 | public void testTokenObtainedWithHeaderAuthenticationAndOtherResource() throws Exception { 21 | assertEquals(HttpStatus.OK, http.getStatusCode("/")); 22 | } 23 | 24 | static class OtherResourceOwner extends ResourceOwner implements DoNotOverride { 25 | public OtherResourceOwner(Object target) { 26 | super(target); 27 | setClientId("my-other-client-with-secret"); 28 | setClientSecret("secret"); 29 | setScope(Arrays.asList("trust")); 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /tests/annotation/multi/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/resource/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up a Resource Server. 3 | 4 | All that is needed is the 5 | `@EnableResourceServer` annotation and a `TokenStore`. By default it protects all 6 | resources that are not explicitly ignored. 7 | -------------------------------------------------------------------------------- /tests/annotation/resource/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | -------------------------------------------------------------------------------- /tests/annotation/resource/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /tests/annotation/resource/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import sparklr.common.AbstractProtectedResourceTests; 17 | 18 | /** 19 | * @author Dave Syer 20 | * 21 | */ 22 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tests/annotation/resource/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/ssl/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server. 3 | 4 | For the Authorization Server you need to `@EnableAuthorizationServer` 5 | and also configure at least one client registration 6 | (`OAuth2ClientDetails`). You can see this is the bulk of 7 | `Application.java`. 8 | 9 | An `AuthenticationManager` is created by Spring Boot (it has a single 10 | user, named "user", with password "password", per 11 | `application.yml`). It is needed in the Authorization Server to 12 | provide authentication for the Resource Owner Password grant type. 13 | 14 | For the Resource Server all that is needed is the 15 | `@EnableResourceServer` annotation. By default it protects all 16 | resources that are not explicitly ignored and not exposed by the 17 | `AuthorizationEndpoint` (if there is an Authorization Server in the 18 | same application). 19 | -------------------------------------------------------------------------------- /tests/annotation/ssl/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | logging: 10 | level: 11 | # org.springframework.security: DEBUG 12 | server: 13 | port: 8443 14 | ssl: 15 | key-store: classpath:sample.jks 16 | key-store-password: secret 17 | key-password: password 18 | -------------------------------------------------------------------------------- /tests/annotation/ssl/src/main/resources/sample.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/spring-security-oauth/0344de8cc75055742f638b1e476a646a6f5891d9/tests/annotation/ssl/src/main/resources/sample.jks -------------------------------------------------------------------------------- /tests/annotation/ssl/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = Application.class) 12 | @WebAppConfiguration 13 | @IntegrationTest("server.port=0") 14 | public class ApplicationTests { 15 | 16 | @Test 17 | public void contextLoads() { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/annotation/ssl/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractClientCredentialsProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/annotation/ssl/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.springframework.boot.test.SpringApplicationConfiguration; 17 | 18 | import sparklr.common.AbstractProtectedResourceTests; 19 | 20 | /** 21 | * @author Dave Syer 22 | * 23 | */ 24 | @SpringApplicationConfiguration(classes = Application.class) 25 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/annotation/ssl/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractRefreshTokenSupportTests; 6 | 7 | /** 8 | * @author Ryan Heaton 9 | * @author Dave Syer 10 | */ 11 | @SpringApplicationConfiguration(classes=Application.class) 12 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 13 | } 14 | -------------------------------------------------------------------------------- /tests/annotation/ssl/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes = Application.class) 11 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/annotation/ssl/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/annotation/vanilla/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server. 3 | 4 | For the Authorization Server you need to `@EnableAuthorizationServer` 5 | and also configure at least one client registration 6 | (`OAuth2ClientDetails`). You can see this is the bulk of 7 | `Application.java`. 8 | 9 | An `AuthenticationManager` is created by Spring Boot (it has a single 10 | user, named "user", with password "password", per 11 | `application.yml`). It is needed in the Authorization Server to 12 | provide authentication for the Resource Owner Password grant type. 13 | 14 | For the Resource Server all that is needed is the 15 | `@EnableResourceServer` annotation. By default it protects all 16 | resources that are not explicitly ignored and not exposed by the 17 | `AuthorizationEndpoint` (if there is an Authorization Server in the 18 | same application). 19 | -------------------------------------------------------------------------------- /tests/annotation/vanilla/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | oauth2: 10 | resource: 11 | filter-order: 3 12 | logging: 13 | level: 14 | org.springframework.security: WARN -------------------------------------------------------------------------------- /tests/annotation/vanilla/src/test/java/demo/AdHocTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 20013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.junit.Ignore; 17 | import org.junit.runner.RunWith; 18 | import org.junit.runners.Suite; 19 | import org.junit.runners.Suite.SuiteClasses; 20 | 21 | /** 22 | * @author Dave Syer 23 | * 24 | */ 25 | @RunWith(Suite.class) 26 | // @formatter:off 27 | @SuiteClasses({ 28 | RefreshTokenSupportTests.class, 29 | AuthorizationCodeProviderCookieTests.class 30 | }) 31 | // @formatter:on 32 | @Ignore("Test suite for tracking order dependencies") 33 | public class AdHocTests { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /tests/annotation/vanilla/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | 9 | @RunWith(SpringJUnit4ClassRunner.class) 10 | @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) 11 | public class ApplicationTests { 12 | 13 | @Test 14 | public void contextLoads() { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /tests/annotation/vanilla/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractClientCredentialsProviderTests; 4 | 5 | /** 6 | * @author Dave Syer 7 | */ 8 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/annotation/vanilla/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import sparklr.common.AbstractProtectedResourceTests; 17 | 18 | /** 19 | * @author Dave Syer 20 | * 21 | */ 22 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tests/annotation/vanilla/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import sparklr.common.AbstractRefreshTokenSupportTests; 4 | 5 | /** 6 | * @author Ryan Heaton 7 | * @author Dave Syer 8 | */ 9 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 10 | } 11 | -------------------------------------------------------------------------------- /tests/annotation/vanilla/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/xml/approval/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server. 3 | 4 | For the Authorization Server you need to `@EnableAuthorizationServer` 5 | and also configure at least one client registration 6 | (`OAuth2ClientDetails`). You can see this is the bulk of 7 | `Application.java`. 8 | 9 | An `AuthenticationManager` is created by Spring Boot (it has a single 10 | user, named "user", with password "password", per 11 | `application.yml`). It is needed in the Authorization Server to 12 | provide authentication for the Resource Owner Password grant type. 13 | 14 | For the Resource Server all that is needed is the 15 | `@EnableResourceServer` annotation. By default it protects all 16 | resources that are not explicitly ignored and not exposed by the 17 | `AuthorizationEndpoint` (if there is an Authorization Server in the 18 | same application). 19 | -------------------------------------------------------------------------------- /tests/xml/approval/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: approval 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | -------------------------------------------------------------------------------- /tests/xml/approval/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = Application.class) 12 | @WebAppConfiguration 13 | @IntegrationTest("server.port=0") 14 | public class ApplicationTests { 15 | 16 | @Test 17 | public void contextLoads() { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/xml/approval/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractClientCredentialsProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/xml/approval/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractImplicitProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/approval/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.springframework.boot.test.SpringApplicationConfiguration; 17 | 18 | import sparklr.common.AbstractProtectedResourceTests; 19 | 20 | /** 21 | * @author Dave Syer 22 | * 23 | */ 24 | @SpringApplicationConfiguration(classes = Application.class) 25 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/xml/approval/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractRefreshTokenSupportTests; 6 | 7 | /** 8 | * @author Ryan Heaton 9 | * @author Dave Syer 10 | */ 11 | @SpringApplicationConfiguration(classes=Application.class) 12 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/approval/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/client/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an OAuth2 Client. 3 | -------------------------------------------------------------------------------- /tests/xml/client/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: client 4 | server: 5 | port: 8081 6 | # use a different path for the client (otherwise cookies are shared) 7 | context_path: /client 8 | security: 9 | basic: 10 | enabled: false 11 | -------------------------------------------------------------------------------- /tests/xml/client/src/main/resources/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /tests/xml/client/src/test/java/client/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package client; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = ClientApplication.class) 12 | @WebAppConfiguration 13 | @IntegrationTest("server.port=0") 14 | public class ApplicationTests { 15 | 16 | @Test 17 | public void contextLoads() { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/xml/client/src/test/resources/application-combined.properties: -------------------------------------------------------------------------------- 1 | server.port: 8080 2 | server.context_path: 3 | security.basic.enabled: true 4 | security.user.password: password 5 | security.ignored: /,/admin/info -------------------------------------------------------------------------------- /tests/xml/common/README.md: -------------------------------------------------------------------------------- 1 | This project contains test utilities for the other projects, for 2 | instance `HttpUtils` for accessing RESTful resources and several 3 | `Abstract*Tests` base classes for testing the basic operations of an 4 | OAuth2 provider. 5 | -------------------------------------------------------------------------------- /tests/xml/common/src/main/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl 2 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -------------------------------------------------------------------------------- /tests/xml/common/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/xml/common/src/main/resources/simplelog.properties: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.simplelog.defaultlog=warn 2 | #org.apache.commons.logging.simplelog.log.org.springframework.security=debug 3 | -------------------------------------------------------------------------------- /tests/xml/common/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/xml/form/README.md: -------------------------------------------------------------------------------- 1 | In this project the Authorization Server allows form-based 2 | authentication on the /oauth/token endpoint. This is not best 3 | practice from a security point of view so it is disabled by default. 4 | 5 | In the Authorization Server we call `allowFormAuthenticationForClients()` 6 | on the configurer. That's it. 7 | 8 | -------------------------------------------------------------------------------- /tests/xml/form/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: form 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | -------------------------------------------------------------------------------- /tests/xml/form/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = Application.class) 12 | @WebAppConfiguration 13 | @IntegrationTest("server.port=0") 14 | public class ApplicationTests { 15 | 16 | @Test 17 | public void contextLoads() { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/xml/form/src/test/java/demo/AuthorizationCodeProviderTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package demo; 14 | 15 | import org.springframework.boot.test.SpringApplicationConfiguration; 16 | 17 | import sparklr.common.AbstractAuthorizationCodeProviderTests; 18 | 19 | /** 20 | * @author Dave Syer 21 | */ 22 | @SpringApplicationConfiguration(classes = Application.class) 23 | public class AuthorizationCodeProviderTests extends AbstractAuthorizationCodeProviderTests { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /tests/xml/form/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractImplicitProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/form/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.springframework.boot.test.SpringApplicationConfiguration; 17 | 18 | import sparklr.common.AbstractProtectedResourceTests; 19 | 20 | /** 21 | * @author Dave Syer 22 | * 23 | */ 24 | @SpringApplicationConfiguration(classes = Application.class) 25 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/xml/form/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractRefreshTokenSupportTests; 6 | 7 | /** 8 | * @author Ryan Heaton 9 | * @author Dave Syer 10 | */ 11 | @SpringApplicationConfiguration(classes=Application.class) 12 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/form/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/jdbc/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server with JDBC backends. 3 | 4 | The Authorization Server has JDBC backends for clients 5 | (`ClientDetailsStore`), tokens (`TokenStore`), authorization codes 6 | (`AuthorizationCodeStore`) and user accounts 7 | (`UserDetailsManager`). Even with these services, a horizontally 8 | scaled Authorization Server needs to be fronted by a load balancer 9 | with sticky sessions (or else a Spring `SessionAttributeStore` should 10 | be provided in addition to wht you see here), if the stateful grant 11 | types are used (authorization code or implicit). 12 | 13 | An `AuthenticationManager` is created (it has a single user, named 14 | "user", with password "password", per `application.yml`). It is needed 15 | in the Authorization Server to provide authentication for the Resource 16 | Owner Password grant type. 17 | 18 | The Resource Server shares the `TokenStore` with the Authorization 19 | Server, but it doesn't need to know about the other services (so they 20 | could be in-memory if there is a single instance of the Authorization 21 | Server). 22 | -------------------------------------------------------------------------------- /tests/xml/jdbc/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: jdbc 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | logging: 10 | level: 11 | # org.springframework.security: WARN 12 | # org.springframework.web: DEBUG 13 | # org.springframework.jdbc: DEBUG 14 | 15 | --- 16 | 17 | spring: 18 | profiles: client 19 | server: 20 | port: 8081 -------------------------------------------------------------------------------- /tests/xml/jdbc/src/main/resources/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/xml/jdbc/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.IntegrationTest; 9 | import org.springframework.boot.test.SpringApplicationConfiguration; 10 | import org.springframework.security.oauth2.provider.token.TokenStore; 11 | import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; 12 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 13 | import org.springframework.test.context.web.WebAppConfiguration; 14 | 15 | @RunWith(SpringJUnit4ClassRunner.class) 16 | @SpringApplicationConfiguration(classes = Application.class) 17 | @WebAppConfiguration 18 | @IntegrationTest("server.port=0") 19 | public class ApplicationTests { 20 | 21 | @Autowired 22 | private TokenStore tokenStore; 23 | 24 | @Test 25 | public void contextLoads() { 26 | assertTrue("Wrong token store type: " + tokenStore, tokenStore instanceof JdbcTokenStore); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /tests/xml/jdbc/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractClientCredentialsProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/xml/jdbc/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractImplicitProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/jdbc/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.springframework.boot.test.SpringApplicationConfiguration; 17 | 18 | import sparklr.common.AbstractProtectedResourceTests; 19 | 20 | /** 21 | * @author Dave Syer 22 | * 23 | */ 24 | @SpringApplicationConfiguration(classes = Application.class) 25 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/xml/jdbc/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractRefreshTokenSupportTests; 6 | 7 | /** 8 | * @author Ryan Heaton 9 | * @author Dave Syer 10 | */ 11 | @SpringApplicationConfiguration(classes=Application.class) 12 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/jdbc/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/jdbc/src/test/resources/test.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url: jdbc:h2:mem:otherdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE -------------------------------------------------------------------------------- /tests/xml/jwt/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server. 3 | 4 | For the Authorization Server you need to `@EnableAuthorizationServer` 5 | and also configure at least one client registration 6 | (`OAuth2ClientDetails`). You can see this is the bulk of 7 | `Application.java`. 8 | 9 | An `AuthenticationManager` is created by Spring Boot (it has a single 10 | user, named "user", with password "password", per 11 | `application.yml`). It is needed in the Authorization Server to 12 | provide authentication for the Resource Owner Password grant type. 13 | 14 | For the Resource Server all that is needed is the 15 | `@EnableResourceServer` annotation. By default it protects all 16 | resources that are not explicitly ignored and not exposed by the 17 | `AuthorizationEndpoint` (if there is an Authorization Server in the 18 | same application). 19 | -------------------------------------------------------------------------------- /tests/xml/jwt/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | -------------------------------------------------------------------------------- /tests/xml/jwt/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.IntegrationTest; 9 | import org.springframework.boot.test.SpringApplicationConfiguration; 10 | import org.springframework.security.oauth2.provider.token.TokenStore; 11 | import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; 12 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 13 | import org.springframework.test.context.web.WebAppConfiguration; 14 | 15 | @RunWith(SpringJUnit4ClassRunner.class) 16 | @SpringApplicationConfiguration(classes = Application.class) 17 | @WebAppConfiguration 18 | @IntegrationTest("server.port=0") 19 | public class ApplicationTests { 20 | 21 | @Autowired 22 | private TokenStore tokenStore; 23 | 24 | @Test 25 | public void contextLoads() { 26 | assertTrue("Wrong token store type: " + tokenStore, tokenStore instanceof JwtTokenStore); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /tests/xml/jwt/src/test/java/demo/AuthorizationCodeProviderTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package demo; 14 | 15 | import org.springframework.boot.test.SpringApplicationConfiguration; 16 | 17 | import sparklr.common.AbstractAuthorizationCodeProviderTests; 18 | 19 | /** 20 | * @author Dave Syer 21 | */ 22 | @SpringApplicationConfiguration(classes = Application.class) 23 | public class AuthorizationCodeProviderTests extends AbstractAuthorizationCodeProviderTests { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /tests/xml/jwt/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractClientCredentialsProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/xml/jwt/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractImplicitProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/jwt/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.springframework.boot.test.SpringApplicationConfiguration; 17 | 18 | import sparklr.common.AbstractProtectedResourceTests; 19 | 20 | /** 21 | * @author Dave Syer 22 | * 23 | */ 24 | @SpringApplicationConfiguration(classes = Application.class) 25 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/xml/jwt/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.security.oauth2.common.OAuth2AccessToken; 6 | 7 | import sparklr.common.AbstractRefreshTokenSupportTests; 8 | 9 | /** 10 | * @author Ryan Heaton 11 | * @author Dave Syer 12 | */ 13 | @SpringApplicationConfiguration(classes=Application.class) 14 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 15 | 16 | protected void verifyAccessTokens(OAuth2AccessToken oldAccessToken, OAuth2AccessToken newAccessToken) { 17 | // make sure the new access token can be used. 18 | verifyTokenResponse(newAccessToken.getValue(), HttpStatus.OK); 19 | // the old access token is still valid because there is no state on the server. 20 | verifyTokenResponse(oldAccessToken.getValue(), HttpStatus.OK); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /tests/xml/jwt/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/mappings/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server with different 3 | endpoint paths than the defaults. 4 | 5 | For the Authorization Server, in addition to the basic "vanilla" 6 | features, we add mappings from "/oauth/token" to "/token" for 7 | instance. The target values for the mappings are injected using 8 | `@Value`, largely to make it easier to test them. You can see this is 9 | the bulk of `Application.java`. 10 | 11 | For the Resource Server, in this app we change the default protected 12 | resource patterns to "/" and "/admin/beans". The rest of the app is 13 | protected by HTTP Basic security by default because of the Spring Boot 14 | autoconfiguration features (this is verified in a test case 15 | `ProtectedResourceTests`). We also add an access rule (scope='read' is 16 | required to access both OAuth2 resources). 17 | -------------------------------------------------------------------------------- /tests/xml/mappings/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: mappings 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | 10 | oauth: 11 | paths: 12 | token: /token 13 | authorize: /authorize 14 | confirm: forward:/approve -------------------------------------------------------------------------------- /tests/xml/mappings/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = Application.class) 12 | @WebAppConfiguration 13 | @IntegrationTest("server.port=0") 14 | public class ApplicationTests { 15 | 16 | @Test 17 | public void contextLoads() { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/xml/mappings/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractClientCredentialsProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/xml/mappings/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractImplicitProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/mappings/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractRefreshTokenSupportTests; 6 | 7 | /** 8 | * @author Ryan Heaton 9 | * @author Dave Syer 10 | */ 11 | @SpringApplicationConfiguration(classes=Application.class) 12 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/mappings/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/vanilla/README.md: -------------------------------------------------------------------------------- 1 | This project shows what you can do with the minimum configuration to 2 | set up an Authorization Server and Resource Server. 3 | 4 | For the Authorization Server you need to `@EnableAuthorizationServer` 5 | and also configure at least one client registration 6 | (`OAuth2ClientDetails`). You can see this is the bulk of 7 | `Application.java`. 8 | 9 | An `AuthenticationManager` is created by Spring Boot (it has a single 10 | user, named "user", with password "password", per 11 | `application.yml`). It is needed in the Authorization Server to 12 | provide authentication for the Resource Owner Password grant type. 13 | 14 | For the Resource Server all that is needed is the 15 | `@EnableResourceServer` annotation. By default it protects all 16 | resources that are not explicitly ignored and not exposed by the 17 | `AuthorizationEndpoint` (if there is an Authorization Server in the 18 | same application). 19 | -------------------------------------------------------------------------------- /tests/xml/vanilla/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vanilla 4 | management: 5 | context_path: /admin 6 | security: 7 | user: 8 | password: password 9 | -------------------------------------------------------------------------------- /tests/xml/vanilla/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = Application.class) 12 | @WebAppConfiguration 13 | @IntegrationTest("server.port=0") 14 | public class ApplicationTests { 15 | 16 | @Test 17 | public void contextLoads() { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tests/xml/vanilla/src/test/java/demo/AuthorizationCodeProviderTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package demo; 14 | 15 | import org.springframework.boot.test.SpringApplicationConfiguration; 16 | 17 | import sparklr.common.AbstractAuthorizationCodeProviderTests; 18 | 19 | /** 20 | * @author Dave Syer 21 | */ 22 | @SpringApplicationConfiguration(classes = Application.class) 23 | public class AuthorizationCodeProviderTests extends AbstractAuthorizationCodeProviderTests { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /tests/xml/vanilla/src/test/java/demo/ClientCredentialsProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractClientCredentialsProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ClientCredentialsProviderTests extends AbstractClientCredentialsProviderTests { 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/xml/vanilla/src/test/java/demo/ImplicitProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractImplicitProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ImplicitProviderTests extends AbstractImplicitProviderTests { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/vanilla/src/test/java/demo/ProtectedResourceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package demo; 15 | 16 | import org.springframework.boot.test.SpringApplicationConfiguration; 17 | 18 | import sparklr.common.AbstractProtectedResourceTests; 19 | 20 | /** 21 | * @author Dave Syer 22 | * 23 | */ 24 | @SpringApplicationConfiguration(classes = Application.class) 25 | public class ProtectedResourceTests extends AbstractProtectedResourceTests { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests/xml/vanilla/src/test/java/demo/RefreshTokenSupportTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractRefreshTokenSupportTests; 6 | 7 | /** 8 | * @author Ryan Heaton 9 | * @author Dave Syer 10 | */ 11 | @SpringApplicationConfiguration(classes=Application.class) 12 | public class RefreshTokenSupportTests extends AbstractRefreshTokenSupportTests { 13 | } 14 | -------------------------------------------------------------------------------- /tests/xml/vanilla/src/test/java/demo/ResourceOwnerPasswordProviderTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.test.SpringApplicationConfiguration; 4 | 5 | import sparklr.common.AbstractResourceOwnerPasswordProviderTests; 6 | 7 | /** 8 | * @author Dave Syer 9 | */ 10 | @SpringApplicationConfiguration(classes=Application.class) 11 | public class ResourceOwnerPasswordProviderTests extends AbstractResourceOwnerPasswordProviderTests { 12 | 13 | } 14 | --------------------------------------------------------------------------------