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 *connect.Request[pb.ChangePasswordRequest]) (*connect.Response[pb.ChangePasswordResponse], error)
- func (as *AuthenticationService) GetAPIKey(ctx context.Context, req *connect.Request[pb.GetAPIKeyRequest]) (*connect.Response[pb.GetAPIKeyResponse], error)
- func (as *AuthenticationService) GetSignedCookie(ctx context.Context, r *connect.Request[pb.GetSignedCookieRequest]) (*connect.Response[pb.SignedCookieResponse], error)
- func (as *AuthenticationService) GetSocketToken(ctx context.Context, r *connect.Request[pb.SocketTokenRequest]) (*connect.Response[pb.SocketTokenResponse], error)
- func (as *AuthenticationService) InstallSignedCookie(ctx context.Context, r *connect.Request[pb.SignedCookieResponse]) (*connect.Response[pb.InstallSignedCookieResponse], error)
- func (as *AuthenticationService) Login(ctx context.Context, r *connect.Request[pb.UserLoginRequest]) (*connect.Response[pb.LoginResponse], error)
- func (as *AuthenticationService) Logout(ctx context.Context, r *connect.Request[pb.UserLogoutRequest]) (*connect.Response[pb.LogoutResponse], error)
- func (as *AuthenticationService) NotifyAccountClosure(ctx context.Context, r *connect.Request[pb.NotifyAccountClosureRequest]) (*connect.Response[pb.NotifyAccountClosureResponse], error)
- func (as *AuthenticationService) ResetPasswordStep1(ctx context.Context, r *connect.Request[pb.ResetPasswordRequestStep1]) (*connect.Response[pb.ResetPasswordResponse], error)
- func (as *AuthenticationService) ResetPasswordStep2(ctx context.Context, r *connect.Request[pb.ResetPasswordRequestStep2]) (*connect.Response[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 *connect.Request[pb.ChangePasswordRequest], ) (*connect.Response[pb.ChangePasswordResponse], error)
func (*AuthenticationService) GetAPIKey ¶
func (as *AuthenticationService) GetAPIKey(ctx context.Context, req *connect.Request[pb.GetAPIKeyRequest], ) (*connect.Response[pb.GetAPIKeyResponse], error)
func (*AuthenticationService) GetSignedCookie ¶
func (as *AuthenticationService) GetSignedCookie(ctx context.Context, r *connect.Request[pb.GetSignedCookieRequest], ) (*connect.Response[pb.SignedCookieResponse], error)
func (*AuthenticationService) GetSocketToken ¶
func (as *AuthenticationService) GetSocketToken(ctx context.Context, r *connect.Request[pb.SocketTokenRequest], ) (*connect.Response[pb.SocketTokenResponse], error)
func (*AuthenticationService) InstallSignedCookie ¶
func (as *AuthenticationService) InstallSignedCookie(ctx context.Context, r *connect.Request[pb.SignedCookieResponse], ) (*connect.Response[pb.InstallSignedCookieResponse], error)
func (*AuthenticationService) Login ¶
func (as *AuthenticationService) Login(ctx context.Context, r *connect.Request[pb.UserLoginRequest], ) (*connect.Response[pb.LoginResponse], error)
Login sets a cookie.
func (*AuthenticationService) Logout ¶
func (as *AuthenticationService) Logout(ctx context.Context, r *connect.Request[pb.UserLogoutRequest], ) (*connect.Response[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 ¶
func (as *AuthenticationService) NotifyAccountClosure(ctx context.Context, r *connect.Request[pb.NotifyAccountClosureRequest], ) (*connect.Response[pb.NotifyAccountClosureResponse], error)
func (*AuthenticationService) ResetPasswordStep1 ¶
func (as *AuthenticationService) ResetPasswordStep1(ctx context.Context, r *connect.Request[pb.ResetPasswordRequestStep1], ) (*connect.Response[pb.ResetPasswordResponse], error)
func (*AuthenticationService) ResetPasswordStep2 ¶
func (as *AuthenticationService) ResetPasswordStep2(ctx context.Context, r *connect.Request[pb.ResetPasswordRequestStep2], ) (*connect.Response[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.