auth

package
v0.0.0-...-857c71f Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Register bulkly

Functions

This section is empty.

Types

type AuthController

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

func NewAuthController

func NewAuthController(service *AuthService, jwtService *service.JwtService) *AuthController

func (*AuthController) Init

func (con *AuthController) Init(r *echo.Group) *echo.Group

func (*AuthController) Login

func (con *AuthController) Login(meta *echoc.RouteMeta) echoc.MetaHandler

@Tags Auth @Summary Authenticate a admin @Description Authenticate a admin with the provided credentials @ID create-Auth @Accept json @Produce json @Param Auth body dto.LoginRequest true "Auth data" @Success 200 {object} response.Response{data=map[string]dto.LoginResponse{list=[]dto.LoginResponse}} "Successfully created Auth" @Router /auth/login [post]

func (*AuthController) Me

@Tags Auth @Security Bearer @Summary query your self after login @Description get admin data by token @ID create-Auth-me @Accept json @Produce json @Success 200 {object} response.Response{data=ent.Admin} "Successfully registered admin" @Router /auth/me [get]

func (*AuthController) Register

func (con *AuthController) Register(meta *echoc.RouteMeta) echoc.MetaHandler

@Tags Auth @Summary Register a new admin @Description Register a new admin with the provided credentials @ID create-Auth-register @Accept json @Produce json @Param Auth body dto.RegisterRequest true "Registration data" @Success 200 {object} response.Response{data=dto.RegisterResponse} "Successfully registered admin" @Router /auth/register [post]

type AuthService

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

func NewAuthService

func NewAuthService(jwtService *service.JwtService, admin_r *repository.AdminRepository, passwordService *service.PasswordService) *AuthService

NewAuthService initializes a new AuthService with a JwtService and a UserStore.

func (*AuthService) LoginAdmin

func (s *AuthService) LoginAdmin(ctx context.Context, dto *dto.LoginRequest) (string, *ent.Admin, error)

LoginUser authenticates a user and returns a JWT token if successful.

func (*AuthService) RegisterAdmin

func (s *AuthService) RegisterAdmin(ctx context.Context, dto *dto.RegisterRequest) (string, *ent.Admin, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳