Polish gh-1127
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
* Copyright 2020-2023 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.
|
||||
@@ -162,8 +162,8 @@ public final class OAuth2AuthorizationConsentAuthenticationContext implements OA
|
||||
public OAuth2AuthorizationConsentAuthenticationContext build() {
|
||||
Assert.notNull(get(OAuth2AuthorizationConsent.Builder.class), "authorizationConsentBuilder cannot be null");
|
||||
Assert.notNull(get(RegisteredClient.class), "registeredClient cannot be null");
|
||||
Assert.notNull(get(OAuth2Authorization.class), "authorization cannot be null");
|
||||
OAuth2Authorization authorization = get(OAuth2Authorization.class);
|
||||
Assert.notNull(authorization, "authorization cannot be null");
|
||||
if (authorization.getAuthorizationGrantType().equals(AuthorizationGrantType.AUTHORIZATION_CODE)) {
|
||||
Assert.notNull(get(OAuth2AuthorizationRequest.class), "authorizationRequest cannot be null");
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class OAuth2DeviceAuthorizationConsentAuthenticationProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void supportsWhenTypeOAuth2DeviceAuthorizationRequestAuthenticationTokenThenReturnTrue() {
|
||||
public void supportsWhenTypeOAuth2DeviceAuthorizationConsentAuthenticationTokenThenReturnTrue() {
|
||||
assertThat(this.authenticationProvider.supports(OAuth2DeviceAuthorizationConsentAuthenticationToken.class)).isTrue();
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class OAuth2DeviceVerificationAuthenticationProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void supportsWhenTypeOAuth2DeviceAuthorizationRequestAuthenticationTokenThenReturnTrue() {
|
||||
public void supportsWhenTypeOAuth2DeviceVerificationAuthenticationTokenThenReturnTrue() {
|
||||
assertThat(this.authenticationProvider.supports(OAuth2DeviceVerificationAuthenticationToken.class)).isTrue();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,6 @@ public class OAuth2DeviceVerificationEndpointFilterTests {
|
||||
private static final String VERIFICATION_URI = "/oauth2/device_verification";
|
||||
private static final String CLIENT_ID = "client-1";
|
||||
private static final String STATE = "12345";
|
||||
private static final String DEVICE_CODE = "EfYu_0jEL";
|
||||
private static final String USER_CODE = "BCDF-GHJK";
|
||||
|
||||
private AuthenticationManager authenticationManager;
|
||||
@@ -95,7 +94,7 @@ public class OAuth2DeviceVerificationEndpointFilterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorWhenAuthenticationMangerIsNullThenThrowIllegalArgumentException() {
|
||||
public void constructorWhenAuthenticationManagerIsNullThenThrowIllegalArgumentException() {
|
||||
// @formatter:off
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new OAuth2DeviceVerificationEndpointFilter(null))
|
||||
|
||||
@@ -86,7 +86,7 @@ public class OAuth2DeviceAuthorizationConsentAuthenticationConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertWhenBlankClientIdThenInvalidRequestError() {
|
||||
public void convertWhenEmptyClientIdThenInvalidRequestError() {
|
||||
MockHttpServletRequest request = createRequest();
|
||||
request.addParameter(OAuth2ParameterNames.STATE, STATE);
|
||||
request.addParameter(OAuth2ParameterNames.CLIENT_ID, "");
|
||||
@@ -132,7 +132,7 @@ public class OAuth2DeviceAuthorizationConsentAuthenticationConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertWhenBlankUserCodeThenInvalidRequestError() {
|
||||
public void convertWhenEmptyUserCodeThenInvalidRequestError() {
|
||||
MockHttpServletRequest request = createRequest();
|
||||
request.addParameter(OAuth2ParameterNames.STATE, STATE);
|
||||
request.addParameter(OAuth2ParameterNames.CLIENT_ID, CLIENT_ID);
|
||||
@@ -165,7 +165,7 @@ public class OAuth2DeviceAuthorizationConsentAuthenticationConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertWhenBlankStateParameterThenInvalidRequestError() {
|
||||
public void convertWhenEmptyStateParameterThenInvalidRequestError() {
|
||||
MockHttpServletRequest request = createRequest();
|
||||
request.addParameter(OAuth2ParameterNames.STATE, "");
|
||||
request.addParameter(OAuth2ParameterNames.CLIENT_ID, CLIENT_ID);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class OAuth2DeviceVerificationAuthenticationConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertWhenBlankUserCodeParametersThenInvalidRequestError() {
|
||||
public void convertWhenEmptyUserCodeParameterThenInvalidRequestError() {
|
||||
MockHttpServletRequest request = createRequest();
|
||||
request.addParameter(OAuth2ParameterNames.USER_CODE, "");
|
||||
// @formatter:off
|
||||
@@ -95,7 +95,7 @@ public class OAuth2DeviceVerificationAuthenticationConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertWhenMultipleUserCodeParametersThenInvalidRequestError() {
|
||||
public void convertWhenMultipleUserCodeParameterThenInvalidRequestError() {
|
||||
MockHttpServletRequest request = createRequest();
|
||||
request.addParameter(OAuth2ParameterNames.USER_CODE, USER_CODE);
|
||||
request.addParameter(OAuth2ParameterNames.USER_CODE, "another");
|
||||
|
||||
Reference in New Issue
Block a user