Skip to content

Commit

Permalink
Changes after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Damian authored and Adrian Damian committed Jul 10, 2024
1 parent 3d7e422 commit b2ec1bb
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions cadc-util/src/main/java/ca/nrc/cadc/auth/OpenIdPrincipal.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
}

Expand All @@ -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
Expand Down

0 comments on commit b2ec1bb

Please sign in to comment.