[#153] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
parent
1e3df95eed
commit
11283c1c79
6 changed files with 57 additions and 57 deletions
|
@ -26,7 +26,7 @@ const (
|
|||
// return
|
||||
// }
|
||||
|
||||
// BearerTokenFromHeader extracts bearer token from Authorization request header.
|
||||
// BearerTokenFromHeader extracts a bearer token from Authorization request header.
|
||||
func BearerTokenFromHeader(h *fasthttp.RequestHeader) []byte {
|
||||
auth := h.Peek(fasthttp.HeaderAuthorization)
|
||||
if auth == nil || !bytes.HasPrefix(auth, []byte(bearerTokenHdr)) {
|
||||
|
@ -38,7 +38,7 @@ func BearerTokenFromHeader(h *fasthttp.RequestHeader) []byte {
|
|||
return auth
|
||||
}
|
||||
|
||||
// BearerTokenFromCookie extracts bearer token from cookies.
|
||||
// BearerTokenFromCookie extracts a bearer token from cookies.
|
||||
func BearerTokenFromCookie(h *fasthttp.RequestHeader) []byte {
|
||||
auth := h.Cookie(bearerTokenHdr)
|
||||
if len(auth) == 0 {
|
||||
|
@ -48,7 +48,7 @@ func BearerTokenFromCookie(h *fasthttp.RequestHeader) []byte {
|
|||
return auth
|
||||
}
|
||||
|
||||
// StoreBearerToken extracts bearer token from header or cookie and stores
|
||||
// StoreBearerToken extracts a bearer token from the header or cookie and stores
|
||||
// it in the request context.
|
||||
func StoreBearerToken(ctx *fasthttp.RequestCtx) error {
|
||||
tkn, err := fetchBearerToken(ctx)
|
||||
|
@ -60,7 +60,7 @@ func StoreBearerToken(ctx *fasthttp.RequestCtx) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// LoadBearerToken returns bearer token stored in context given (if it's
|
||||
// LoadBearerToken returns a bearer token stored in the context given (if it's
|
||||
// present there).
|
||||
func LoadBearerToken(ctx context.Context) (*token.BearerToken, error) {
|
||||
if tkn, ok := ctx.Value(bearerTokenKey).(*token.BearerToken); ok && tkn != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue