1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-13 17:56:20 +00:00

Closes #21: Save IP and UA on login

This commit is contained in:
jendib
2015-05-15 17:30:21 +02:00
parent 0228d43442
commit b2a38cea62
8 changed files with 70 additions and 4 deletions

View File

@@ -29,6 +29,18 @@ public class AuthenticationToken {
@Column(name = "AUT_IDUSER_C", nullable = false, length = 36)
private String userId;
/**
* Login IP.
*/
@Column(name = "AUT_IP_C", nullable = true, length = 45)
private String ip;
/**
* Login user agent.
*/
@Column(name = "AUT_UA_C", nullable = true, length = 1000)
private String userAgent;
/**
* Remember the user next time (long lasted session).
*/
@@ -100,6 +112,38 @@ public class AuthenticationToken {
public void setLongLasted(boolean longLasted) {
this.longLasted = longLasted;
}
/**
* Getter of ip.
* @return ip
*/
public String getIp() {
return ip;
}
/**
* Setter of ip.
* @param ip ip
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
* Getter of userAgent.
* @return userAgent
*/
public String getUserAgent() {
return userAgent;
}
/**
* Setter of userAgent.
* @param userAgent userAgent
*/
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
/**
* Getter of creationDate.
@@ -142,6 +186,8 @@ public class AuthenticationToken {
return Objects.toStringHelper(this)
.add("id", "**hidden**")
.add("userId", userId)
.add("ip", ip)
.add("userAgent", userAgent)
.add("longLasted", longLasted)
.toString();
}

View File

@@ -1 +1 @@
db.version=9
db.version=10

View File

@@ -0,0 +1,4 @@
alter table T_FILE alter column FIL_IDUSER_C set not null;
alter table T_AUTHENTICATION_TOKEN add column AUT_IP_C varchar(45);
alter table T_AUTHENTICATION_TOKEN add column AUT_UA_C varchar(1000);
update T_CONFIG set CFG_VALUE_C='10' where CFG_ID_C='DB_VERSION';