mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-23 12:32:13 +00:00
Simplify condition in some methods
This commit is contained in:
parent
e76de931ce
commit
ab93541926
@ -115,15 +115,8 @@ public class CasAuthenticationToken extends AbstractAuthenticationToken implemen
|
|||||||
if (!super.equals(obj)) {
|
if (!super.equals(obj)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (obj instanceof CasAuthenticationToken) {
|
if (obj instanceof CasAuthenticationToken test) {
|
||||||
CasAuthenticationToken test = (CasAuthenticationToken) obj;
|
return this.assertion.equals(test.getAssertion()) && this.getKeyHash() == test.getKeyHash();
|
||||||
if (!this.assertion.equals(test.getAssertion())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.getKeyHash() != test.getKeyHash()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -43,12 +43,9 @@ final class ObjectToListStringConverter implements ConditionalGenericConverter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||||
if (targetType.getElementTypeDescriptor() == null
|
TypeDescriptor typeDescriptor = targetType.getElementTypeDescriptor();
|
||||||
|| targetType.getElementTypeDescriptor().getType().equals(String.class) || sourceType == null
|
return typeDescriptor == null || typeDescriptor.getType().equals(String.class) || sourceType == null
|
||||||
|| ClassUtils.isAssignable(sourceType.getType(), targetType.getElementTypeDescriptor().getType())) {
|
|| ClassUtils.isAssignable(sourceType.getType(), typeDescriptor.getType());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,11 +37,8 @@ final class ObjectToMapStringObjectConverter implements ConditionalGenericConver
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||||
if (targetType.getElementTypeDescriptor() == null
|
return targetType.getElementTypeDescriptor() == null
|
||||||
|| targetType.getMapKeyTypeDescriptor().getType().equals(String.class)) {
|
|| targetType.getMapKeyTypeDescriptor().getType().equals(String.class);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,10 +109,8 @@ public class AuthorizationFilter extends GenericFilterBean {
|
|||||||
if (DispatcherType.ERROR.equals(request.getDispatcherType()) && !this.filterErrorDispatch) {
|
if (DispatcherType.ERROR.equals(request.getDispatcherType()) && !this.filterErrorDispatch) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (DispatcherType.ASYNC.equals(request.getDispatcherType()) && !this.filterAsyncDispatch) {
|
|
||||||
return true;
|
return DispatcherType.ASYNC.equals(request.getDispatcherType()) && !this.filterAsyncDispatch;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isApplied(HttpServletRequest request) {
|
private boolean isApplied(HttpServletRequest request) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -87,10 +87,7 @@ public class DefaultHttpFirewall implements HttpFirewall {
|
|||||||
if (this.allowUrlEncodedSlash || uri == null) {
|
if (this.allowUrlEncodedSlash || uri == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (uri.contains("%2f") || uri.contains("%2F")) {
|
return uri.contains("%2f") || uri.contains("%2F");
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -611,10 +611,7 @@ public class StrictHttpFirewall implements HttpFirewall {
|
|||||||
if (valueContains(request.getServletPath(), value)) {
|
if (valueContains(request.getServletPath(), value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (valueContains(request.getPathInfo(), value)) {
|
return valueContains(request.getPathInfo(), value);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean containsOnlyPrintableAsciiCharacters(String uri) {
|
private static boolean containsOnlyPrintableAsciiCharacters(String uri) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -354,10 +354,7 @@ public class DefaultSavedRequest implements SavedRequest {
|
|||||||
if (arg1 == null || arg2 == null) {
|
if (arg1 == null || arg2 == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (arg1.equals(arg2)) {
|
return arg1.equals(arg2);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user