-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Implement OpenID client registration endpoint #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
...n/java/org/springframework/security/oauth2/core/oidc/OidcClientMetadataClaimAccessor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright 2020-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.security.oauth2.core.oidc; | ||
|
||
import org.springframework.security.oauth2.core.ClaimAccessor; | ||
import org.springframework.security.oauth2.core.ClientAuthenticationMethod; | ||
|
||
import java.time.Instant; | ||
import java.util.List; | ||
|
||
/** | ||
* A {@link ClaimAccessor} for the "claims" that can be returned | ||
* in the OpenID Client Registration Response. | ||
* | ||
* @author Ovidiu Popa | ||
* @since 0.1.1 | ||
* @see ClaimAccessor | ||
* @see OidcClientMetadataClaimNames | ||
* @see OidcClientRegistration | ||
* @see <a target="_blank" href="https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata">2. Client Metadata</a> | ||
*/ | ||
public interface OidcClientMetadataClaimAccessor extends ClaimAccessor { | ||
|
||
/** | ||
* Returns the redirect URI(s) that the client may use in redirect-based flows. | ||
* | ||
* @return the {@code List} of redirect URI(s) | ||
*/ | ||
default List<String> getRedirectUris() { | ||
return getClaimAsStringList(OidcClientMetadataClaimNames.REDIRECT_URIS); | ||
} | ||
|
||
/** | ||
* Returns the OAuth 2.0 {@code response_type} values that the client may use. | ||
* | ||
* @return the {@code List} of {@code response_type} | ||
*/ | ||
default List<String> getResponseTypes() { | ||
return getClaimAsStringList(OidcClientMetadataClaimNames.RESPONSE_TYPES); | ||
} | ||
|
||
/** | ||
* Returns the authorization {@code grant_types} that the client may use. | ||
* | ||
* @return the {@code List} of authorization {@code grant_types} | ||
*/ | ||
default List<String> getGrantTypes() { | ||
return getClaimAsStringList(OidcClientMetadataClaimNames.GRANT_TYPES); | ||
} | ||
|
||
/** | ||
* Returns the {@code client_name}. | ||
* | ||
* @return the {@code client_name} | ||
*/ | ||
default String getClientName() { | ||
return getClaimAsString(OidcClientMetadataClaimNames.CLIENT_NAME); | ||
} | ||
|
||
/** | ||
* Returns the scope(s) that the client may use. | ||
* | ||
* @return the scope(s) | ||
*/ | ||
default String getScope() { | ||
return getClaimAsString(OidcClientMetadataClaimNames.SCOPE); | ||
} | ||
|
||
/** | ||
* Returns the {@link ClientAuthenticationMethod authentication method} that the client may use. | ||
* | ||
* @return the {@link ClientAuthenticationMethod authentication method} | ||
*/ | ||
default String getTokenEndpointAuthenticationMethod() { | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
return getClaimAsString(OidcClientMetadataClaimNames.TOKEN_ENDPOINT_AUTH_METHOD); | ||
} | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Returns the {@code client_id}. | ||
* | ||
* @return the {@code client_id} | ||
*/ | ||
default String getClientId() { | ||
return getClaimAsString(OidcClientMetadataClaimNames.CLIENT_ID); | ||
} | ||
|
||
/** | ||
* Returns the {@code client_id_issued_at} timestamp. | ||
* | ||
* @return the {@code client_id_issued_at} timestamp | ||
*/ | ||
default Instant getClientIdIssuedAt() { | ||
return getClaimAsInstant(OidcClientMetadataClaimNames.CLIENT_ID_ISSUED_AT); | ||
} | ||
|
||
/** | ||
* Returns the {@code client_secret}. | ||
* | ||
* @return the {@code client_secret} | ||
*/ | ||
default String getClientSecret() { | ||
return getClaimAsString(OidcClientMetadataClaimNames.CLIENT_SECRET); | ||
} | ||
|
||
/** | ||
* Returns the {@code client_secret_expires_at} timestamp. | ||
* | ||
* @return the {@code client_secret_expires_at} timestamp | ||
*/ | ||
default Instant getClientSecretExpiresAt() { | ||
return getClaimAsInstant(OidcClientMetadataClaimNames.CLIENT_SECRET_EXPIRES_AT); | ||
} | ||
|
||
|
||
|
||
|
||
} |
79 changes: 79 additions & 0 deletions
79
...main/java/org/springframework/security/oauth2/core/oidc/OidcClientMetadataClaimNames.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright 2020-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.security.oauth2.core.oidc; | ||
|
||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
/** | ||
* The names of the "claims" defined by OpenID Client Registration 1.0 that can be returned | ||
* in the OpenID Client Registration Response. | ||
* | ||
* @author Ovidiu Popa | ||
* @since 0.1.1 | ||
* @see <a target="_blank" href="https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata">2. Client Metadata</a> | ||
*/ | ||
public interface OidcClientMetadataClaimNames { | ||
|
||
//request | ||
/** | ||
* {@code redirect_uris} - the redirect URI(s) that the client may use in redirect-based flows | ||
*/ | ||
String REDIRECT_URIS = "redirect_uris"; | ||
|
||
/** | ||
* {@code response_types} - the OAuth 2.0 {@code response_type} values that the client may use | ||
*/ | ||
String RESPONSE_TYPES = "response_types"; | ||
|
||
/** | ||
* {@code grant_types} - the OAuth 2.0 authorization {@code grant_types} that the client may use | ||
*/ | ||
String GRANT_TYPES = "grant_types"; | ||
|
||
/** | ||
* {@code client_name} - the {@code client_name} | ||
*/ | ||
String CLIENT_NAME = "client_name"; | ||
|
||
/** | ||
* {@code scope} - the scope(s) that the client may use | ||
*/ | ||
String SCOPE = "scope"; | ||
|
||
/** | ||
* {@code token_endpoint_auth_method} - the {@link org.springframework.security.oauth2.core.ClientAuthenticationMethod authentication method} that the client may use. | ||
*/ | ||
String TOKEN_ENDPOINT_AUTH_METHOD = "token_endpoint_auth_method"; | ||
|
||
//response | ||
/** | ||
* {@code client_id} - the {@code client_id} | ||
*/ | ||
String CLIENT_ID = "client_id"; | ||
|
||
/** | ||
* {@code client_secret} - the {@code client_secret} | ||
*/ | ||
String CLIENT_SECRET = "client_secret"; | ||
|
||
/** | ||
* {@code client_id_issued_at} - the timestamp when the client id was issued | ||
*/ | ||
String CLIENT_ID_ISSUED_AT = "client_id_issued_at"; | ||
|
||
/** | ||
* {@code client_secret_expires_at} - the timestamp when the client secret expires | ||
*/ | ||
String CLIENT_SECRET_EXPIRES_AT = "client_secret_expires_at"; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.