Documentation
¶
Index ¶
- func ExtractIP(req *http.Request) string
- func ExtractIPDirect(req *http.Request) string
- func ExtractIPXFF(req *http.Request) string
- func GetBaseURL(c context.Context) *url.URL
- func GetRequest(c context.Context) *http.Request
- func GetResponseWriter(c context.Context) http.ResponseWriter
- func GracefulServe(srv *http.Server, shutdownTimeout time.Duration) error
- func IsHttps(c context.Context) bool
- func IsSecure(r *http.Request) bool
- func LoggerMiddleware(next http.Handler) http.Handler
- func MakeServer(conf *HttpServerConfigDef, dbConf *db.DBConfigDef, ...) *http.Server
- func NewGqlResolver(dbConn *sql.DB, identityManager *IdentityManager, ...) *graph.Resolver
- func NewGraphConfig(resolver *graph.Resolver) graph.Config
- func ParseOriginList(value string) []string
- func RWContextMiddleware(next http.Handler) http.Handler
- type ContextKey
- type HttpContextUserManager
- func (cu *HttpContextUserManager) GetAuthenticationInfo(c context.Context) *identity.AuthenticationInfo
- func (cu *HttpContextUserManager) SetAuthenticationInfo(c context.Context, authenticationInfo *identity.AuthenticationInfo)
- func (cu *HttpContextUserManager) WithAuthenticationInfo(c context.Context, authenticationInfo *identity.AuthenticationInfo) context.Context
- type HttpServerConfigDef
- type IdentityManager
- func (i *IdentityManager) Authenticate(w http.ResponseWriter, r *http.Request, userId string, ...)
- func (i *IdentityManager) AuthenticateContext(c context.Context, userId string, organzationUserId string)
- func (i *IdentityManager) Logout(w http.ResponseWriter, r *http.Request)
- func (i *IdentityManager) LogoutContext(c context.Context)
- func (i *IdentityManager) Middleware(next http.Handler) http.Handler
- type UploadReturn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractIPDirect ¶
func ExtractIPXFF ¶
func GetResponseWriter ¶
func GetResponseWriter(c context.Context) http.ResponseWriter
func MakeServer ¶
func MakeServer( conf *HttpServerConfigDef, dbConf *db.DBConfigDef, storageConf *storage.StorageConfigDef, emailConf *email.EmailConfigDef, cleanupConf *storage.CleanupConfig, ) *http.Server
func NewGqlResolver ¶
func NewGqlResolver( dbConn *sql.DB, identityManager *IdentityManager, storageDefRepo storage.StorageDefRepo, storedImageRepo storage.StoredImageRepo, imageRepo image.ImageRepo, imageRelRepo image.ImageRelationshipRepo, imageDomain string, defaultURLFormat domainmodels.ImageURLFormat, getEmailBackend func(c context.Context) email.EmailBackend, secretKey string, captchaClient captcha.CaptchaClient, allowNewUser bool, imageMaxUploadBytes int64, guestImageMaxUploadBytes int64, ) *graph.Resolver
func ParseOriginList ¶
Types ¶
type ContextKey ¶
type ContextKey string
type HttpContextUserManager ¶
type HttpContextUserManager struct {
// contains filtered or unexported fields
}
func NewContextUserManager ¶
func NewContextUserManager(contextKey string, identityRepo identity.IdentityRepo) *HttpContextUserManager
func (*HttpContextUserManager) GetAuthenticationInfo ¶
func (cu *HttpContextUserManager) GetAuthenticationInfo(c context.Context) *identity.AuthenticationInfo
func (*HttpContextUserManager) SetAuthenticationInfo ¶
func (cu *HttpContextUserManager) SetAuthenticationInfo(c context.Context, authenticationInfo *identity.AuthenticationInfo)
func (*HttpContextUserManager) WithAuthenticationInfo ¶
func (cu *HttpContextUserManager) WithAuthenticationInfo(c context.Context, authenticationInfo *identity.AuthenticationInfo) context.Context
type HttpServerConfigDef ¶
type HttpServerConfigDef struct {
Bind string
WriteTimeout int
ReadTimeout int
TemplatesFS fs.FS
StaticFS fs.FS
SessionKey string
RedisURIForSession string
RedisURI string
SiteName string
SiteTitle string
ImageDomain string
DefaultURLFormat domainmodels.ImageURLFormat
EnableGqlPlayground bool
EnableSafeImageCheck bool
SafeImageCheckEndpoint string
CaptchaProvider captcha.CaptchaProvider
RecaptchaClientKey string
TurnstileSiteKey string
RecaptchaServerKey string
TurnstileSecretKey string
CustomCSS string
CustomJS string
GoogleAnalyticsID string
AllowUpload bool
AllowNewUser bool
ImageCacheMaxBytes int64
ImageCacheMaxFileBytes int64
ImageMaxUploadBytes int64
GuestImageMaxUploadBytes int64
WebUIOrigins []string
}
func ReadServerConfigFromEnv ¶
func ReadServerConfigFromEnv() HttpServerConfigDef
type IdentityManager ¶
type IdentityManager struct {
IdentityRepo identity.IdentityRepo
ContextUserManager identity.ContextUserManager
Persister persister.Persister
}
func NewIdentityManager ¶
func NewIdentityManager(identityRepo identity.IdentityRepo, persister persister.Persister) *IdentityManager
func (*IdentityManager) Authenticate ¶
func (i *IdentityManager) Authenticate(w http.ResponseWriter, r *http.Request, userId string, organizationUserId string)
func (*IdentityManager) AuthenticateContext ¶
func (i *IdentityManager) AuthenticateContext(c context.Context, userId string, organzationUserId string)
func (*IdentityManager) Logout ¶
func (i *IdentityManager) Logout(w http.ResponseWriter, r *http.Request)
func (*IdentityManager) LogoutContext ¶
func (i *IdentityManager) LogoutContext(c context.Context)
func (*IdentityManager) Middleware ¶
func (i *IdentityManager) Middleware(next http.Handler) http.Handler
Source Files
¶
Click to show internal directories.
Click to hide internal directories.