mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-07 16:54:16 +01:00
da75a76d41
For better auditing this PR adds a dashboard login event to the management service. For that the user object was extended with a field for last login that is not actively saved to the database but kept in memory until next write. The information about the last login can be extracted from the JWT claims nb_last_login. This timestamp will be stored and compared on each API request. If the value changes we generate an event to inform about a login.
19 lines
309 B
Go
19 lines
309 B
Go
package jwtclaims
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/golang-jwt/jwt"
|
|
)
|
|
|
|
// AuthorizationClaims stores authorization information from JWTs
|
|
type AuthorizationClaims struct {
|
|
UserId string
|
|
AccountId string
|
|
Domain string
|
|
DomainCategory string
|
|
LastLogin time.Time
|
|
|
|
Raw jwt.MapClaims
|
|
}
|