Documentation ¶
Index ¶
- Variables
- type AuthService
- func (s *AuthService) Auth(ctx *gin.Context)
- func (s *AuthService) Authorize(ctx *gin.Context)
- func (s *AuthService) GetCaptcha(ctx context.Context, req *pb.GetCaptchaReq) (*pb.GetCaptchaResp, error)
- func (s *AuthService) Login(ctx *gin.Context)
- func (s *AuthService) Logout(ctx *gin.Context)
- func (s *AuthService) Token(ctx *gin.Context)
- func (s *AuthService) VerifyCaptcha(ctx context.Context, req *pb.VerifyCaptchaReq) (*pb.VerifyCaptchaResp, error)
- type LoginForm
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)
Click to show internal directories.
Click to hide internal directories.