2019-04-24 21:52:08 +00:00
|
|
|
package session
|
|
|
|
|
|
|
|
import (
|
2020-05-04 19:39:25 +00:00
|
|
|
"time"
|
|
|
|
|
2020-12-29 01:44:47 +00:00
|
|
|
"github.com/authelia/session/v2"
|
|
|
|
"github.com/authelia/session/v2/providers/redis"
|
2019-04-24 21:52:08 +00:00
|
|
|
"github.com/tstranex/u2f"
|
2020-04-05 12:37:21 +00:00
|
|
|
|
|
|
|
"github.com/authelia/authelia/internal/authentication"
|
2019-04-24 21:52:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ProviderConfig is the configuration used to create the session provider.
|
|
|
|
type ProviderConfig struct {
|
2020-05-18 02:45:47 +00:00
|
|
|
config session.Config
|
|
|
|
redisConfig *redis.Config
|
|
|
|
providerName string
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
|
|
|
|
2020-05-02 05:06:39 +00:00
|
|
|
// U2FRegistration is a serializable version of a U2F registration.
|
2019-11-17 01:05:46 +00:00
|
|
|
type U2FRegistration struct {
|
|
|
|
KeyHandle []byte
|
|
|
|
PublicKey []byte
|
|
|
|
}
|
|
|
|
|
2019-04-24 21:52:08 +00:00
|
|
|
// UserSession is the structure representing the session of a user.
|
|
|
|
type UserSession struct {
|
2020-06-19 10:50:21 +00:00
|
|
|
Username string
|
|
|
|
DisplayName string
|
2019-04-24 21:52:08 +00:00
|
|
|
// TODO(c.michaud): move groups out of the session.
|
|
|
|
Groups []string
|
|
|
|
Emails []string
|
|
|
|
|
|
|
|
KeepMeLoggedIn bool
|
|
|
|
AuthenticationLevel authentication.Level
|
|
|
|
LastActivity int64
|
|
|
|
|
|
|
|
// The challenge generated in first step of U2F registration (after identity verification) or authentication.
|
|
|
|
// This is used reused in the second phase to check that the challenge has been completed.
|
|
|
|
U2FChallenge *u2f.Challenge
|
|
|
|
// The registration representing a U2F device in DB set after identity verification.
|
|
|
|
// This is used in second phase of a U2F authentication.
|
2019-11-17 01:05:46 +00:00
|
|
|
U2FRegistration *U2FRegistration
|
2019-04-24 21:52:08 +00:00
|
|
|
|
|
|
|
// This boolean is set to true after identity verification and checked
|
|
|
|
// while doing the query actually updating the password.
|
|
|
|
PasswordResetUsername *string
|
2020-05-04 19:39:25 +00:00
|
|
|
|
|
|
|
RefreshTTL time.Time
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Identity identity of the user who is being verified.
|
|
|
|
type Identity struct {
|
|
|
|
Username string
|
|
|
|
Email string
|
|
|
|
}
|