You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/12/04 16:06:35 UTC

[isis] branch master updated: ISIS-2464: fixes AuthenticationSessionAbstract#equals

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f134e5  ISIS-2464: fixes AuthenticationSessionAbstract#equals
7f134e5 is described below

commit 7f134e53f5a739706fb451880dfc49b45ac0dd59
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Dec 4 17:06:21 2020 +0100

    ISIS-2464: fixes AuthenticationSessionAbstract#equals
---
 .../isis/core/security/authentication/AuthenticationSession.java    | 6 +++---
 .../core/security/authentication/AuthenticationSessionAbstract.java | 5 ++++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/core/security/src/main/java/org/apache/isis/core/security/authentication/AuthenticationSession.java b/core/security/src/main/java/org/apache/isis/core/security/authentication/AuthenticationSession.java
index 92d2f37..930175f 100644
--- a/core/security/src/main/java/org/apache/isis/core/security/authentication/AuthenticationSession.java
+++ b/core/security/src/main/java/org/apache/isis/core/security/authentication/AuthenticationSession.java
@@ -30,9 +30,9 @@ import org.apache.isis.applib.services.user.UserMemento;
  */
 public interface AuthenticationSession extends Serializable {
 
-//    /**
-//     * The name of the authenticated user; for display purposes only.
-//     */
+    /**
+     * The name of the authenticated user; for display purposes only.
+     */
     default String getUserName() {
         return getUser().getName();
     }
diff --git a/core/security/src/main/java/org/apache/isis/core/security/authentication/AuthenticationSessionAbstract.java b/core/security/src/main/java/org/apache/isis/core/security/authentication/AuthenticationSessionAbstract.java
index 254fb91..3a1efc4 100644
--- a/core/security/src/main/java/org/apache/isis/core/security/authentication/AuthenticationSessionAbstract.java
+++ b/core/security/src/main/java/org/apache/isis/core/security/authentication/AuthenticationSessionAbstract.java
@@ -81,6 +81,9 @@ implements AuthenticationSession, Serializable {
     }
 
     private boolean isEqualsTo(final AuthenticationSessionAbstract other) {
+        if(!Objects.equals(this.getType(), other.getType())) {
+            return false;
+        }
         if(!Objects.equals(this.getValidationCode(), other.getValidationCode())) {
             return false;
         }
@@ -92,7 +95,7 @@ implements AuthenticationSession, Serializable {
 
     @Override
     public int hashCode() {
-        return getUserName().hashCode(); // its good enough to hash on just the user's name
+        return getUserName().hashCode(); // propably good enough to hash on just the user's name
     }
 
 }