MCPcopy
hub / github.com/appleboy/gin-jwt / jwtFromHeader

Method jwtFromHeader

auth_jwt.go:914–927  ·  view source on GitHub ↗
(c *gin.Context, key string)

Source from the content-addressed store, hash-verified

912}
913
914func (mw *GinJWTMiddleware) jwtFromHeader(c *gin.Context, key string) (string, error) {
915 authHeader := c.Request.Header.Get(key)
916
917 if authHeader == "" {
918 return "", ErrEmptyAuthHeader
919 }
920
921 parts := strings.SplitN(authHeader, " ", 2)
922 if len(parts) != 2 || parts[0] != mw.TokenHeadName {
923 return "", ErrInvalidAuthHeader
924 }
925
926 return parts[1], nil
927}
928
929func (mw *GinJWTMiddleware) jwtFromQuery(c *gin.Context, key string) (string, error) {
930 token := c.Query(key)

Callers 1

ParseTokenMethod · 0.95

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected