update
This commit is contained in:
parent
b15fa3f709
commit
6659671132
@ -50,6 +50,8 @@ func (a *Auth) Handler() fiber.Handler {
|
|||||||
|
|
||||||
authorization := c.Get(constants.AuthHeader)
|
authorization := c.Get(constants.AuthHeader)
|
||||||
|
|
||||||
|
r.Status(http.StatusUnauthorized)
|
||||||
|
|
||||||
if authorization == "" {
|
if authorization == "" {
|
||||||
return r.Error(errs.JWTFormatError).Send()
|
return r.Error(errs.JWTFormatError).Send()
|
||||||
}
|
}
|
||||||
@ -66,11 +68,11 @@ func (a *Auth) Handler() fiber.Handler {
|
|||||||
token, err = a.authService.AuthFromToken(constants.JwtTokenTypeIDToken, authSplit[1])
|
token, err = a.authService.AuthFromToken(constants.JwtTokenTypeIDToken, authSplit[1])
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return r.Error(err).Status(http.StatusUnauthorized).Send()
|
return r.Error(err).Send()
|
||||||
}
|
}
|
||||||
|
|
||||||
if token == nil {
|
if token == nil {
|
||||||
return r.Error(err).Status(http.StatusUnauthorized).Send()
|
return r.Error(err).Send()
|
||||||
}
|
}
|
||||||
|
|
||||||
if audienceLength > 0 {
|
if audienceLength > 0 {
|
||||||
|
@ -111,16 +111,12 @@ func (r *Response) Send() error {
|
|||||||
var rspCtx = r.ctx.Status(r.httpStatus)
|
var rspCtx = r.ctx.Status(r.httpStatus)
|
||||||
var rspErr error
|
var rspErr error
|
||||||
|
|
||||||
if r.body.Data == nil {
|
if r.body.Data == nil || r.body.Wrap {
|
||||||
return rspCtx.Send([]byte{})
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.body.Wrap {
|
|
||||||
rspErr = rspCtx.JSON(r.body)
|
rspErr = rspCtx.JSON(r.body)
|
||||||
|
} else {
|
||||||
|
rspErr = rspCtx.JSON(r.body.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
rspErr = rspCtx.JSON(r.body.Data)
|
|
||||||
|
|
||||||
return rspErr
|
return rspErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user