12345678910111213141516171819 |
- package middleware
-
- import (
- "git.links123.net/links123.com/pkg/middleware/auth"
- "git.links123.net/links123.com/skeleton/config"
- "git.links123.net/links123.com/skeleton/service/store/cache"
- "github.com/gin-gonic/gin"
- )
-
- // Auth 必须认证
- func Auth() gin.HandlerFunc {
- return auth.Auth(config.C.App.Secret, cache.AuthSessionStore())
- }
-
- // OptionalAuth 可选认证 如果传了token就会解析其用户
- func OptionalAuth() gin.HandlerFunc {
- return auth.OptionalAuth(config.C.App.Secret)
- }
|