Preserve manual formatting
Issue gh-1616
This commit is contained in:
@@ -218,7 +218,8 @@ public class OAuth2DeviceAuthorizationRequestAuthenticationProviderTests {
|
||||
assertThat(authenticationResult.getPrincipal()).isEqualTo(authentication.getPrincipal());
|
||||
assertThat(authenticationResult.getScopes()).hasSameElementsAs(registeredClient.getScopes());
|
||||
assertThat(authenticationResult.getDeviceCode().getTokenValue()).hasSize(128);
|
||||
assertThat(authenticationResult.getUserCode().getTokenValue()).hasSize(9); // 8 chars + 1 dash
|
||||
// 8 chars + 1 dash
|
||||
assertThat(authenticationResult.getUserCode().getTokenValue()).hasSize(9);
|
||||
|
||||
ArgumentCaptor<OAuth2Authorization> authorizationCaptor = ArgumentCaptor.forClass(OAuth2Authorization.class);
|
||||
verify(this.authorizationService).save(authorizationCaptor.capture());
|
||||
@@ -244,7 +245,8 @@ public class OAuth2DeviceAuthorizationRequestAuthenticationProviderTests {
|
||||
assertThat(authenticationResult.getPrincipal()).isEqualTo(authentication.getPrincipal());
|
||||
assertThat(authenticationResult.getScopes()).hasSameElementsAs(registeredClient.getScopes());
|
||||
assertThat(authenticationResult.getDeviceCode().getTokenValue()).hasSize(128);
|
||||
assertThat(authenticationResult.getUserCode().getTokenValue()).hasSize(9); // 8 chars + 1 dash
|
||||
// 8 chars + 1 dash
|
||||
assertThat(authenticationResult.getUserCode().getTokenValue()).hasSize(9);
|
||||
|
||||
ArgumentCaptor<OAuth2Authorization> authorizationCaptor = ArgumentCaptor.forClass(OAuth2Authorization.class);
|
||||
verify(this.authorizationService).save(authorizationCaptor.capture());
|
||||
@@ -275,7 +277,8 @@ public class OAuth2DeviceAuthorizationRequestAuthenticationProviderTests {
|
||||
assertThat(authenticationResult.getPrincipal()).isEqualTo(authentication.getPrincipal());
|
||||
assertThat(authenticationResult.getScopes()).hasSameElementsAs(registeredClient.getScopes());
|
||||
assertThat(authenticationResult.getDeviceCode().getTokenValue()).isEqualTo(DEVICE_CODE);
|
||||
assertThat(authenticationResult.getUserCode().getTokenValue()).hasSize(9); // 8 chars + 1 dash
|
||||
// 8 chars + 1 dash
|
||||
assertThat(authenticationResult.getUserCode().getTokenValue()).hasSize(9);
|
||||
|
||||
ArgumentCaptor<OAuth2TokenContext> tokenContextCaptor = ArgumentCaptor.forClass(OAuth2TokenContext.class);
|
||||
verify(deviceCodeGenerator).generate(tokenContextCaptor.capture());
|
||||
|
||||
@@ -400,7 +400,8 @@ public class JdbcRegisteredClientRepositoryTests {
|
||||
} else if (AuthorizationGrantType.REFRESH_TOKEN.getValue().equals(authorizationGrantType)) {
|
||||
return AuthorizationGrantType.REFRESH_TOKEN;
|
||||
}
|
||||
return new AuthorizationGrantType(authorizationGrantType); // Custom authorization grant type
|
||||
// Custom authorization grant type
|
||||
return new AuthorizationGrantType(authorizationGrantType);
|
||||
}
|
||||
|
||||
private static ClientAuthenticationMethod resolveClientAuthenticationMethod(String clientAuthenticationMethod) {
|
||||
@@ -411,7 +412,8 @@ public class JdbcRegisteredClientRepositoryTests {
|
||||
} else if (ClientAuthenticationMethod.NONE.getValue().equals(clientAuthenticationMethod)) {
|
||||
return ClientAuthenticationMethod.NONE;
|
||||
}
|
||||
return new ClientAuthenticationMethod(clientAuthenticationMethod); // Custom client authentication method
|
||||
// Custom client authentication method
|
||||
return new ClientAuthenticationMethod(clientAuthenticationMethod);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -203,8 +203,9 @@ public class OidcProviderConfigurationTests {
|
||||
@Bean
|
||||
SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http) throws Exception {
|
||||
OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http);
|
||||
// Enable OpenID Connect 1.0
|
||||
http.getConfigurer(OAuth2AuthorizationServerConfigurer.class)
|
||||
.oidc(Customizer.withDefaults()); // Enable OpenID Connect 1.0
|
||||
.oidc(Customizer.withDefaults());
|
||||
return http.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -482,8 +482,9 @@ public class OidcTests {
|
||||
@Bean
|
||||
SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http) throws Exception {
|
||||
OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http);
|
||||
// Enable OpenID Connect 1.0
|
||||
http.getConfigurer(OAuth2AuthorizationServerConfigurer.class)
|
||||
.oidc(Customizer.withDefaults()); // Enable OpenID Connect 1.0
|
||||
.oidc(Customizer.withDefaults());
|
||||
return http.build();
|
||||
}
|
||||
|
||||
@@ -578,9 +579,10 @@ public class OidcTests {
|
||||
new OAuth2AuthorizationServerConfigurer();
|
||||
http.apply(authorizationServerConfigurer);
|
||||
|
||||
// Enable OpenID Connect 1.0
|
||||
authorizationServerConfigurer
|
||||
.tokenGenerator(tokenGenerator())
|
||||
.oidc(Customizer.withDefaults()); // Enable OpenID Connect 1.0
|
||||
.oidc(Customizer.withDefaults());
|
||||
|
||||
RequestMatcher endpointsMatcher = authorizationServerConfigurer.getEndpointsMatcher();
|
||||
|
||||
|
||||
@@ -430,8 +430,9 @@ public class OidcUserInfoTests {
|
||||
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
OAuth2AuthorizationServerConfigurer authorizationServerConfigurer =
|
||||
new OAuth2AuthorizationServerConfigurer();
|
||||
// Enable OpenID Connect 1.0
|
||||
authorizationServerConfigurer
|
||||
.oidc(Customizer.withDefaults()); // Enable OpenID Connect 1.0
|
||||
.oidc(Customizer.withDefaults());
|
||||
RequestMatcher endpointsMatcher = authorizationServerConfigurer
|
||||
.getEndpointsMatcher();
|
||||
|
||||
@@ -462,8 +463,9 @@ public class OidcUserInfoTests {
|
||||
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
OAuth2AuthorizationServerConfigurer authorizationServerConfigurer =
|
||||
new OAuth2AuthorizationServerConfigurer();
|
||||
// Enable OpenID Connect 1.0
|
||||
authorizationServerConfigurer
|
||||
.oidc(Customizer.withDefaults()); // Enable OpenID Connect 1.0
|
||||
.oidc(Customizer.withDefaults());
|
||||
RequestMatcher endpointsMatcher = authorizationServerConfigurer
|
||||
.getEndpointsMatcher();
|
||||
|
||||
|
||||
@@ -507,10 +507,11 @@ public class OAuth2AuthorizationEndpointFilterTests {
|
||||
scopes.addAll(requestedScopes);
|
||||
})
|
||||
.build();
|
||||
// No scopes previously approved
|
||||
OAuth2AuthorizationConsentAuthenticationToken authorizationConsentAuthenticationResult =
|
||||
new OAuth2AuthorizationConsentAuthenticationToken(
|
||||
AUTHORIZATION_URI, registeredClient.getClientId(), principal,
|
||||
STATE, new HashSet<>(), null); // No scopes previously approved
|
||||
STATE, new HashSet<>(), null);
|
||||
authorizationConsentAuthenticationResult.setAuthenticated(true);
|
||||
when(this.authenticationManager.authenticate(any()))
|
||||
.thenReturn(authorizationConsentAuthenticationResult);
|
||||
@@ -538,10 +539,11 @@ public class OAuth2AuthorizationEndpointFilterTests {
|
||||
scopes.addAll(requestedScopes);
|
||||
})
|
||||
.build();
|
||||
// No scopes previously approved
|
||||
OAuth2AuthorizationConsentAuthenticationToken authorizationConsentAuthenticationResult =
|
||||
new OAuth2AuthorizationConsentAuthenticationToken(
|
||||
AUTHORIZATION_URI, registeredClient.getClientId(), principal,
|
||||
STATE, new HashSet<>(), null); // No scopes previously approved
|
||||
STATE, new HashSet<>(), null);
|
||||
authorizationConsentAuthenticationResult.setAuthenticated(true);
|
||||
when(this.authenticationManager.authenticate(any()))
|
||||
.thenReturn(authorizationConsentAuthenticationResult);
|
||||
|
||||
Reference in New Issue
Block a user