This commit is contained in:
Johnny Lim 2017-10-17 00:17:55 +09:00 committed by Rob Winch
parent a74f7c6faa
commit 25052214ae
14 changed files with 23 additions and 29 deletions

View File

@ -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>

View File

@ -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
}
/**
* 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
*/

View File

@ -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
}
/**
* 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
*/

View File

@ -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
}
/**
* 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
*/

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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) {

View File

@ -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 {
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 {
}
@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 {
}
@Test(expected = IllegalArgumentException.class)
public void setHttpStatusWhenNullLocationThenException() {
public void setHttpStatusWhenNullThenException() {
this.strategy.setHttpStatus(null);
}

View File

@ -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 {
assertThat(this.exchange.getResponse().getStatusCode()).isEqualTo(
HttpStatus.UNAUTHORIZED);
verifyZeroInteractions(this.delegate1, this.delegate2);
verifyZeroInteractions(this.delegate1);
}
}

View File

@ -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 {
}
@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());

View File

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