File tree Expand file tree Collapse file tree 4 files changed +11
-14
lines changed
core/src/main/java/org/springframework/security
ldap/src/main/java/org/springframework/security/ldap/userdetails
web/src/main/java/org/springframework/security/web/authentication/switchuser Expand file tree Collapse file tree 4 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -58,9 +58,8 @@ public boolean equals(Object obj) {
5858 if (this == obj ) {
5959 return true ;
6060 }
61- if (obj instanceof JaasGrantedAuthority ) {
62- JaasGrantedAuthority jga = (JaasGrantedAuthority ) obj ;
63- return this .role .equals (jga .role ) && this .principal .equals (jga .principal );
61+ if (obj instanceof JaasGrantedAuthority jga ) {
62+ return this .role .equals (jga .getAuthority ()) && this .principal .equals (jga .getPrincipal ());
6463 }
6564 return false ;
6665 }
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2016 the original author or authors.
2+ * Copyright 2002-2023 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -50,8 +50,8 @@ public boolean equals(Object obj) {
5050 if (this == obj ) {
5151 return true ;
5252 }
53- if (obj instanceof SimpleGrantedAuthority ) {
54- return this .role .equals ((( SimpleGrantedAuthority ) obj ). role );
53+ if (obj instanceof SimpleGrantedAuthority sga ) {
54+ return this .role .equals (sga . getAuthority () );
5555 }
5656 return false ;
5757 }
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2023 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -113,14 +113,13 @@ public boolean equals(Object obj) {
113113 if (this == obj ) {
114114 return true ;
115115 }
116- if (!(obj instanceof LdapAuthority )) {
116+ if (!(obj instanceof LdapAuthority other )) {
117117 return false ;
118118 }
119- LdapAuthority other = (LdapAuthority ) obj ;
120- if (!this .dn .equals (other .dn )) {
119+ if (!this .dn .equals (other .getDn ())) {
121120 return false ;
122121 }
123- return this .role .equals (other .role );
122+ return this .role .equals (other .getAuthority () );
124123 }
125124
126125 @ Override
Original file line number Diff line number Diff line change @@ -64,9 +64,8 @@ public boolean equals(Object obj) {
6464 if (this == obj ) {
6565 return true ;
6666 }
67- if (obj instanceof SwitchUserGrantedAuthority ) {
68- SwitchUserGrantedAuthority swa = (SwitchUserGrantedAuthority ) obj ;
69- return this .role .equals (swa .role ) && this .source .equals (swa .source );
67+ if (obj instanceof SwitchUserGrantedAuthority swa ) {
68+ return this .role .equals (swa .getAuthority ()) && this .source .equals (swa .getSource ());
7069 }
7170 return false ;
7271 }
You can’t perform that action at this time.
0 commit comments