35
35
import org .springframework .security .crypto .password .PasswordEncoder ;
36
36
import org .springframework .security .oauth2 .jwt .JwtEncoder ;
37
37
import org .springframework .security .oauth2 .jwt .NimbusJwsEncoder ;
38
- import org .springframework .security .oauth2 .server .authorization .InMemoryOAuth2AuthorizationService ;
39
38
import org .springframework .security .oauth2 .server .authorization .InMemoryOAuth2AuthorizationConsentService ;
39
+ import org .springframework .security .oauth2 .server .authorization .InMemoryOAuth2AuthorizationService ;
40
40
import org .springframework .security .oauth2 .server .authorization .JwtEncodingContext ;
41
+ import org .springframework .security .oauth2 .server .authorization .OAuth2AuthorizationConsentService ;
41
42
import org .springframework .security .oauth2 .server .authorization .OAuth2AuthorizationService ;
42
43
import org .springframework .security .oauth2 .server .authorization .OAuth2TokenCustomizer ;
43
- import org .springframework .security .oauth2 .server .authorization .OAuth2AuthorizationConsentService ;
44
44
import org .springframework .security .oauth2 .server .authorization .authentication .OAuth2AuthorizationCodeAuthenticationProvider ;
45
45
import org .springframework .security .oauth2 .server .authorization .authentication .OAuth2ClientAuthenticationProvider ;
46
46
import org .springframework .security .oauth2 .server .authorization .authentication .OAuth2ClientCredentialsAuthenticationProvider ;
79
79
* @see AbstractHttpConfigurer
80
80
* @see RegisteredClientRepository
81
81
* @see OAuth2AuthorizationService
82
+ * @see OAuth2AuthorizationConsentService
82
83
* @see OAuth2AuthorizationEndpointFilter
83
84
* @see OAuth2TokenEndpointFilter
84
85
* @see OAuth2TokenIntrospectionEndpointFilter
@@ -138,7 +139,7 @@ public OAuth2AuthorizationServerConfigurer<B> authorizationService(OAuth2Authori
138
139
/**
139
140
* Sets the authorization consent service.
140
141
*
141
- * @param authorizationConsentService the authorization service
142
+ * @param authorizationConsentService the authorization consent service
142
143
* @return the {@link OAuth2AuthorizationServerConfigurer} for further configuration
143
144
*/
144
145
public OAuth2AuthorizationServerConfigurer <B > authorizationConsentService (OAuth2AuthorizationConsentService authorizationConsentService ) {
@@ -160,17 +161,17 @@ public OAuth2AuthorizationServerConfigurer<B> providerSettings(ProviderSettings
160
161
}
161
162
162
163
/**
163
- * Specify the URL to redirect Resource Owners to if consent is required during
164
+ * Specify the URI to redirect Resource Owners to if consent is required during
164
165
* the {@code authorization_code} flow. A default consent page will be generated when
165
166
* this attribute is not specified.
166
167
*
167
- * If a URL is specified, users are required to process the specified URL to generate
168
+ * If a URI is specified, applications are required to process the specified URI to generate
168
169
* a consent page. The query string will contain the following parameters:
169
170
*
170
171
* <ul>
171
- * <li>{@code client_id} the client identifier</li>
172
- * <li>{@code scope} the space separated list of scopes present in the authorization request</li>
173
- * <li>{@code state} a CSRF protection token</li>
172
+ * <li>{@code client_id} - the client identifier</li>
173
+ * <li>{@code scope} - the space separated list of scopes present in the authorization request</li>
174
+ * <li>{@code state} - a CSRF protection token</li>
174
175
* </ul>
175
176
*
176
177
* In general, the consent page should create a form that submits
@@ -181,14 +182,13 @@ public OAuth2AuthorizationServerConfigurer<B> providerSettings(ProviderSettings
181
182
* <li>It must be submitted to {@link ProviderSettings#authorizationEndpoint()}</li>
182
183
* <li>It must include the received {@code client_id} as an HTTP parameter</li>
183
184
* <li>It must include the received {@code state} as an HTTP parameter</li>
184
- * <li>It must include the list of {@code scope}s the {@code Resource Owners }
185
- * consents to as an HTTP parameter</li>
186
- * <li>It must include the {@code consent_action} parameter, with value either
185
+ * <li>It must include the list of {@code scope}s the {@code Resource Owner }
186
+ * consented to as an HTTP parameter</li>
187
+ * <li>It must include the {@code consent_action} parameter, with a value either
187
188
* {@code approve} or {@code cancel} as an HTTP parameter</li>
188
189
* </ul>
189
190
*
190
- *
191
- * @param consentPage the consent page to redirect to if consent is required (e.g. "/consent")
191
+ * @param consentPage the consent page to redirect to if consent is required (e.g. "/oauth2/consent")
192
192
* @return the {@link OAuth2AuthorizationServerConfigurer} for further configuration
193
193
*/
194
194
public OAuth2AuthorizationServerConfigurer <B > consentPage (String consentPage ) {
@@ -316,9 +316,8 @@ public void configure(B builder) {
316
316
getRegisteredClientRepository (builder ),
317
317
getAuthorizationService (builder ),
318
318
getAuthorizationConsentService (builder ),
319
- providerSettings .authorizationEndpoint ()
320
- );
321
- if (this .consentPage != null ) {
319
+ providerSettings .authorizationEndpoint ());
320
+ if (StringUtils .hasText (this .consentPage )) {
322
321
authorizationEndpointFilter .setUserConsentUri (this .consentPage );
323
322
}
324
323
builder .addFilterBefore (postProcess (authorizationEndpointFilter ), AbstractPreAuthenticatedProcessingFilter .class );
0 commit comments