mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:36:28 +01:00
fmt
parent
3ef4d7bdfd
commit
c68d801ee4
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user