Add token to login credentials and database user

This commit is contained in:
2020-09-18 11:29:05 +02:00
parent 89b9afb3db
commit ec6b67099f
3 changed files with 102 additions and 23 deletions

View File

@ -40,7 +40,7 @@ public final class User extends Contact {
/**
* Named query retrieving a user by name (parameter {@code :name}).
*
*
* @since Envoy Server Standalone v0.1-beta
*/
public static final String findByName = "User.findByName";
@ -48,7 +48,7 @@ public final class User extends Contact {
/**
* Named query retrieving the contacts of a given user (parameter
* {@code :user}).
*
*
* @since Envoy Server Standalone v0.1-beta
*/
public static final String findContacts = "User.findContacts";
@ -57,7 +57,7 @@ public final class User extends Contact {
* Named query searching for users with a name like a search phrase (parameter
* {@code :searchPhrase}) that are not in the contact list of a given user
* (parameter {@code :context}).
*
*
* @since Envoy Server Standalone v0.1-beta
*/
public static final String searchByName = "User.searchByName";
@ -65,6 +65,12 @@ public final class User extends Contact {
@Column(name = "password_hash")
private String passwordHash;
@Column(name = "auth_token")
private String authToken;
@Column(name = "auth_token_expiration")
private Instant authTokenExpiration;
@Column(name = "last_seen")
private Instant lastSeen;
@ -90,6 +96,31 @@ public final class User extends Contact {
*/
public void setPasswordHash(String passwordHash) { this.passwordHash = passwordHash; }
/**
* @return the authentication token
* @since Envoy Server v0.2-beta
*/
public String getAuthToken() { return authToken; }
/**
* @param authToken the authentication token to set
* @since Envoy Server v0.2-beta
*/
public void setAuthToken(String authToken) { this.authToken = authToken; }
/**
* @return the time at which the authentication token expires
* @since Envoy Server v0.2-beta
*/
public Instant getAuthTokenExpiration() { return authTokenExpiration; }
/**
* @param authTokenExpiration the authentication token expiration timestamp to
* set
* @since Envoy Server v0.2-beta
*/
public void setAuthTokenExpiration(Instant authTokenExpiration) { this.authTokenExpiration = authTokenExpiration; }
/**
* @return the last date the user has been online
* @since Envoy Server Standalone v0.2-beta