authelia/internal/session/types.go
James Elliott 8aade7f40e
[MISC] Update durations to notation format and housekeeping (#824)
* added regulation validator
* made regulations find_time and ban_time values duration notation strings
* added DefaultRegulationConfiguration for the validator
* made session expiration and inactivity values duration notation strings
* TOTP period does not need to be converted because adjustment should be discouraged
* moved TOTP defaults to DefaultTOTPConfiguration and removed the consts
* arranged the root config validator in configuration file order
* adjusted tests for the changes
* moved duration notation docs to root of configuration
* added references to duration notation where applicable
* project wide gofmt and goimports:
* run gofmt
* run goimports -local github.com/authelia/authelia -w on all files
* Make jwt_secret error uniform and add tests
* now at 100% coverage for internal/configuration/validator/configuration.go
2020-04-05 22:37:21 +10:00

51 lines
1.4 KiB
Go

package session
import (
"github.com/fasthttp/session"
"github.com/tstranex/u2f"
"github.com/authelia/authelia/internal/authentication"
)
// ProviderConfig is the configuration used to create the session provider.
type ProviderConfig struct {
config *session.Config
providerName string
providerConfig session.ProviderConfig
}
// U2FRegistration is a serializable version of a U2F registration
type U2FRegistration struct {
KeyHandle []byte
PublicKey []byte
}
// UserSession is the structure representing the session of a user.
type UserSession struct {
Username string
// 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.
U2FRegistration *U2FRegistration
// This boolean is set to true after identity verification and checked
// while doing the query actually updating the password.
PasswordResetUsername *string
}
// Identity identity of the user who is being verified.
type Identity struct {
Username string
Email string
}