blob: 1c11a289826fb45445c37f8d0fbb4bf77ca0c350 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package com.ufund.api.ufundapi.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.LocalDateTime;
import java.util.UUID;
public class UserAuth {
@JsonProperty("key") String key;
@JsonProperty("username") String username;
@JsonProperty("expiration") LocalDateTime expiration;
public UserAuth(@JsonProperty("key") String key, @JsonProperty("username") String username, @JsonProperty("expiration") LocalDateTime expiration) {
this.key = key;
this.expiration = expiration;
this.username = username;
}
/**
* Generate a new user authentication profile
* @param username the username the key will belong to
* @return The new user authentication profile
*/
public static UserAuth generate(String username) {
return new UserAuth(
UUID.randomUUID().toString(),
username,
LocalDateTime.now().plusDays(30)
);
}
public String getKey() {
return key;
}
public String getUsername() {
return username;
}
public LocalDateTime getExpiration() {
return expiration;
}
}
|