fmt

Gerasimos (Makis) Maropoulos 2019-07-20 07:34:33 +03:00
parent 3ef4d7bdfd
commit c68d801ee4
No known key found for this signature in database
GPG Key ID: F169457BBDA4ACF4

@ -27,15 +27,15 @@ import (
) )
func getTokenHandler(ctx iris.Context) { func getTokenHandler(ctx iris.Context) {
token := jwt.NewTokenWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ token := jwt.NewTokenWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"foo": "bar", "foo": "bar",
}) })
// Sign and get the complete encoded token as a string using the secret // Sign and get the complete encoded token as a string using the secret
tokenString, _ := token.SignedString([]byte("My Secret")) tokenString, _ := token.SignedString([]byte("My Secret"))
ctx.HTML(`Token: ` + tokenString + `<br/><br/> ctx.HTML(`Token: ` + tokenString + `<br/><br/>
<a href="/secured?token=` + tokenString + `">/secured?token=` + tokenString + `</a>`) <a href="/secured?token=` + tokenString + `">/secured?token=` + tokenString + `</a>`)
} }
func myAuthenticatedHandler(ctx iris.Context) { func myAuthenticatedHandler(ctx iris.Context) {