Merge branch '6.1.x'
This commit is contained in:
commit
75e0068925
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2023 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.
|
||||||
|
@ -127,11 +127,7 @@ final class FilterOrderRegistration {
|
||||||
* @param position the position to associate with the {@link Filter}
|
* @param position the position to associate with the {@link Filter}
|
||||||
*/
|
*/
|
||||||
void put(Class<? extends Filter> filter, int position) {
|
void put(Class<? extends Filter> filter, int position) {
|
||||||
String className = filter.getName();
|
this.filterToOrder.putIfAbsent(filter.getName(), position);
|
||||||
if (this.filterToOrder.containsKey(className)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.filterToOrder.put(className, position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,14 +68,14 @@ public abstract class AbstractAuthenticationToken implements Authentication, Cre
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
if (this.getPrincipal() instanceof UserDetails) {
|
if (this.getPrincipal() instanceof UserDetails userDetails) {
|
||||||
return ((UserDetails) this.getPrincipal()).getUsername();
|
return userDetails.getUsername();
|
||||||
}
|
}
|
||||||
if (this.getPrincipal() instanceof AuthenticatedPrincipal) {
|
if (this.getPrincipal() instanceof AuthenticatedPrincipal authenticatedPrincipal) {
|
||||||
return ((AuthenticatedPrincipal) this.getPrincipal()).getName();
|
return authenticatedPrincipal.getName();
|
||||||
}
|
}
|
||||||
if (this.getPrincipal() instanceof Principal) {
|
if (this.getPrincipal() instanceof Principal principal) {
|
||||||
return ((Principal) this.getPrincipal()).getName();
|
return principal.getName();
|
||||||
}
|
}
|
||||||
return (this.getPrincipal() == null) ? "" : this.getPrincipal().toString();
|
return (this.getPrincipal() == null) ? "" : this.getPrincipal().toString();
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,9 @@ public abstract class AbstractAuthenticationToken implements Authentication, Cre
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof AbstractAuthenticationToken)) {
|
if (!(obj instanceof AbstractAuthenticationToken test)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AbstractAuthenticationToken test = (AbstractAuthenticationToken) obj;
|
|
||||||
if (!this.authorities.equals(test.authorities)) {
|
if (!this.authorities.equals(test.authorities)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,7 @@ public class AnonymousAuthenticationToken extends AbstractAuthenticationToken im
|
||||||
if (!super.equals(obj)) {
|
if (!super.equals(obj)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (obj instanceof AnonymousAuthenticationToken) {
|
if (obj instanceof AnonymousAuthenticationToken test) {
|
||||||
AnonymousAuthenticationToken test = (AnonymousAuthenticationToken) obj;
|
|
||||||
return (this.getKeyHash() == test.getKeyHash());
|
return (this.getKeyHash() == test.getKeyHash());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -59,7 +59,7 @@ public final class JaasGrantedAuthority implements GrantedAuthority {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof JaasGrantedAuthority jga) {
|
if (obj instanceof JaasGrantedAuthority jga) {
|
||||||
return this.role.equals(jga.role) && this.principal.equals(jga.principal);
|
return this.role.equals(jga.getAuthority()) && this.principal.equals(jga.getPrincipal());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2023 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.
|
||||||
|
@ -50,8 +50,8 @@ public final class SimpleGrantedAuthority implements GrantedAuthority {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof SimpleGrantedAuthority) {
|
if (obj instanceof SimpleGrantedAuthority sga) {
|
||||||
return this.role.equals(((SimpleGrantedAuthority) obj).role);
|
return this.role.equals(sga.getAuthority());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,8 +179,8 @@ public class User implements UserDetails, CredentialsContainer {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof User) {
|
if (obj instanceof User user) {
|
||||||
return this.username.equals(((User) obj).username);
|
return this.username.equals(user.getUsername());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2023 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.
|
||||||
|
@ -113,14 +113,13 @@ public class LdapAuthority implements GrantedAuthority {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(obj instanceof LdapAuthority)) {
|
if (!(obj instanceof LdapAuthority other)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LdapAuthority other = (LdapAuthority) obj;
|
if (!this.dn.equals(other.getDn())) {
|
||||||
if (!this.dn.equals(other.dn)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return this.role.equals(other.role);
|
return this.role.equals(other.getAuthority());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,9 +64,8 @@ public final class SwitchUserGrantedAuthority implements GrantedAuthority {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj instanceof SwitchUserGrantedAuthority) {
|
if (obj instanceof SwitchUserGrantedAuthority swa) {
|
||||||
SwitchUserGrantedAuthority swa = (SwitchUserGrantedAuthority) obj;
|
return this.role.equals(swa.getAuthority()) && this.source.equals(swa.getSource());
|
||||||
return this.role.equals(swa.role) && this.source.equals(swa.source);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,10 +127,9 @@ public class JaasApiIntegrationFilter extends GenericFilterBean {
|
||||||
if (!authentication.isAuthenticated()) {
|
if (!authentication.isAuthenticated()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!(authentication instanceof JaasAuthenticationToken)) {
|
if (!(authentication instanceof JaasAuthenticationToken token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JaasAuthenticationToken token = (JaasAuthenticationToken) authentication;
|
|
||||||
LoginContext loginContext = token.getLoginContext();
|
LoginContext loginContext = token.getLoginContext();
|
||||||
if (loginContext == null) {
|
if (loginContext == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue