]> git.argeo.org Git - lgpl/argeo-commons.git/blob - auth/CmsSessionId.java
Prepare next development cycle
[lgpl/argeo-commons.git] / auth / CmsSessionId.java
1 package org.argeo.cms.auth;
2
3 import java.util.UUID;
4
5 import javax.security.auth.Subject;
6
7 import org.argeo.cms.CmsException;
8
9 /**
10 * The ID of a {@link CmsSession}, which must be available in the private
11 * credentials of an authenticated {@link Subject}.
12 */
13 public class CmsSessionId {
14 private final UUID uuid;
15
16 public CmsSessionId(UUID value) {
17 if (value == null)
18 throw new CmsException("value cannot be null");
19 this.uuid = value;
20 }
21
22 public UUID getUuid() {
23 return uuid;
24 }
25
26 @Override
27 public int hashCode() {
28 return uuid.hashCode();
29 }
30
31 @Override
32 public boolean equals(Object obj) {
33 return obj instanceof CmsSessionId && ((CmsSessionId) obj).getUuid().equals(uuid);
34 }
35
36 @Override
37 public String toString() {
38 return "Node Session " + uuid;
39 }
40
41 }