(ctx *gin.Context, accessToken string)
| 236 | } |
| 237 | |
| 238 | func (am *AuthUserMiddleware) AuthAPIKeyScope(ctx *gin.Context, accessToken string) (apiHaveNoScope bool) { |
| 239 | if !strings.HasPrefix(accessToken, "sk_") { |
| 240 | return false |
| 241 | } |
| 242 | var err error |
| 243 | pass, err := am.authService.AuthAPIKey(ctx, ctx.Request.Method == "GET", accessToken) |
| 244 | if err != nil { |
| 245 | handler.HandleResponse(ctx, errors.Forbidden(reason.ForbiddenError), nil) |
| 246 | ctx.Abort() |
| 247 | return true |
| 248 | } |
| 249 | if !pass { |
| 250 | handler.HandleResponse(ctx, errors.Forbidden(reason.ForbiddenError), nil) |
| 251 | ctx.Abort() |
| 252 | return true |
| 253 | } |
| 254 | return false |
| 255 | } |
| 256 | |
| 257 | func ShowIndexPage(ctx *gin.Context) { |
| 258 | ctx.Header("content-type", "text/html;charset=utf-8") |
no test coverage detected