mirror of
https://github.com/cloudreve/cloudreve.git
synced 2025-10-28 23:26:01 +08:00
@ -5,7 +5,10 @@ import (
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"github.com/HFO4/cloudreve/models"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
model "github.com/HFO4/cloudreve/models"
|
||||
"github.com/HFO4/cloudreve/pkg/auth"
|
||||
"github.com/HFO4/cloudreve/pkg/cache"
|
||||
"github.com/HFO4/cloudreve/pkg/filesystem/driver/onedrive"
|
||||
@ -16,8 +19,6 @@ import (
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/qiniu/api.v7/v7/auth/qbox"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// SignRequired 验证请求签名
|
||||
@ -311,6 +312,21 @@ func COSCallbackAuth() gin.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// S3CallbackAuth Amazon S3回调签名验证
|
||||
func S3CallbackAuth() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 验证key并查找用户
|
||||
resp, _ := uploadCallbackCheck(c)
|
||||
if resp.Code != 0 {
|
||||
c.JSON(401, serializer.QiniuCallbackFailed{Error: resp.Msg})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// IsAdmin 必须为管理员用户组
|
||||
func IsAdmin() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user