auth

package
v0.0.0-...-bb61026 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LinktlyAccessTokenCookieName  = "access_token"
	LinktlyRefreshTokenCookieName = "refresh_token"
)

Variables

This section is empty.

Functions

func LoadRoutes

func LoadRoutes(r chi.Router, config config.Config, store *store.PostgresStore)

Types

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

func (AuthHandler) Login

func (AuthHandler) Logout

func (a AuthHandler) Logout(w http.ResponseWriter, r *http.Request) error

func (AuthHandler) Refresh

func (a AuthHandler) Refresh(w http.ResponseWriter, r *http.Request) error

func (AuthHandler) Signup

func (a AuthHandler) Signup(w http.ResponseWriter, r *http.Request) error

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

func (*AuthService) Login

func (s *AuthService) Login(ctx context.Context, email string, password string) (string, time.Time, string, time.Time, error)

func (*AuthService) Logout

func (s *AuthService) Logout(ctx context.Context, userId string) error

func (*AuthService) Refresh

func (s *AuthService) Refresh(ctx context.Context, refreshToken string) (string, time.Time, string, time.Time, error)

type LoginReq

type LoginReq struct {
	Email    string `db:"email" validate:"required,email" json:"email"`
	Password string `db:"password" validate:"required,min=6,max=30,password" json:"password"`
}

func (*LoginReq) Bind

func (req *LoginReq) Bind(r *http.Request) error

type PostgresRepository

type PostgresRepository struct {
	// contains filtered or unexported fields
}

func GetNewAuthRepository

func GetNewAuthRepository(store *store.PostgresStore) *PostgresRepository

func (*PostgresRepository) Login

func (repo *PostgresRepository) Login(ctx context.Context, email string, password string) (*accounts.Account, error)

func (*PostgresRepository) UpdateRefreshTokenJtiByUserId

func (repo *PostgresRepository) UpdateRefreshTokenJtiByUserId(ctx context.Context, jti string, accountId string) error

func (*PostgresRepository) UpdateRefreshTokenJtiByUserIdAndJti

func (repo *PostgresRepository) UpdateRefreshTokenJtiByUserIdAndJti(ctx context.Context, accountId string, jti string, newJti string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL