// Extract a token string from a request header.
Extract a token string from a request header.
// Extract a token string from a request header .
func (a Auth) authToken(header http.Header) (string, error) {
	authHeader := header.Get(authorizationHeaderKey)
	if authHeader == "" {
		return "", errors.WithStack(ErrorAuthorizationHeaderIsEmpty)
	}
	if !strings.HasPrefix(authHeader, authorizationHeaderPrefix) {
		return "", errors.WithStack(ErrorAuthorizationHeaderIsInvalid)
	}
	return strings.TrimPrefix(authHeader, authorizationHeaderPrefix), nil
}
func ( a Auth ) authToken ( header http . Header ) ( string , error ) { authHeader := header . Get ( authorizationHeaderKey ) if authHeader == " " { return " " , errors . WithStack ( ErrorAuthorizationHeaderIsEmpty ) } if ! strings . HasPrefix ( authHeader , authorizationHeaderPrefix ) { return " " , errors . WithStack ( ErrorAuthorizationHeaderIsInvalid ) } return strings . TrimPrefix ( authHeader , authorizationHeaderPrefix ) , nil }
Extract a token string from a request header.
Extract a token string from a request header .