Documentation ¶
Index ¶
- Constants
- type Config
- type DatabaseAuth
- func (s *DatabaseAuth) CanUsersRegister() bool
- func (s *DatabaseAuth) CreateUser(user storage.User) error
- func (s *DatabaseAuth) GenerateSecurePassword(password string) (string, error)
- func (s *DatabaseAuth) Login(username, password string) (*storage.User, error)
- func (s *DatabaseAuth) UserCanChangePassword() bool
- type DatabaseAuthPlugin
Constants ¶
const ( // DefaultUsername is the first user created in the system if no users exist DefaultUsername = "admin" // DefaultPassword is the default password for the DefaultUsername DefaultPassword = "ch@ng3me!" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseAuth ¶
type DatabaseAuth struct {
// contains filtered or unexported fields
}
DatabaseAuth is an authentication backend powered by one of GoCrack's storage implementations
func Init ¶
func Init(db authentication.AuthStorageBackend, cfg authentication.PluginSettings) (*DatabaseAuth, error)
Init creates the authentication backend
func (*DatabaseAuth) CanUsersRegister ¶
func (s *DatabaseAuth) CanUsersRegister() bool
CanUsersRegister indicates if the GoCrack administrator has allowed new user registration
func (*DatabaseAuth) CreateUser ¶
func (s *DatabaseAuth) CreateUser(user storage.User) error
CreateUser creates a new user in the database
func (*DatabaseAuth) GenerateSecurePassword ¶
func (s *DatabaseAuth) GenerateSecurePassword(password string) (string, error)
GenerateSecurePassword generates a cryptographically secure password string from a plaintext password
func (*DatabaseAuth) Login ¶
func (s *DatabaseAuth) Login(username, password string) (*storage.User, error)
Login searches the database backend for a matching user record
func (*DatabaseAuth) UserCanChangePassword ¶
func (s *DatabaseAuth) UserCanChangePassword() bool
UserCanChangePassword indicates that the user can change their password with this backend
type DatabaseAuthPlugin ¶
type DatabaseAuthPlugin struct{}
DatabaseAuthPlugin implements Open which is used to register the GoCrack database authentication provider with the backend
func (*DatabaseAuthPlugin) Open ¶
func (s *DatabaseAuthPlugin) Open(db authentication.AuthStorageBackend, cfg authentication.PluginSettings) (authentication.AuthAPI, error)
Open initializes the GoCrack database Authentication Provider