Commit 72123379 authored by ale's avatar ale

Update id/auth

parent 61e5a7b2
Pipeline #2473 passed with stages
in 2 minutes and 11 seconds
......@@ -210,24 +210,27 @@ func (u *userlogDB) GetUserLogs(username string, maxDays, limit int) ([]*usermet
}
defer rows.Close()
for rows.Next() {
e := &usermetadb.LogEntry{DeviceInfo: &auth.DeviceInfo{}}
var di auth.DeviceInfo
e := &usermetadb.LogEntry{
Username: username,
}
if err := rows.Scan(
&e.Service,
&e.Type,
&e.LoginMethod,
&e.Message,
&e.Timestamp,
&e.DeviceInfo.ID,
&e.DeviceInfo.RemoteZone,
&e.DeviceInfo.UserAgent,
&e.DeviceInfo.Browser,
&e.DeviceInfo.OS,
&e.DeviceInfo.Mobile,
&di.ID,
&di.RemoteZone,
&di.UserAgent,
&di.Browser,
&di.OS,
&di.Mobile,
); err != nil {
return nil, err
}
if e.DeviceInfo.ID == "" {
e.DeviceInfo = nil
if di.ID != "" {
e.DeviceInfo = &di
}
out = append(out, e)
}
......
......@@ -116,6 +116,8 @@ Each service definition is a dictionary with the following attributes:
only for interactive services)
* `enforce_2fa` is a boolean flag that, when true, will disable
non-2FA logins for this service
* `enable_last_login_reporting` is a boolean flag that enables last login
reporting to usermetadb
* `enable_device_tracking` is a boolean flag that enables device
tracking for this service (assuming the client provides device
information)
......
......@@ -10,13 +10,13 @@ import (
// simple persistent cookie to track the same client device across
// multiple session.
type DeviceInfo struct {
ID string
RemoteAddr string
RemoteZone string
UserAgent string
Browser string
OS string
Mobile bool
ID string `json:"id"`
RemoteAddr string `json:"remote_addr"`
RemoteZone string `json:"remote_zone"`
UserAgent string `json:"user_agent"`
Browser string `json:"browser"`
OS string `json:"os"`
Mobile bool `json:"mobile"`
}
func (d *DeviceInfo) encodeToMap(m map[string]string, prefix string) {
......
......@@ -27,10 +27,10 @@
"revisionTime": "2018-11-18T16:11:30Z"
},
{
"checksumSHA1": "6D5Xt9WoGSeTJE3XFw6P2/nKYrQ=",
"checksumSHA1": "yRc5umgrV1NRzXHqjkHSUAXIvpg=",
"path": "git.autistici.org/id/auth",
"revision": "d5da26d7565082baa108a1c1806f2fc723d33ccb",
"revisionTime": "2018-11-18T17:43:45Z"
"revision": "8100efc2114c147aedffd9b0d2df9f6686a1c2e8",
"revisionTime": "2019-03-03T07:55:45Z"
},
{
"checksumSHA1": "0rido7hYHQtfq3UJzVT5LClLAWc=",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment