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 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 | */
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 | *
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 extends HttpMessageConverter>> 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 extends HttpMessageConverter>> 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 extends HttpMessageConverter>> 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 extends HttpMessageConverter>> 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