MCPcopy Create free account
hub / github.com/kataras/iris / Verify

Function Verify

_examples/auth/jwt/tutorial/api/auth.go:44–52  ·  view source on GitHub ↗

Verify allows only authorized clients.

()

Source from the content-addressed store, hash-verified

42
43// Verify allows only authorized clients.
44func Verify() iris.Handler {
45 secret := getSecretKey()
46
47 verifier := jwt.NewVerifier(jwt.HS256, []byte(secret), jwt.Expected{Issuer: util.AppName})
48 verifier.Extractors = []jwt.TokenExtractor{jwt.FromHeader} // extract token only from Authorization: Bearer $token
49 return verifier.Verify(func() interface{} {
50 return new(UserClaims)
51 })
52}
53
54// AllowAdmin allows only authorized clients with "admin" access role.
55// Should be registered after Verify.

Callers 1

NewRouterFunction · 0.85

Calls 3

VerifyMethod · 0.95
NewVerifierFunction · 0.92
getSecretKeyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…