Browse Source

Polish

pull/4637/merge
Johnny Lim 8 years ago committed by Rob Winch
parent
commit
25052214ae
  1. 2
      config/src/main/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurer.java
  2. 4
      config/src/main/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBean.java
  3. 4
      config/src/main/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBean.java
  4. 4
      config/src/main/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBean.java
  5. 2
      oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/userinfo/OAuth2UserAuthenticationToken.java
  6. 2
      oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/oidc/client/authentication/OidcClientAuthenticationToken.java
  7. 4
      oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/oidc/client/authentication/OidcUserAuthenticationToken.java
  8. 2
      test/src/main/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuilders.java
  9. 2
      webflux/src/main/java/org/springframework/security/web/server/DefaultServerRedirectStrategy.java
  10. 2
      webflux/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandler.java
  11. 12
      webflux/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java
  12. 3
      webflux/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java
  13. 7
      webflux/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java
  14. 2
      webflux/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java

2
config/src/main/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurer.java

@ -99,7 +99,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher; @@ -99,7 +99,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
* <ul>
* <li>{@link AuthenticationEntryPoint} is populated with a
* {@link LoginUrlAuthenticationEntryPoint}</li>
* <li>A {@link OpenIDAuthenticationProvider} is populated into
* <li>An {@link OpenIDAuthenticationProvider} is populated into
* {@link HttpSecurity#authenticationProvider(org.springframework.security.authentication.AuthenticationProvider)}
* </li>
* </ul>

4
config/src/main/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBean.java

@ -54,7 +54,7 @@ public class ReactiveUserDetailsServiceResourceFactoryBean @@ -54,7 +54,7 @@ public class ReactiveUserDetailsServiceResourceFactoryBean
}
/**
* Sets a the location of a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}
* Sets the location of a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
*
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
* @return the UserDetailsResourceFactoryBean
@ -64,7 +64,7 @@ public class ReactiveUserDetailsServiceResourceFactoryBean @@ -64,7 +64,7 @@ public class ReactiveUserDetailsServiceResourceFactoryBean
}
/**
* Sets a a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}
* Sets a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
*
* @param resource the Resource to use
*/

4
config/src/main/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBean.java

@ -101,7 +101,7 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact @@ -101,7 +101,7 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact
}
/**
* Sets a the location of a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}
* Sets the location of a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
*
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
*/
@ -110,7 +110,7 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact @@ -110,7 +110,7 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact
}
/**
* Sets a a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}
* Sets a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
*
* @param resource the Resource to use
*/

4
config/src/main/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBean.java

@ -54,7 +54,7 @@ public class UserDetailsManagerResourceFactoryBean implements ResourceLoaderAwar @@ -54,7 +54,7 @@ public class UserDetailsManagerResourceFactoryBean implements ResourceLoaderAwar
}
/**
* Sets a the location of a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}
* Sets the location of a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
*
* @param resourceLocation the location of the properties file that contains the users (i.e. "classpath:users.properties")
* @return the UserDetailsResourceFactoryBean
@ -64,7 +64,7 @@ public class UserDetailsManagerResourceFactoryBean implements ResourceLoaderAwar @@ -64,7 +64,7 @@ public class UserDetailsManagerResourceFactoryBean implements ResourceLoaderAwar
}
/**
* Sets a a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}
* Sets a Resource that is a Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
*
* @param resource the Resource to use
*/

2
oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/userinfo/OAuth2UserAuthenticationToken.java

@ -31,7 +31,7 @@ import java.util.Collections; @@ -31,7 +31,7 @@ import java.util.Collections;
* that represents an <i>OAuth 2.0 User</i> {@link Authentication}.
*
* <p>
* This {@link Authentication} associates an {@link OAuth2User} principal to a
* This {@link Authentication} associates an {@link OAuth2User} principal to an
* {@link OAuth2ClientAuthenticationToken} which represents the <i>&quot;Authorized Client&quot;</i>.
*
* @author Joe Grandja

2
oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/oidc/client/authentication/OidcClientAuthenticationToken.java

@ -23,7 +23,7 @@ import org.springframework.security.oauth2.oidc.core.IdToken; @@ -23,7 +23,7 @@ import org.springframework.security.oauth2.oidc.core.IdToken;
import org.springframework.util.Assert;
/**
* A {@link OAuth2ClientAuthenticationToken} that represents an
* An {@link OAuth2ClientAuthenticationToken} that represents an
* <i>OpenID Connect 1.0 Client</i> {@link Authentication}.
*
* <p>

4
oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/oidc/client/authentication/OidcUserAuthenticationToken.java

@ -25,11 +25,11 @@ import java.util.Collection; @@ -25,11 +25,11 @@ import java.util.Collection;
import java.util.Collections;
/**
* A {@link OAuth2UserAuthenticationToken} that represents an
* An {@link OAuth2UserAuthenticationToken} that represents an
* <i>OpenID Connect 1.0 User</i> {@link Authentication}.
*
* <p>
* This {@link Authentication} associates an {@link OidcUser} principal to a
* This {@link Authentication} associates an {@link OidcUser} principal to an
* {@link OidcClientAuthenticationToken} which represents the <i>&quot;Authorized Client&quot;</i>.
*
* @author Joe Grandja

2
test/src/main/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuilders.java

@ -217,7 +217,7 @@ public final class SecurityMockMvcRequestBuilders { @@ -217,7 +217,7 @@ public final class SecurityMockMvcRequestBuilders {
}
/**
* Specify a media type to to set as the Accept header in the request.
* Specify a media type to set as the Accept header in the request.
*
* @param acceptMediaType the {@link MediaType} to set the Accept header to.
* Default is: MediaType.APPLICATION_FORM_URLENCODED

2
webflux/src/main/java/org/springframework/security/web/server/DefaultServerRedirectStrategy.java

@ -63,7 +63,7 @@ public class DefaultServerRedirectStrategy implements ServerRedirectStrategy { @@ -63,7 +63,7 @@ public class DefaultServerRedirectStrategy implements ServerRedirectStrategy {
/**
* Sets if the location is relative to the context.
* @param contextRelative if redirects should be relative to the context.
Default is true.
* Default is true.
*/
public void setContextRelative(boolean contextRelative) {
this.contextRelative = contextRelative;

2
webflux/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandler.java

@ -50,7 +50,7 @@ public class RedirectServerAuthenticationSuccessHandler @@ -50,7 +50,7 @@ public class RedirectServerAuthenticationSuccessHandler
}
/**
* Where the user is redirected to upon AuthenticationSuccess
* Where the user is redirected to upon authentication success
* @param location the location to redirect to. The default is "/"
*/
public void setLocation(URI location) {

12
webflux/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java

@ -23,8 +23,6 @@ import org.mockito.junit.MockitoJUnitRunner; @@ -23,8 +23,6 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.http.HttpStatus;
import org.springframework.mock.http.server.reactive.MockServerHttpRequest;
import org.springframework.mock.web.server.MockServerWebExchange;
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.web.server.ServerWebExchange;
import java.net.URI;
@ -47,16 +45,14 @@ public class DefaultServerRedirectStrategyTests { @@ -47,16 +45,14 @@ public class DefaultServerRedirectStrategyTests {
private DefaultServerRedirectStrategy strategy =
new DefaultServerRedirectStrategy();
private AuthenticationException exception = new AuthenticationCredentialsNotFoundException("Authentication Required");
@Test(expected = IllegalArgumentException.class)
public void sendRedirectWhenLocationNullThenException() {
this.strategy.sendRedirect(this.exchange, (URI) null);
this.strategy.sendRedirect(this.exchange, null);
}
@Test(expected = IllegalArgumentException.class)
public void sendRedirectWhenExchangeNullThenException() {
this.strategy.sendRedirect((ServerWebExchange) null, this.location);
this.strategy.sendRedirect(null, this.location);
}
@Test
@ -67,7 +63,7 @@ public class DefaultServerRedirectStrategyTests { @@ -67,7 +63,7 @@ public class DefaultServerRedirectStrategyTests {
}
@Test
public void sendRedirectWhenNoContextThenStatusAndLocationSet() {
public void sendRedirectWhenNoContextPathThenStatusAndLocationSet() {
this.exchange = exchange(MockServerHttpRequest.get("/"));
this.strategy.sendRedirect(this.exchange, this.location).block();
@ -122,7 +118,7 @@ public class DefaultServerRedirectStrategyTests { @@ -122,7 +118,7 @@ public class DefaultServerRedirectStrategyTests {
}
@Test(expected = IllegalArgumentException.class)
public void setHttpStatusWhenNullLocationThenException() {
public void setHttpStatusWhenNullThenException() {
this.strategy.setHttpStatus(null);
}

3
webflux/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java

@ -70,7 +70,6 @@ public class DelegatingServerAuthenticationEntryPointTests { @@ -70,7 +70,6 @@ public class DelegatingServerAuthenticationEntryPointTests {
Mono<Void> actualResult = this.entryPoint.commence(this.exchange, this.e);
actualResult.block();
assertThat(actualResult).isEqualTo(actualResult);
verifyZeroInteractions(this.delegate1);
verify(this.delegate2).commence(this.exchange, this.e);
}
@ -86,6 +85,6 @@ public class DelegatingServerAuthenticationEntryPointTests { @@ -86,6 +85,6 @@ public class DelegatingServerAuthenticationEntryPointTests {
assertThat(this.exchange.getResponse().getStatusCode()).isEqualTo(
HttpStatus.UNAUTHORIZED);
verifyZeroInteractions(this.delegate1, this.delegate2);
verifyZeroInteractions(this.delegate1);
}
}

7
webflux/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java

@ -50,14 +50,14 @@ public class RedirectServerAuthenticationEntryPointTests { @@ -50,14 +50,14 @@ public class RedirectServerAuthenticationEntryPointTests {
private String location = "/login";
private RedirectServerAuthenticationEntryPoint entryPoint =
new RedirectServerAuthenticationEntryPoint("/login");
new RedirectServerAuthenticationEntryPoint(this.location);
private AuthenticationException exception = new AuthenticationCredentialsNotFoundException("Authentication Required");
@Test(expected = IllegalArgumentException.class)
public void constructorStringWhenNullLocationThenException() {
new RedirectServerAuthenticationEntryPoint((String) null);
new RedirectServerAuthenticationEntryPoint(null);
}
@Test
@ -80,10 +80,9 @@ public class RedirectServerAuthenticationEntryPointTests { @@ -80,10 +80,9 @@ public class RedirectServerAuthenticationEntryPointTests {
}
@Test
public void commenceWhenCustomStatusThenStatusSet() {
public void commenceWhenCustomServerRedirectStrategyThenCustomServerRedirectStrategyUsed() {
Mono<Void> result = Mono.empty();
when(this.serverRedirectStrategy.sendRedirect(any(), any())).thenReturn(result);
HttpStatus status = HttpStatus.MOVED_PERMANENTLY;
this.entryPoint.setServerRedirectStrategy(this.serverRedirectStrategy);
this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build());

2
webflux/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java

@ -62,7 +62,7 @@ public class RedirectServerAuthenticationSuccessHandlerTests { @@ -62,7 +62,7 @@ public class RedirectServerAuthenticationSuccessHandlerTests {
@Test(expected = IllegalArgumentException.class)
public void constructorStringWhenNullLocationThenException() {
new RedirectServerAuthenticationEntryPoint((String) null);
new RedirectServerAuthenticationEntryPoint(null);
}
@Test

Loading…
Cancel
Save