getSetting("name2")).isEqualTo("value2");
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020-2021 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 | package org.springframework.security.oauth2.jwt;
17 |
18 | /**
19 | * Implementations of this interface are responsible for encoding
20 | * a JSON Web Token (JWT) to it's compact claims representation format.
21 | *
22 | *
23 | * JWTs may be represented using the JWS Compact Serialization format for a
24 | * JSON Web Signature (JWS) structure or JWE Compact Serialization format for a
25 | * JSON Web Encryption (JWE) structure. Therefore, implementors are responsible
26 | * for signing a JWS and/or encrypting a JWE.
27 | *
28 | * @author Anoop Garlapati
29 | * @author Joe Grandja
30 | * @since 0.0.1
31 | * @see Jwt
32 | * @see JoseHeader
33 | * @see JwtClaimsSet
34 | * @see JwtDecoder
35 | * @see JSON Web Token (JWT)
36 | * @see JSON Web Signature (JWS)
37 | * @see JSON Web Encryption (JWE)
38 | * @see JWS Compact Serialization
39 | * @see JWE Compact Serialization
40 | */
41 | @FunctionalInterface
42 | public interface JwtEncoder {
43 |
44 | /**
45 | * Encode the JWT to it's compact claims representation format.
46 | *
47 | * @param headers the JOSE header
48 | * @param claims the JWT Claims Set
49 | * @return a {@link Jwt}
50 | * @throws JwtEncodingException if an error occurs while attempting to encode the JWT
51 | */
52 | Jwt encode(JoseHeader headers, JwtClaimsSet claims) throws JwtEncodingException;
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020-2021 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 | package org.springframework.security.oauth2.server.authorization;
17 |
18 | import org.springframework.lang.Nullable;
19 | import org.springframework.security.oauth2.core.OAuth2TokenType;
20 |
21 | /**
22 | * Implementations of this interface are responsible for the management
23 | * of {@link OAuth2Authorization OAuth 2.0 Authorization(s)}.
24 | *
25 | * @author Joe Grandja
26 | * @since 0.0.1
27 | * @see OAuth2Authorization
28 | * @see OAuth2TokenType
29 | */
30 | public interface OAuth2AuthorizationService {
31 |
32 | /**
33 | * Saves the {@link OAuth2Authorization}.
34 | *
35 | * @param authorization the {@link OAuth2Authorization}
36 | */
37 | void save(OAuth2Authorization authorization);
38 |
39 | /**
40 | * Removes the {@link OAuth2Authorization}.
41 | *
42 | * @param authorization the {@link OAuth2Authorization}
43 | */
44 | void remove(OAuth2Authorization authorization);
45 |
46 | /**
47 | * Returns the {@link OAuth2Authorization} identified by the provided {@code id},
48 | * or {@code null} if not found.
49 | *
50 | * @param id the authorization identifier
51 | * @return the {@link OAuth2Authorization} if found, otherwise {@code null}
52 | */
53 | @Nullable
54 | OAuth2Authorization findById(String id);
55 |
56 | /**
57 | * Returns the {@link OAuth2Authorization} containing the provided {@code token},
58 | * or {@code null} if not found.
59 | *
60 | * @param token the token credential
61 | * @param tokenType the {@link OAuth2TokenType token type}
62 | * @return the {@link OAuth2Authorization} if found, otherwise {@code null}
63 | */
64 | @Nullable
65 | OAuth2Authorization findByToken(String token, @Nullable OAuth2TokenType tokenType);
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.adoc:
--------------------------------------------------------------------------------
1 | = Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project, and in the interest of fostering an open
4 | and welcoming community, we pledge to respect all people who contribute through reporting
5 | issues, posting feature requests, updating documentation, submitting pull requests or
6 | patches, and other activities.
7 |
8 | We are committed to making participation in this project a harassment-free experience for
9 | everyone, regardless of level of experience, gender, gender identity and expression,
10 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
11 | religion, or nationality.
12 |
13 | Examples of unacceptable behavior by participants include:
14 |
15 | * The use of sexualized language or imagery
16 | * Personal attacks
17 | * Trolling or insulting/derogatory comments
18 | * Public or private harassment
19 | * Publishing other's private information, such as physical or electronic addresses,
20 | without explicit permission
21 | * Other unethical or unprofessional conduct
22 |
23 | Project maintainers have the right and responsibility to remove, edit, or reject comments,
24 | commits, code, wiki edits, issues, and other contributions that are not aligned to this
25 | Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors
26 | that they deem inappropriate, threatening, offensive, or harmful.
27 |
28 | By adopting this Code of Conduct, project maintainers commit themselves to fairly and
29 | consistently applying these principles to every aspect of managing this project. Project
30 | maintainers who do not follow or enforce the Code of Conduct may be permanently removed
31 | from the project team.
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an
34 | individual is representing the project or its community.
35 |
36 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
37 | contacting a project maintainer at spring-code-of-conduct@pivotal.io . All complaints will
38 | be reviewed and investigated and will result in a response that is deemed necessary and
39 | appropriate to the circumstances. Maintainers are obligated to maintain confidentiality
40 | with regard to the reporter of an incident.
41 |
42 | This Code of Conduct is adapted from the
43 | https://contributor-covenant.org[Contributor Covenant], version 1.3.0, available at
44 | https://contributor-covenant.org/version/1/3/0/[contributor-covenant.org/version/1/3/0/]
45 |
--------------------------------------------------------------------------------
/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/jackson2/JsonNodeUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2020 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.server.authorization.jackson2;
18 |
19 | import java.util.Map;
20 | import java.util.Set;
21 |
22 | import com.fasterxml.jackson.core.type.TypeReference;
23 | import com.fasterxml.jackson.databind.JsonNode;
24 | import com.fasterxml.jackson.databind.ObjectMapper;
25 |
26 | /**
27 | * TODO
28 | * This class is a straight copy from Spring Security.
29 | * It should be consolidated when merging this codebase into Spring Security.
30 | *
31 | * Utility class for {@code JsonNode}.
32 | *
33 | * @author Joe Grandja
34 | * @since 5.3
35 | */
36 | abstract class JsonNodeUtils {
37 |
38 | static final TypeReference> STRING_SET = new TypeReference>() {
39 | };
40 |
41 | static final TypeReference