Use consistent "@" tag order in Javadoc
Ensure that Javadoc "@" tags appear in a consistent and well defined order. Issue gh-8945
This commit is contained in:
+14
-10
@@ -17,7 +17,9 @@ package org.springframework.security.access.prepost;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.security.access.ConfigAttribute;
|
||||
@@ -41,9 +43,9 @@ import org.springframework.util.ClassUtils;
|
||||
* combine annotations defined in multiple locations for a single method - they may be
|
||||
* defined on the method itself, or at interface or class level.
|
||||
*
|
||||
* @see PreInvocationAuthorizationAdviceVoter
|
||||
* @author Luke Taylor
|
||||
* @since 3.0
|
||||
* @see PreInvocationAuthorizationAdviceVoter
|
||||
*/
|
||||
public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecurityMetadataSource {
|
||||
|
||||
@@ -53,12 +55,13 @@ public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecur
|
||||
this.attributeFactory = attributeFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConfigAttribute> getAttributes(Method method, Class<?> targetClass) {
|
||||
if (method.getDeclaringClass() == Object.class) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
logger.trace("Looking for Pre/Post annotations for method '" + method.getName() + "' on target class '"
|
||||
this.logger.trace("Looking for Pre/Post annotations for method '" + method.getName() + "' on target class '"
|
||||
+ targetClass + "'");
|
||||
PreFilter preFilter = findAnnotation(method, targetClass, PreFilter.class);
|
||||
PreAuthorize preAuthorize = findAnnotation(method, targetClass, PreAuthorize.class);
|
||||
@@ -68,7 +71,7 @@ public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecur
|
||||
|
||||
if (preFilter == null && preAuthorize == null && postFilter == null && postAuthorize == null) {
|
||||
// There is no meta-data so return
|
||||
logger.trace("No expression annotations found");
|
||||
this.logger.trace("No expression annotations found");
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -80,14 +83,14 @@ public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecur
|
||||
|
||||
ArrayList<ConfigAttribute> attrs = new ArrayList<>(2);
|
||||
|
||||
PreInvocationAttribute pre = attributeFactory.createPreInvocationAttribute(preFilterAttribute, filterObject,
|
||||
preAuthorizeAttribute);
|
||||
PreInvocationAttribute pre = this.attributeFactory.createPreInvocationAttribute(preFilterAttribute,
|
||||
filterObject, preAuthorizeAttribute);
|
||||
|
||||
if (pre != null) {
|
||||
attrs.add(pre);
|
||||
}
|
||||
|
||||
PostInvocationAttribute post = attributeFactory.createPostInvocationAttribute(postFilterAttribute,
|
||||
PostInvocationAttribute post = this.attributeFactory.createPostInvocationAttribute(postFilterAttribute,
|
||||
postAuthorizeAttribute);
|
||||
|
||||
if (post != null) {
|
||||
@@ -99,6 +102,7 @@ public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecur
|
||||
return attrs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConfigAttribute> getAllConfigAttributes() {
|
||||
return null;
|
||||
}
|
||||
@@ -117,7 +121,7 @@ public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecur
|
||||
A annotation = AnnotationUtils.findAnnotation(specificMethod, annotationClass);
|
||||
|
||||
if (annotation != null) {
|
||||
logger.debug(annotation + " found on specific method: " + specificMethod);
|
||||
this.logger.debug(annotation + " found on specific method: " + specificMethod);
|
||||
return annotation;
|
||||
}
|
||||
|
||||
@@ -126,7 +130,7 @@ public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecur
|
||||
annotation = AnnotationUtils.findAnnotation(method, annotationClass);
|
||||
|
||||
if (annotation != null) {
|
||||
logger.debug(annotation + " found on: " + method);
|
||||
this.logger.debug(annotation + " found on: " + method);
|
||||
return annotation;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +140,7 @@ public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecur
|
||||
annotation = AnnotationUtils.findAnnotation(specificMethod.getDeclaringClass(), annotationClass);
|
||||
|
||||
if (annotation != null) {
|
||||
logger.debug(annotation + " found on: " + specificMethod.getDeclaringClass().getName());
|
||||
this.logger.debug(annotation + " found on: " + specificMethod.getDeclaringClass().getName());
|
||||
return annotation;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -260,10 +260,9 @@ public class JaasAuthenticationProvider extends AbstractJaasAuthenticationProvid
|
||||
/**
|
||||
* If set, a call to {@code Configuration#refresh()} will be made by
|
||||
* {@code #configureJaas(Resource) } method. Defaults to {@code true}.
|
||||
*
|
||||
* @see <a href="https://jira.springsource.org/browse/SEC-1320">SEC-1320</a>
|
||||
* @param refresh set to {@code false} to disable reloading of the configuration. May
|
||||
* be useful in some environments.
|
||||
* @see <a href="https://jira.springsource.org/browse/SEC-1320">SEC-1320</a>
|
||||
*/
|
||||
public void setRefreshConfigurationOnStartup(boolean refresh) {
|
||||
this.refreshConfigurationOnStartup = refresh;
|
||||
|
||||
+5
-5
@@ -16,19 +16,19 @@
|
||||
|
||||
package org.springframework.security.authorization;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.security.authentication.AuthenticationTrustResolver;
|
||||
import org.springframework.security.authentication.AuthenticationTrustResolverImpl;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* A {@link ReactiveAuthorizationManager} that determines if the current user is
|
||||
* authenticated.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
* @param <T> The type of object authorization is being performed against. This does not
|
||||
* matter since the authorization decision does not use the object.
|
||||
* @author Rob Winch
|
||||
* @since 5.0 matter since the authorization decision does not use the object.
|
||||
*/
|
||||
public class AuthenticatedReactiveAuthorizationManager<T> implements ReactiveAuthorizationManager<T> {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class AuthenticatedReactiveAuthorizationManager<T> implements ReactiveAut
|
||||
* @return <code>true</code> if not anonymous, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean isNotAnonymous(Authentication authentication) {
|
||||
return !authTrustResolver.isAnonymous(authentication);
|
||||
return !this.authTrustResolver.isAnonymous(authentication);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-5
@@ -16,20 +16,21 @@
|
||||
|
||||
package org.springframework.security.authorization;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.util.Assert;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* A {@link ReactiveAuthorizationManager} that determines if the current user is
|
||||
* authorized by evaluating if the {@link Authentication} contains a specified authority.
|
||||
*
|
||||
* @param <T> the type of object being authorized
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
* @param <T> the type of object being authorized
|
||||
*/
|
||||
public class AuthorityReactiveAuthorizationManager<T> implements ReactiveAuthorizationManager<T> {
|
||||
|
||||
|
||||
+3
-3
@@ -15,18 +15,18 @@
|
||||
*/
|
||||
package org.springframework.security.authorization;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* A reactive authorization manager which can determine if an {@link Authentication} has
|
||||
* access to a specific object.
|
||||
*
|
||||
* @param <T> the type of object that the authorization check is being done one.
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
* @param <T> the type of object that the authorization check is being done one.
|
||||
*/
|
||||
public interface ReactiveAuthorizationManager<T> {
|
||||
|
||||
|
||||
@@ -78,11 +78,11 @@ import java.util.Stack;
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @author Kenney Westerhof
|
||||
* @author Hervé Boutemy
|
||||
* @see <a href=
|
||||
* "https://cwiki.apache.org/confluence/display/MAVENOLD/Versioning">"Versioning" on Maven
|
||||
* Wiki</a>
|
||||
* @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
|
||||
* @author <a href="mailto:hboutemy@apache.org">Hervé Boutemy</a>
|
||||
*/
|
||||
class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
|
||||
@@ -134,18 +134,18 @@ class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return BigInteger_ZERO.equals(value);
|
||||
return BigInteger_ZERO.equals(this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Item item) {
|
||||
if (item == null) {
|
||||
return BigInteger_ZERO.equals(value) ? 0 : 1; // 1.0 == 1, 1.1 > 1
|
||||
return BigInteger_ZERO.equals(this.value) ? 0 : 1; // 1.0 == 1, 1.1 > 1
|
||||
}
|
||||
|
||||
switch (item.getType()) {
|
||||
case INTEGER_ITEM:
|
||||
return value.compareTo(((IntegerItem) item).value);
|
||||
return this.value.compareTo(((IntegerItem) item).value);
|
||||
|
||||
case STRING_ITEM:
|
||||
return 1; // 1.1 > 1-sp
|
||||
@@ -160,7 +160,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
return this.value.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -215,7 +215,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return (comparableQualifier(value).compareTo(RELEASE_VERSION_INDEX) == 0);
|
||||
return (comparableQualifier(this.value).compareTo(RELEASE_VERSION_INDEX) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,14 +241,14 @@ class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
public int compareTo(Item item) {
|
||||
if (item == null) {
|
||||
// 1-rc < 1, 1-ga > 1
|
||||
return comparableQualifier(value).compareTo(RELEASE_VERSION_INDEX);
|
||||
return comparableQualifier(this.value).compareTo(RELEASE_VERSION_INDEX);
|
||||
}
|
||||
switch (item.getType()) {
|
||||
case INTEGER_ITEM:
|
||||
return -1; // 1.any < 1.1 ?
|
||||
|
||||
case STRING_ITEM:
|
||||
return comparableQualifier(value).compareTo(comparableQualifier(((StringItem) item).value));
|
||||
return comparableQualifier(this.value).compareTo(comparableQualifier(((StringItem) item).value));
|
||||
|
||||
case LIST_ITEM:
|
||||
return -1; // 1.any < 1-1
|
||||
@@ -260,7 +260,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -354,11 +354,11 @@ class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
public final void parseVersion(String version) {
|
||||
this.value = version;
|
||||
|
||||
items = new ListItem();
|
||||
this.items = new ListItem();
|
||||
|
||||
version = version.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
ListItem list = items;
|
||||
ListItem list = this.items;
|
||||
|
||||
Stack<Item> stack = new Stack<>();
|
||||
stack.push(list);
|
||||
@@ -428,7 +428,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
list.normalize();
|
||||
}
|
||||
|
||||
canonical = items.toString();
|
||||
this.canonical = this.items.toString();
|
||||
}
|
||||
|
||||
private static Item parseItem(boolean isDigit, String buf) {
|
||||
@@ -437,22 +437,22 @@ class ComparableVersion implements Comparable<ComparableVersion> {
|
||||
|
||||
@Override
|
||||
public int compareTo(ComparableVersion o) {
|
||||
return items.compareTo(o.items);
|
||||
return this.items.compareTo(o.items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return (o instanceof ComparableVersion) && canonical.equals(((ComparableVersion) o).canonical);
|
||||
return (o instanceof ComparableVersion) && this.canonical.equals(((ComparableVersion) o).canonical);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return canonical.hashCode();
|
||||
return this.canonical.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-3
@@ -81,9 +81,9 @@ import org.springframework.util.ReflectionUtils;
|
||||
* {@link PrioritizedParameterNameDiscoverer} are an all or nothing operation.
|
||||
* </p>
|
||||
*
|
||||
* @see DefaultSecurityParameterNameDiscoverer
|
||||
* @author Rob Winch
|
||||
* @since 3.2
|
||||
* @see DefaultSecurityParameterNameDiscoverer
|
||||
*/
|
||||
public class AnnotationParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||
|
||||
@@ -104,6 +104,7 @@ public class AnnotationParameterNameDiscoverer implements ParameterNameDiscovere
|
||||
* @see org.springframework.core.ParameterNameDiscoverer#getParameterNames(java
|
||||
* .lang.reflect.Method)
|
||||
*/
|
||||
@Override
|
||||
public String[] getParameterNames(Method method) {
|
||||
Method originalMethod = BridgeMethodResolver.findBridgedMethod(method);
|
||||
String[] paramNames = lookupParameterNames(METHOD_METHODPARAM_FACTORY, originalMethod);
|
||||
@@ -127,6 +128,7 @@ public class AnnotationParameterNameDiscoverer implements ParameterNameDiscovere
|
||||
* @see org.springframework.core.ParameterNameDiscoverer#getParameterNames(java
|
||||
* .lang.reflect.Constructor)
|
||||
*/
|
||||
@Override
|
||||
public String[] getParameterNames(Constructor<?> constructor) {
|
||||
return lookupParameterNames(CONSTRUCTOR_METHODPARAM_FACTORY, constructor);
|
||||
}
|
||||
@@ -164,7 +166,7 @@ public class AnnotationParameterNameDiscoverer implements ParameterNameDiscovere
|
||||
*/
|
||||
private String findParameterName(Annotation[] parameterAnnotations) {
|
||||
for (Annotation paramAnnotation : parameterAnnotations) {
|
||||
if (annotationClassesToUse.contains(paramAnnotation.annotationType().getName())) {
|
||||
if (this.annotationClassesToUse.contains(paramAnnotation.annotationType().getName())) {
|
||||
return (String) AnnotationUtils.getValue(paramAnnotation, "value");
|
||||
}
|
||||
}
|
||||
@@ -180,9 +182,9 @@ public class AnnotationParameterNameDiscoverer implements ParameterNameDiscovere
|
||||
/**
|
||||
* Strategy interface for looking up the parameter names.
|
||||
*
|
||||
* @param <T> the type to inspect (i.e. {@link Method} or {@link Constructor})
|
||||
* @author Rob Winch
|
||||
* @since 3.2
|
||||
* @param <T> the type to inspect (i.e. {@link Method} or {@link Constructor})
|
||||
*/
|
||||
private interface ParameterNameFactory<T extends AccessibleObject> {
|
||||
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
@@ -44,9 +45,9 @@ import org.springframework.util.ClassUtils;
|
||||
* {@link LocalVariableTableParameterNameDiscoverer} is added directly.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see AnnotationParameterNameDiscoverer
|
||||
* @author Rob Winch
|
||||
* @since 3.2
|
||||
* @see AnnotationParameterNameDiscoverer
|
||||
*/
|
||||
public class DefaultSecurityParameterNameDiscoverer extends PrioritizedParameterNameDiscoverer {
|
||||
|
||||
|
||||
+41
-28
@@ -16,16 +16,22 @@
|
||||
|
||||
package org.springframework.security.core.session;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Default implementation of
|
||||
* {@link org.springframework.security.core.session.SessionRegistry SessionRegistry} which
|
||||
@@ -44,10 +50,10 @@ public class SessionRegistryImpl implements SessionRegistry, ApplicationListener
|
||||
|
||||
protected final Log logger = LogFactory.getLog(SessionRegistryImpl.class);
|
||||
|
||||
/** <principal:Object,SessionIdSet> */
|
||||
// <principal:Object,SessionIdSet>
|
||||
private final ConcurrentMap<Object, Set<String>> principals;
|
||||
|
||||
/** <sessionId:Object,SessionInformation> */
|
||||
// <sessionId:Object,SessionInformation>
|
||||
private final Map<String, SessionInformation> sessionIds;
|
||||
|
||||
public SessionRegistryImpl() {
|
||||
@@ -61,12 +67,14 @@ public class SessionRegistryImpl implements SessionRegistry, ApplicationListener
|
||||
this.sessionIds = sessionIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> getAllPrincipals() {
|
||||
return new ArrayList<>(principals.keySet());
|
||||
return new ArrayList<>(this.principals.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SessionInformation> getAllSessions(Object principal, boolean includeExpiredSessions) {
|
||||
final Set<String> sessionsUsedByPrincipal = principals.get(principal);
|
||||
final Set<String> sessionsUsedByPrincipal = this.principals.get(principal);
|
||||
|
||||
if (sessionsUsedByPrincipal == null) {
|
||||
return Collections.emptyList();
|
||||
@@ -89,12 +97,14 @@ public class SessionRegistryImpl implements SessionRegistry, ApplicationListener
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionInformation getSessionInformation(String sessionId) {
|
||||
Assert.hasText(sessionId, "SessionId required as per interface contract");
|
||||
|
||||
return sessionIds.get(sessionId);
|
||||
return this.sessionIds.get(sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(AbstractSessionEvent event) {
|
||||
if (event instanceof SessionDestroyedEvent) {
|
||||
SessionDestroyedEvent sessionDestroyedEvent = (SessionDestroyedEvent) event;
|
||||
@@ -104,12 +114,13 @@ public class SessionRegistryImpl implements SessionRegistry, ApplicationListener
|
||||
else if (event instanceof SessionIdChangedEvent) {
|
||||
SessionIdChangedEvent sessionIdChangedEvent = (SessionIdChangedEvent) event;
|
||||
String oldSessionId = sessionIdChangedEvent.getOldSessionId();
|
||||
Object principal = sessionIds.get(oldSessionId).getPrincipal();
|
||||
Object principal = this.sessionIds.get(oldSessionId).getPrincipal();
|
||||
removeSessionInformation(oldSessionId);
|
||||
registerNewSession(sessionIdChangedEvent.getNewSessionId(), principal);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshLastRequest(String sessionId) {
|
||||
Assert.hasText(sessionId, "SessionId required as per interface contract");
|
||||
|
||||
@@ -120,6 +131,7 @@ public class SessionRegistryImpl implements SessionRegistry, ApplicationListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerNewSession(String sessionId, Object principal) {
|
||||
Assert.hasText(sessionId, "SessionId required as per interface contract");
|
||||
Assert.notNull(principal, "Principal required as per interface contract");
|
||||
@@ -128,25 +140,26 @@ public class SessionRegistryImpl implements SessionRegistry, ApplicationListener
|
||||
removeSessionInformation(sessionId);
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Registering session " + sessionId + ", for principal " + principal);
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Registering session " + sessionId + ", for principal " + principal);
|
||||
}
|
||||
|
||||
sessionIds.put(sessionId, new SessionInformation(principal, sessionId, new Date()));
|
||||
this.sessionIds.put(sessionId, new SessionInformation(principal, sessionId, new Date()));
|
||||
|
||||
principals.compute(principal, (key, sessionsUsedByPrincipal) -> {
|
||||
this.principals.compute(principal, (key, sessionsUsedByPrincipal) -> {
|
||||
if (sessionsUsedByPrincipal == null) {
|
||||
sessionsUsedByPrincipal = new CopyOnWriteArraySet<>();
|
||||
}
|
||||
sessionsUsedByPrincipal.add(sessionId);
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Sessions used by '" + principal + "' : " + sessionsUsedByPrincipal);
|
||||
if (this.logger.isTraceEnabled()) {
|
||||
this.logger.trace("Sessions used by '" + principal + "' : " + sessionsUsedByPrincipal);
|
||||
}
|
||||
return sessionsUsedByPrincipal;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSessionInformation(String sessionId) {
|
||||
Assert.hasText(sessionId, "SessionId required as per interface contract");
|
||||
|
||||
@@ -156,29 +169,29 @@ public class SessionRegistryImpl implements SessionRegistry, ApplicationListener
|
||||
return;
|
||||
}
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.debug("Removing session " + sessionId + " from set of registered sessions");
|
||||
if (this.logger.isTraceEnabled()) {
|
||||
this.logger.debug("Removing session " + sessionId + " from set of registered sessions");
|
||||
}
|
||||
|
||||
sessionIds.remove(sessionId);
|
||||
this.sessionIds.remove(sessionId);
|
||||
|
||||
principals.computeIfPresent(info.getPrincipal(), (key, sessionsUsedByPrincipal) -> {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Removing session " + sessionId + " from principal's set of registered sessions");
|
||||
this.principals.computeIfPresent(info.getPrincipal(), (key, sessionsUsedByPrincipal) -> {
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Removing session " + sessionId + " from principal's set of registered sessions");
|
||||
}
|
||||
|
||||
sessionsUsedByPrincipal.remove(sessionId);
|
||||
|
||||
if (sessionsUsedByPrincipal.isEmpty()) {
|
||||
// No need to keep object in principals Map anymore
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Removing principal " + info.getPrincipal() + " from registry");
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Removing principal " + info.getPrincipal() + " from registry");
|
||||
}
|
||||
sessionsUsedByPrincipal = null;
|
||||
}
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Sessions used by '" + info.getPrincipal() + "' : " + sessionsUsedByPrincipal);
|
||||
if (this.logger.isTraceEnabled()) {
|
||||
this.logger.trace("Sessions used by '" + info.getPrincipal() + "' : " + sessionsUsedByPrincipal);
|
||||
}
|
||||
return sessionsUsedByPrincipal;
|
||||
});
|
||||
|
||||
@@ -32,8 +32,8 @@ package org.springframework.security.core.userdetails;
|
||||
* configure a cache to store the <tt>UserDetails</tt> information rather than loading it
|
||||
* each time.
|
||||
*
|
||||
* @see org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
|
||||
* @author Ben Alex
|
||||
* @see org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
|
||||
*/
|
||||
public interface UserCache {
|
||||
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package org.springframework.security.core.userdetails;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
|
||||
/**
|
||||
* Provides core user information.
|
||||
*
|
||||
@@ -36,9 +36,9 @@ import java.util.Collection;
|
||||
* {@link org.springframework.security.core.userdetails.User} for a reference
|
||||
* implementation (which you might like to extend or use in your code).
|
||||
*
|
||||
* @author Ben Alex
|
||||
* @see UserDetailsService
|
||||
* @see UserCache
|
||||
* @author Ben Alex
|
||||
*/
|
||||
public interface UserDetails extends Serializable {
|
||||
|
||||
|
||||
+1
-1
@@ -27,9 +27,9 @@ package org.springframework.security.core.userdetails;
|
||||
* The interface requires only one read-only method, which simplifies support for new
|
||||
* data-access strategies.
|
||||
*
|
||||
* @author Ben Alex
|
||||
* @see org.springframework.security.authentication.dao.DaoAuthenticationProvider
|
||||
* @see UserDetails
|
||||
* @author Ben Alex
|
||||
*/
|
||||
public interface UserDetailsService {
|
||||
|
||||
|
||||
+6
-6
@@ -16,6 +16,11 @@
|
||||
|
||||
package org.springframework.security.jackson2;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
@@ -24,17 +29,12 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Custom deserializer for {@link UnmodifiableListDeserializer}.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @see UnmodifiableListMixin
|
||||
* @since 5.0.2
|
||||
* @see UnmodifiableListMixin
|
||||
*/
|
||||
class UnmodifiableListDeserializer extends JsonDeserializer<List> {
|
||||
|
||||
|
||||
+6
-6
@@ -16,6 +16,11 @@
|
||||
|
||||
package org.springframework.security.jackson2;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
@@ -24,17 +29,12 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Custom deserializer for {@link UnmodifiableSetMixin}.
|
||||
*
|
||||
* @author Jitendra Singh
|
||||
* @see UnmodifiableSetMixin
|
||||
* @since 4.2
|
||||
* @see UnmodifiableSetMixin
|
||||
*/
|
||||
class UnmodifiableSetDeserializer extends JsonDeserializer<Set> {
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.springframework.security.jackson2;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
@@ -24,20 +27,18 @@ import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.MissingNode;
|
||||
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Custom Deserializer for {@link User} class. This is already registered with
|
||||
* {@link UserMixin}. You can also use it directly with your mixin class.
|
||||
*
|
||||
* @author Jitendra Singh
|
||||
* @see UserMixin
|
||||
* @since 4.2
|
||||
* @see UserMixin
|
||||
*/
|
||||
class UserDeserializer extends JsonDeserializer<User> {
|
||||
|
||||
|
||||
+1
-1
@@ -43,8 +43,8 @@ import org.springframework.security.core.GrantedAuthority;
|
||||
* @author Jitendra Singh
|
||||
* @author Greg Turnquist
|
||||
* @author Onur Kagan Ozcan
|
||||
* @see UsernamePasswordAuthenticationTokenMixin
|
||||
* @since 4.2
|
||||
* @see UsernamePasswordAuthenticationTokenMixin
|
||||
*/
|
||||
class UsernamePasswordAuthenticationTokenDeserializer extends JsonDeserializer<UsernamePasswordAuthenticationToken> {
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class MethodInvocationFactory {
|
||||
/**
|
||||
* In order to reproduce the bug for SEC-2150, we must have a proxy object that
|
||||
* implements TargetSourceAware and implements our annotated interface.
|
||||
* @return
|
||||
* @return the mock method invocation
|
||||
* @throws NoSuchMethodException
|
||||
*/
|
||||
public static MockMethodInvocation createSec2150MethodInvocation() throws NoSuchMethodException {
|
||||
|
||||
Reference in New Issue
Block a user