MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / ParseAndVerify

Function ParseAndVerify

pkg/packetbroker/token.go:177–183  ·  view source on GitHub ↗

ParseAndVerify parses and verifies the token and returns the claims. See Verify for the verification process.

(ctx context.Context, token *oauth2.Token, keyProvider PublicKeyProvider, issuer, audience string)

Source from the content-addressed store, hash-verified

175// ParseAndVerify parses and verifies the token and returns the claims.
176// See Verify for the verification process.
177func ParseAndVerify(ctx context.Context, token *oauth2.Token, keyProvider PublicKeyProvider, issuer, audience string) (TokenClaims, error) {
178 t, err := jwt.ParseSigned(token.AccessToken)
179 if err != nil {
180 return TokenClaims{}, errOAuth2Token.WithCause(err)
181 }
182 return Verify(ctx, t, keyProvider, issuer, audience)
183}
184
185// Verify verifies the token and returns the claims.
186// If issuer is non-empty, the token's issuer must match the issuer.

Callers 1

TestTokenFunction · 0.92

Calls 2

VerifyFunction · 0.70
WithCauseMethod · 0.45

Tested by 1

TestTokenFunction · 0.74