1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

API versioning improvements

Replace the go-version package with a regex-free alternative semver

the result: versioned apis have almost zero performance cost now

thanks @motogo for your kind donation ❤️ - please check your github notifications
This commit is contained in:
Gerasimos (Makis) Maropoulos
2021-01-07 04:14:41 +02:00
parent b409f7807e
commit 240fdb6dc3
21 changed files with 381 additions and 463 deletions

View File

@@ -4,16 +4,10 @@ import (
"time"
"github.com/kataras/iris/v12"
"github.com/kataras/jwt"
"github.com/kataras/iris/v12/middleware/jwt"
)
/*
Learn how to use any JWT 3rd-party package with Iris.
In this example we use the kataras/jwt one.
Install with:
go get -u github.com/kataras/jwt
Documentation:
https://github.com/kataras/jwt#table-of-contents
*/
@@ -71,6 +65,7 @@ func protected(ctx iris.Context) {
// Just an example on how you can retrieve all the standard claims (set by jwt.MaxAge, "exp").
standardClaims := jwt.GetVerifiedToken(ctx).StandardClaims
expiresAtString := standardClaims.ExpiresAt().Format(ctx.Application().ConfigurationReadOnly().GetTimeFormat())
timeLeft := standardClaims.Timeleft()