gin-jwt
gin-jwt copied to clipboard
What are realms?
Hey, I'm new to JWT and Go in general. I'm confused as to what a Realm
is in the context of JWT's. I've looked everywhere I could and gin-jwt
seems to be the only place that references Realms. Could someone explain it to me?
// spin up a JWT middleware, there are two methods omitted here, // you'll want to check the docs to see what they do but for this // example, the default behaviour will suffice. jwtMiddleware := &jwt.GinJWTMiddleware{ Realm: "robreid.io", // store this somewhere, if your server restarts and you're // generating random passwords, any valid JWTs will be invalid Key: []byte("something super secret"), Timeout: time.Hour, MaxRefresh: time.Hour * 24, Authenticator: authenticate, // this method allows you to jump in and set user information // JWTs aren't encrypted, so don't store any sensitive info PayloadFunc: payload, }
Think of it as a space that needs protection. You can use your Appname. https://tools.ietf.org/html/rfc7235#section-2.2
i have the same question