profileShare

rasmusjy / tasteprint

Read-only snapshot

No repository description.

main default branch 169 files Expires Sep 13, 2026, 9:06 AM
SessionToken.java 1,013 bytes
1 package com.tasteprint.account;
2
3 import java.time.Instant;
4 import java.util.UUID;
5
6 import jakarta.persistence.Column;
7 import jakarta.persistence.Entity;
8 import jakarta.persistence.Id;
9 import jakarta.persistence.Table;
10
11 @Entity
12 @Table(name = "session_token")
13 class SessionToken {
14
15 @Id
16 private UUID id;
17
18 @Column(name = "user_id", nullable = false)
19 private UUID userId;
20
21 @Column(name = "token_hash", nullable = false, length = 64, unique = true)
22 private String tokenHash;
23
24 @Column(name = "expires_at", nullable = false)
25 private Instant expiresAt;
26
27 @Column(name = "created_at", nullable = false)
28 private Instant createdAt;
29
30 protected SessionToken() {
31 }
32
33 SessionToken(UUID id, UUID userId, String tokenHash, Instant expiresAt, Instant createdAt) {
34 this.id = id;
35 this.userId = userId;
36 this.tokenHash = tokenHash;
37 this.expiresAt = expiresAt;
38 this.createdAt = createdAt;
39 }
40
41 UUID userId() {
42 return userId;
43 }
44 }
45