service

package
v0.0.0-...-9bd63dd Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 12 Imported by: 0

README

Service

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewAuthService)

ProviderSet is service providers.

Functions

This section is empty.

Types

type AuthService

type AuthService struct {
	pb.UnimplementedAuthServer
	// contains filtered or unexported fields
}

func NewAuthService

func NewAuthService(logger log.Logger, authUseCase *biz.AuthUseCase, captchaUseCase *biz.CaptchaUseCase, server *server.Server) *AuthService

func (*AuthService) Auth

func (s *AuthService) Auth(ctx *gin.Context)

func (*AuthService) Authorize

func (s *AuthService) Authorize(ctx *gin.Context)

func (*AuthService) GetCaptcha

func (s *AuthService) GetCaptcha(ctx context.Context, req *pb.GetCaptchaReq) (*pb.GetCaptchaResp, error)

func (*AuthService) Login

func (s *AuthService) Login(ctx *gin.Context)

func (*AuthService) Logout

func (s *AuthService) Logout(ctx *gin.Context)

// khttp://localhost:8002/auth/logout

func (s *AuthService) Logout(ctx khttp.Context) error {
	accessToken := ctx.Header().Get("Authorization")
	return s.server.Manager.RemoveAccessToken(ctx, accessToken)
}

func (*AuthService) Token

func (s *AuthService) Token(ctx *gin.Context)

// khttp://localhost:8002/oauth/token?grant_type=authorization_code&code=OWU1NMFLMJMTYTC4ZI0ZNTC5LTG5NDUTODG1NTQXNMRKNWRI&redirect_uri=khttp://localhost:8002/cb // khttp://localhost:8002/oauth/token?grant_type=refresh_token&refresh_token=M2JLYMNKYJETNJVIOS01YTG3LTK3N2MTNZGZY2JINZNLYZY5 // basic auth // - username: `client_id` // - password: `client_secret`

func (s *AuthService) Token(ctx khttp.Context) error {
	return s.server.HandleTokenRequest(ctx.Response(), ctx.Request())
}

func (*AuthService) VerifyCaptcha

func (s *AuthService) VerifyCaptcha(ctx context.Context, req *pb.VerifyCaptchaReq) (*pb.VerifyCaptchaResp, error)

type LoginForm

type LoginForm struct {
	UserName string `form:"username" binding:"required"`
	Password string `form:"password" binding:"required"`
}

Jump to

Keyboard shortcuts

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