opengist/internal/web/handlers/auth.go

18 lines
402 B
Go
Raw Normal View History

2025-01-06 13:18:31 +00:00
package handlers
2023-03-14 15:22:52 +00:00
import (
2024-12-03 01:18:04 +00:00
"github.com/thomiceli/opengist/internal/web/context"
2023-03-14 15:22:52 +00:00
)
type ContextAuthInfo struct {
2025-01-06 13:18:31 +00:00
Context *context.Context
}
func (auth ContextAuthInfo) RequireLogin() (bool, error) {
2024-12-29 10:40:23 +00:00
return auth.Context.GetData("RequireLogin") == true, nil
}
func (auth ContextAuthInfo) AllowGistsWithoutLogin() (bool, error) {
2024-12-29 10:40:23 +00:00
return auth.Context.GetData("AllowGistsWithoutLogin") == true, nil
}