AuthenticatedAuthorizationManager->AuthenticatedReactiveAuthorizationManager

Issue gh-4615
This commit is contained in:
Rob Winch 2017-10-10 09:37:27 -05:00
parent 866ce5eaec
commit f1bc82dcef
3 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.security.authentication.ReactiveAuthenticationManager; import org.springframework.security.authentication.ReactiveAuthenticationManager;
import org.springframework.security.authorization.AuthenticatedAuthorizationManager; import org.springframework.security.authorization.AuthenticatedReactiveAuthorizationManager;
import org.springframework.security.authorization.AuthorityReactiveAuthorizationManager; import org.springframework.security.authorization.AuthorityReactiveAuthorizationManager;
import org.springframework.security.authorization.AuthorizationDecision; import org.springframework.security.authorization.AuthorizationDecision;
import org.springframework.security.authorization.ReactiveAuthorizationManager; import org.springframework.security.authorization.ReactiveAuthorizationManager;
@ -301,7 +301,7 @@ public class HttpSecurity {
} }
public AuthorizeExchangeBuilder authenticated() { public AuthorizeExchangeBuilder authenticated() {
return access(AuthenticatedAuthorizationManager.authenticated()); return access(AuthenticatedReactiveAuthorizationManager.authenticated());
} }
public AuthorizeExchangeBuilder access(ReactiveAuthorizationManager<AuthorizationContext> manager) { public AuthorizeExchangeBuilder access(ReactiveAuthorizationManager<AuthorizationContext> manager) {

View File

@ -23,7 +23,7 @@ import reactor.core.publisher.Mono;
* @author Rob Winch * @author Rob Winch
* @since 5.0 * @since 5.0
*/ */
public class AuthenticatedAuthorizationManager<T> implements ReactiveAuthorizationManager<T> { public class AuthenticatedReactiveAuthorizationManager<T> implements ReactiveAuthorizationManager<T> {
@Override @Override
public Mono<AuthorizationDecision> check(Mono<Authentication> authentication, T object) { public Mono<AuthorizationDecision> check(Mono<Authentication> authentication, T object) {
@ -32,9 +32,9 @@ public class AuthenticatedAuthorizationManager<T> implements ReactiveAuthorizati
.defaultIfEmpty(new AuthorizationDecision(false)); .defaultIfEmpty(new AuthorizationDecision(false));
} }
public static <T> AuthenticatedAuthorizationManager<T> authenticated() { public static <T> AuthenticatedReactiveAuthorizationManager<T> authenticated() {
return new AuthenticatedAuthorizationManager<>(); return new AuthenticatedReactiveAuthorizationManager<>();
} }
private AuthenticatedAuthorizationManager() {} private AuthenticatedReactiveAuthorizationManager() {}
} }

View File

@ -16,7 +16,6 @@
package org.springframework.security.authorization; package org.springframework.security.authorization;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -33,11 +32,12 @@ import static org.mockito.Mockito.when;
* @since 5.0 * @since 5.0
*/ */
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class AuthenticatedAuthorizationManagerTests { public class AuthenticatedReactiveAuthorizationManagerTests {
@Mock @Mock
Authentication authentication; Authentication authentication;
AuthenticatedAuthorizationManager<Object> manager = AuthenticatedAuthorizationManager.authenticated(); AuthenticatedReactiveAuthorizationManager<Object> manager = AuthenticatedReactiveAuthorizationManager
.authenticated();
@Test @Test
public void checkWhenAuthenticatedThenReturnTrue() { public void checkWhenAuthenticatedThenReturnTrue() {