Documentation
¶
Index ¶
- type Claims
- type DataProtector
- type GoogleProvider
- type MicrosoftProvider
- type NotificationsManager
- func (n *NotificationsManager) NotifyUser(user *models.User, sourceIP string) (bool, *uuid.UUID, error)
- func (n *NotificationsManager) PublishBrowserProof(identity string, sourceIP string, nonce uuid.UUID)
- func (n *NotificationsManager) WaitForBrowserProof(user *models.User, sourceIP string, nonce uuid.UUID) bool
- type OAuth2Provider
- type OAuth2User
- type SessionInfo
- type UserManager
- func (m *UserManager) AddMFA(user *models.User, mfaType string, data string, userAgent string) (*models.UserMFA, error)
- func (m *UserManager) AddUserSubscription(user *models.User, subscription *models.UserSubscription) (*models.UserSubscription, error)
- func (m *UserManager) CheckOrCreate(email string) (*models.User, error)
- func (m *UserManager) CheckVpnSession(identity string, ip string) (*models.User, *models.VpnSession, bool, error)
- func (m *UserManager) CleanupConnectionsLog() error
- func (m *UserManager) CreateSession(user *models.User, hasMFA bool, w http.ResponseWriter) error
- func (m *UserManager) CreateVpnSession(user *models.User, ip string) error
- func (m *UserManager) DeleteSession(w http.ResponseWriter) error
- func (m *UserManager) DeleteUserSubscription(subscription *models.UserSubscription) error
- func (m *UserManager) DeleteVpnSession(identity string, ip string) error
- func (m *UserManager) Get(email string) (*models.User, error)
- func (m *UserManager) UpdateMFA(userMFA models.UserMFA) (*models.UserMFA, error)
- func (m *UserManager) ValidateMFA(mfa *models.UserMFA, data string) (*models.UserMFA, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct { Username string `json:"username"` HasMFA bool `json:"has_mfa"` jwt.StandardClaims }
Claims is used Used for the session cookie
type DataProtector ¶
type DataProtector struct {
// contains filtered or unexported fields
}
func NewDataProtector ¶
func NewDataProtector(config *models.Config) *DataProtector
NewDataProtector creates an instance of DataProtector
type GoogleProvider ¶
type GoogleProvider struct {
// contains filtered or unexported fields
}
func NewGoogleProvider ¶
func NewGoogleProvider(redirectDomain string, tenantID string, clientID string, clientSecret string) *GoogleProvider
func (*GoogleProvider) GetURL ¶
func (p *GoogleProvider) GetURL(state string) string
func (*GoogleProvider) GetUserInfo ¶
func (p *GoogleProvider) GetUserInfo(code string) (OAuth2User, error)
type MicrosoftProvider ¶
type MicrosoftProvider struct {
// contains filtered or unexported fields
}
func NewMicrosoftProvider ¶
func NewMicrosoftProvider(redirectDomain string, tenantID string, clientID string, clientSecret string) *MicrosoftProvider
func (*MicrosoftProvider) GetURL ¶
func (p *MicrosoftProvider) GetURL(state string) string
func (*MicrosoftProvider) GetUserInfo ¶
func (p *MicrosoftProvider) GetUserInfo(code string) (OAuth2User, error)
type NotificationsManager ¶
type NotificationsManager struct {
// contains filtered or unexported fields
}
func NewNotificationsManager ¶
func NewNotificationsManager(db *gorm.DB, config *models.Config, bus *EventBus.Bus) *NotificationsManager
New creates an instance of the controller and sets its DB handle
func (*NotificationsManager) NotifyUser ¶
func (*NotificationsManager) PublishBrowserProof ¶
func (n *NotificationsManager) PublishBrowserProof(identity string, sourceIP string, nonce uuid.UUID)
func (*NotificationsManager) WaitForBrowserProof ¶
func (n *NotificationsManager) WaitForBrowserProof(user *models.User, sourceIP string, nonce uuid.UUID) bool
WaitForBrowserProof waits for browser to reply with a request having a valid session token, and a body containing the same nonce value that was sent with the Push or SSE notification.
type OAuth2Provider ¶
type OAuth2Provider interface { GetURL(state string) string GetUserInfo(code string) (OAuth2User, error) }
type OAuth2User ¶
type SessionInfo ¶
type UserManager ¶
type UserManager struct {
// contains filtered or unexported fields
}
func NewUserManager ¶
func NewUserManager(db *gorm.DB, config *models.Config) *UserManager
New creates an instance of UserManager and sets its DB handle
func (*UserManager) AddMFA ¶
func (m *UserManager) AddMFA(user *models.User, mfaType string, data string, userAgent string) (*models.UserMFA, error)
AddMFA Creates a new `UserMFA`, and encrypts the `data` field
func (*UserManager) AddUserSubscription ¶
func (m *UserManager) AddUserSubscription(user *models.User, subscription *models.UserSubscription) (*models.UserSubscription, error)
func (*UserManager) CheckOrCreate ¶
func (m *UserManager) CheckOrCreate(email string) (*models.User, error)
Check that the user exists and has a valid OTP setup. User is created if it doesn't exist. Returns false if the user doesn't have a verified TOTP secret
func (*UserManager) CheckVpnSession ¶
func (m *UserManager) CheckVpnSession(identity string, ip string) (*models.User, *models.VpnSession, bool, error)
func (*UserManager) CleanupConnectionsLog ¶
func (m *UserManager) CleanupConnectionsLog() error
CleanupConnections deletes connection entries older than configured value
func (*UserManager) CreateSession ¶
func (m *UserManager) CreateSession(user *models.User, hasMFA bool, w http.ResponseWriter) error
CreateSession generates and sends the JWT token cookie.
func (*UserManager) CreateVpnSession ¶
func (m *UserManager) CreateVpnSession(user *models.User, ip string) error
CreateVpnSession Creates a new VPN "Session" for the `User` from the specified IP address.
func (*UserManager) DeleteSession ¶
func (m *UserManager) DeleteSession(w http.ResponseWriter) error
func (*UserManager) DeleteUserSubscription ¶
func (m *UserManager) DeleteUserSubscription(subscription *models.UserSubscription) error
func (*UserManager) DeleteVpnSession ¶
func (m *UserManager) DeleteVpnSession(identity string, ip string) error
func (*UserManager) UpdateMFA ¶
UpdateMFA updates a `UserMFA`. It assumes that the `data` field need to be encrypted again.
func (*UserManager) ValidateMFA ¶
ValidateMFA sets the UserMFA as validated and saves any data if present.