gin-jwt icon indicating copy to clipboard operation
gin-jwt copied to clipboard

What are realms?

Open davidchalifoux opened this issue 7 years ago • 3 comments

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?

davidchalifoux avatar Dec 15 '17 19:12 davidchalifoux

// 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, }

saito-sv avatar Jan 13 '18 09:01 saito-sv

Think of it as a space that needs protection. You can use your Appname. https://tools.ietf.org/html/rfc7235#section-2.2

paul-asvb avatar Dec 18 '18 18:12 paul-asvb

i have the same question

robertzhangwenjie avatar Dec 28 '21 01:12 robertzhangwenjie