Documentation ¶
Index ¶
- Constants
- func ComparePassword(password, hash string) (bool, error)
- func GeneratePassword(c *PasswordConfig, password string) (string, error)
- type AuthenticationService
- func (as *AuthenticationService) ChangePassword(ctx context.Context, r *pb.ChangePasswordRequest) (*pb.ChangePasswordResponse, error)
- func (as *AuthenticationService) GetSocketToken(ctx context.Context, r *pb.SocketTokenRequest) (*pb.SocketTokenResponse, error)
- func (as *AuthenticationService) Login(ctx context.Context, r *pb.UserLoginRequest) (*pb.LoginResponse, error)
- func (as *AuthenticationService) Logout(ctx context.Context, r *pb.UserLogoutRequest) (*pb.LogoutResponse, error)
- func (as *AuthenticationService) NotifyAccountClosure(ctx context.Context, r *pb.NotifyAccountClosureRequest) (*pb.NotifyAccountClosureResponse, error)
- func (as *AuthenticationService) ResetPasswordStep1(ctx context.Context, r *pb.ResetPasswordRequestStep1) (*pb.ResetPasswordResponse, error)
- func (as *AuthenticationService) ResetPasswordStep2(ctx context.Context, r *pb.ResetPasswordRequestStep2) (*pb.ResetPasswordResponse, error)
- type PasswordConfig
Constants ¶
View Source
const AccountClosureTemplate = `
Dear Woogles Administrators,
The following user has deleted their account:
User: %s
Email: %s
`
View Source
const PasswordResetExpiration = 24 * time.Hour
View Source
const ResetPasswordTemplate = `` /* 278-byte string literal not displayed */
View Source
const TokenExpiration = 60 * time.Second
A little bit of grace period in case we have to redeploy the socket or something.
Variables ¶
This section is empty.
Functions ¶
func ComparePassword ¶
ComparePassword is used to compare a user-inputted password to a hash to see if the password matches or not.
func GeneratePassword ¶
func GeneratePassword(c *PasswordConfig, password string) (string, error)
GeneratePassword is used to generate a new password hash for storing and comparing at a later date.
Types ¶
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
func NewAuthenticationService ¶
func NewAuthenticationService(u user.Store, ss sessions.SessionStore, cs config.ConfigStore, secretKey, mailgunKey string, discordToken string, cfg config.ArgonConfig) *AuthenticationService
func (*AuthenticationService) ChangePassword ¶
func (as *AuthenticationService) ChangePassword(ctx context.Context, r *pb.ChangePasswordRequest) (*pb.ChangePasswordResponse, error)
func (*AuthenticationService) GetSocketToken ¶
func (as *AuthenticationService) GetSocketToken(ctx context.Context, r *pb.SocketTokenRequest) (*pb.SocketTokenResponse, error)
func (*AuthenticationService) Login ¶
func (as *AuthenticationService) Login(ctx context.Context, r *pb.UserLoginRequest) (*pb.LoginResponse, error)
Login sets a cookie.
func (*AuthenticationService) Logout ¶
func (as *AuthenticationService) Logout(ctx context.Context, r *pb.UserLogoutRequest) (*pb.LogoutResponse, error)
Logout deletes the user session from the store, and also tells the front-end to ditch the cookie (yum)
func (*AuthenticationService) NotifyAccountClosure ¶ added in v0.1.3
func (as *AuthenticationService) NotifyAccountClosure(ctx context.Context, r *pb.NotifyAccountClosureRequest) (*pb.NotifyAccountClosureResponse, error)
func (*AuthenticationService) ResetPasswordStep1 ¶ added in v0.1.1
func (as *AuthenticationService) ResetPasswordStep1(ctx context.Context, r *pb.ResetPasswordRequestStep1) (*pb.ResetPasswordResponse, error)
func (*AuthenticationService) ResetPasswordStep2 ¶ added in v0.1.1
func (as *AuthenticationService) ResetPasswordStep2(ctx context.Context, r *pb.ResetPasswordRequestStep2) (*pb.ResetPasswordResponse, error)
type PasswordConfig ¶
type PasswordConfig struct {
// contains filtered or unexported fields
}
PasswordConfig is a password configuration for argon2.
func NewPasswordConfig ¶
func NewPasswordConfig(time int, memory int, threads int, keyLen int) *PasswordConfig
Click to show internal directories.
Click to hide internal directories.