Polish Javadoc
Fixes: gh-5186
This commit is contained in:
+9
@@ -36,6 +36,9 @@ import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A {@link MethodInterceptor} that supports {@link PreAuthorize} and {@link PostAuthorize} for methods that return
|
||||
* {@link Mono} or {@link Flux}
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
@@ -49,6 +52,12 @@ public class PrePostAdviceReactiveMethodInterceptor implements MethodInterceptor
|
||||
|
||||
private final PostInvocationAuthorizationAdvice postAdvice;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
* @param attributeSource the {@link MethodSecurityMetadataSource} to use
|
||||
* @param preInvocationAdvice the {@link PreInvocationAuthorizationAdvice} to use
|
||||
* @param postInvocationAdvice the {@link PostInvocationAuthorizationAdvice} to use
|
||||
*/
|
||||
public PrePostAdviceReactiveMethodInterceptor(MethodSecurityMetadataSource attributeSource, PreInvocationAuthorizationAdvice preInvocationAdvice, PostInvocationAuthorizationAdvice postInvocationAdvice) {
|
||||
Assert.notNull(attributeSource, "attributeSource cannot be null");
|
||||
Assert.notNull(preInvocationAdvice, "preInvocationAdvice cannot be null");
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ import reactor.core.publisher.Mono;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ReactiveAuthenticationManager {
|
||||
|
||||
/**
|
||||
|
||||
+8
@@ -26,6 +26,9 @@ import reactor.core.publisher.Mono;
|
||||
import reactor.core.scheduler.Schedulers;
|
||||
|
||||
/**
|
||||
* A {@link ReactiveAuthenticationManager} that uses a {@link ReactiveUserDetailsService} to validate the provided
|
||||
* username and password.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
@@ -49,6 +52,11 @@ public class UserDetailsRepositoryReactiveAuthenticationManager implements React
|
||||
.map( u -> new UsernamePasswordAuthenticationToken(u, u.getPassword(), u.getAuthorities()) );
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link PasswordEncoder} that is used for validating the password. The default is
|
||||
* {@link PasswordEncoderFactories#createDelegatingPasswordEncoder()}
|
||||
* @param passwordEncoder the {@link PasswordEncoder} to use. Cannot be null
|
||||
*/
|
||||
public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
|
||||
Assert.notNull(passwordEncoder, "passwordEncoder cannot be null");
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
|
||||
+13
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* A {@link Map} based implementation of {@link ReactiveUserDetailsService}
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
@@ -33,14 +34,26 @@ import reactor.core.publisher.Mono;
|
||||
public class MapReactiveUserDetailsService implements ReactiveUserDetailsService {
|
||||
private final Map<String, UserDetails> users;
|
||||
|
||||
/**
|
||||
* Creates a new instance using a {@link Map} that must be non blocking.
|
||||
* @param users a {@link Map} of users to use.
|
||||
*/
|
||||
public MapReactiveUserDetailsService(Map<String, UserDetails> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
* @param users the {@link UserDetails} to use
|
||||
*/
|
||||
public MapReactiveUserDetailsService(UserDetails... users) {
|
||||
this(Arrays.asList(users));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
* @param users the {@link UserDetails} to use
|
||||
*/
|
||||
public MapReactiveUserDetailsService(Collection<UserDetails> users) {
|
||||
Assert.notEmpty(users, "users cannot be null or empty");
|
||||
this.users = users.stream().collect(Collectors.toConcurrentMap( u -> getKey(u.getUsername()), Function.identity()));
|
||||
|
||||
+11
-2
@@ -16,11 +16,20 @@
|
||||
|
||||
package org.springframework.security.core.userdetails;
|
||||
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* An API for finding the {@link UserDetails} by username.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public interface ReactiveUserDetailsService {
|
||||
|
||||
/**
|
||||
* Find the {@link UserDetails} by username.
|
||||
* @param username the username to look up
|
||||
* @return the {@link UserDetails}. Cannot be null
|
||||
*/
|
||||
Mono<UserDetails> findByUsername(String username);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user