http urls monitor.

auth.go 498B

12345678910111213141516171819
  1. package middleware
  2. import (
  3. "git.links123.net/links123.com/pkg/middleware/auth"
  4. "git.links123.net/links123.com/skeleton/config"
  5. "git.links123.net/links123.com/skeleton/service/store/cache"
  6. "github.com/gin-gonic/gin"
  7. )
  8. // Auth 必须认证
  9. func Auth() gin.HandlerFunc {
  10. return auth.Auth(config.C.App.Secret, cache.AuthSessionStore())
  11. }
  12. // OptionalAuth 可选认证 如果传了token就会解析其用户
  13. func OptionalAuth() gin.HandlerFunc {
  14. return auth.OptionalAuth(config.C.App.Secret)
  15. }