* feat: integrate alist with casdoor * fix: casdoor as an option for login Co-authored-by: wenxuan70 <t736660416@gmail.com>
17 lines
296 B
Go
17 lines
296 B
Go
package middlewares
|
|
|
|
import (
|
|
"github.com/Xhofe/alist/conf"
|
|
"github.com/Xhofe/alist/server/common"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Auth(c *gin.Context) {
|
|
token := c.GetHeader("Authorization")
|
|
if token != conf.Token {
|
|
common.ErrorStrResp(c, "Invalid token", 401)
|
|
return
|
|
}
|
|
c.Next()
|
|
}
|