From b2ec1bb7a793875e30201f442a167b80297e6af5 Mon Sep 17 00:00:00 2001 From: Adrian Damian Date: Wed, 10 Jul 2024 14:37:40 -0700 Subject: [PATCH] Changes after code review --- .../ca/nrc/cadc/auth/OpenIdPrincipal.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cadc-util/src/main/java/ca/nrc/cadc/auth/OpenIdPrincipal.java b/cadc-util/src/main/java/ca/nrc/cadc/auth/OpenIdPrincipal.java index f8776f2e..8887edb2 100644 --- a/cadc-util/src/main/java/ca/nrc/cadc/auth/OpenIdPrincipal.java +++ b/cadc-util/src/main/java/ca/nrc/cadc/auth/OpenIdPrincipal.java @@ -45,28 +45,29 @@ public class OpenIdPrincipal implements Principal, Serializable { private static final long serialVersionUID = 202407041230L; - private String openID; - private URL issuer; + private final String sub; + private final URL issuer; /** * Ctor - * - * @param openID + * + * @param issuer The issuer of the Open ID + * @param sub Subject identifier. */ - public OpenIdPrincipal(final URL issuer, final String openID) { + public OpenIdPrincipal(final URL issuer, final String sub) { if (issuer == null) { throw new IllegalArgumentException("null issuer"); } - if (openID == null) { - throw new IllegalArgumentException("null openID"); + if (sub == null) { + throw new IllegalArgumentException("null sub"); } - this.openID = openID; + this.sub = sub; this.issuer = issuer; } @Override public String getName() { - return openID; + return sub; } public URL getIssuer() { @@ -82,7 +83,7 @@ public URL getIssuer() { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + openID.hashCode() + issuer.hashCode(); + result = prime * result + sub.hashCode() + issuer.hashCode(); return result; } @@ -103,7 +104,7 @@ public boolean equals(Object obj) { return false; } OpenIdPrincipal other = (OpenIdPrincipal) obj; - return openID.equals(other.openID) && issuer.equals(other.issuer); + return sub.equals(other.sub) && issuer.equals(other.issuer); } @Override