Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for DecodeJwtPart (0.26 sec)

  1. security/pkg/util/jwtutil.go

    	}
    
    	// Decode the second part.
    	claimBytes, err := DecodeJwtPart(parts[1])
    	if err != nil {
    		return nil, err
    	}
    	dec := json.NewDecoder(bytes.NewBuffer(claimBytes))
    
    	claims := make(map[string]any)
    	if err := dec.Decode(&claims); err != nil {
    		return nil, fmt.Errorf("failed to decode the JWT claims")
    	}
    	return claims, nil
    }
    
    func DecodeJwtPart(seg string) ([]byte, error) {
    	if l := len(seg) % 4; l > 0 {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 31 16:07:11 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  2. security/pkg/util/jwtutil_test.go

    			}
    		})
    	}
    }
    
    func TestBase64UrlPartDecoding(t *testing.T) {
    	payloadBytes, err := DecodeJwtPart(base64UrlEncodedPaddingStrippedPart)
    	if err != nil {
    		t.Error("Expected DecodeJwtPart success, got failure", err)
    	}
    	if payloadBytes == nil {
    		t.Error("Expected DecodeJwtPart to return non-nil, got nil")
    	}
    
    	expectedAud := "Joe ArdoƱez"
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 31 16:07:11 UTC 2024
    - 6K bytes
    - Viewed (0)
  3. pilot/pkg/bootstrap/istio_ca.go

    	jwtSplit := strings.Split(jwt, ".")
    	if len(jwtSplit) != 3 {
    		return nil, fmt.Errorf("invalid JWT parts: %s", jwt)
    	}
    	payload := jwtSplit[1]
    
    	payloadBytes, err := util.DecodeJwtPart(payload)
    	if err != nil {
    		return nil, fmt.Errorf("failed to decode jwt: %v", err.Error())
    	}
    
    	structuredPayload := &authenticate.JwtPayload{}
    	err = json.Unmarshal(payloadBytes, &structuredPayload)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Jun 13 17:48:28 UTC 2024
    - 20.6K bytes
    - Viewed (0)
Back to top