Skip to content

Commit

Permalink
changes to support single-sign-on (sso)
Browse files Browse the repository at this point in the history
  • Loading branch information
ran-jit committed Apr 8, 2020
1 parent 80acc01 commit 0ecdfc2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/main/java/tomcat/request/session/model/SingleSignOnEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,21 @@ public synchronized void updateCredentials(Principal principal, String authType,
}

public void writeObjectData(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeBoolean(true);
out.writeObject(this.principal);
ObjectOutputStream outputStream = new ObjectOutputStream(out);
if (this.principal instanceof Serializable) {
outputStream.writeBoolean(true);
outputStream.writeObject(this.principal);
} else {
outputStream.writeBoolean(false);
}
outputStream.flush();
}

public void readObjectData(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
boolean hasPrincipal = in.readBoolean();
ObjectInputStream inputStream = new ObjectInputStream(in);
boolean hasPrincipal = inputStream.readBoolean();
if (hasPrincipal) {
this.principal = (Principal) in.readObject();
this.principal = (Principal) inputStream.readObject();
}
}
}

0 comments on commit 0ecdfc2

Please sign in to comment.