Documentation ¶
Index ¶
- func ForEachRole(roles string, next func(role string))
- func HasRole(roles, test string) bool
- func NewHttpServer(conf Conf, db *database.DB, signingKey mjwt.Signer) *http.Server
- func ParseClaims(claims string) map[string]bool
- func PrepareRedirectUrl(targetPath string, origin *url.URL) *url.URL
- type Conf
- type HttpServer
- func (h *HttpServer) DbTx(rw http.ResponseWriter, action func(tx *database.Tx) error) bool
- func (h *HttpServer) DbTxRaw(action func(tx *database.Tx) error) bool
- func (h *HttpServer) Home(rw http.ResponseWriter, _ *http.Request, _ httprouter.Params, auth UserAuth)
- func (h *HttpServer) ManageAppsGet(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth)
- func (h *HttpServer) ManageAppsPost(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth)
- func (h *HttpServer) ManageUsersGet(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth)
- func (h *HttpServer) ManageUsersPost(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth)
- func (h *HttpServer) OptionalAuthentication(next UserHandler) httprouter.Handle
- func (h *HttpServer) RequireAdminAuthentication(next UserHandler) httprouter.Handle
- func (h *HttpServer) RequireAuthentication(next UserHandler) httprouter.Handle
- func (h *HttpServer) SafeRedirect(rw http.ResponseWriter, req *http.Request)
- type IdTokenClaims
- type JWTAccessGenerate
- type UserAuth
- type UserHandler
- type UserInfoFields
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForEachRole ¶
func NewHttpServer ¶
func ParseClaims ¶
Types ¶
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func (*HttpServer) DbTx ¶
func (h *HttpServer) DbTx(rw http.ResponseWriter, action func(tx *database.Tx) error) bool
DbTx wraps a database transaction with http error messages and a simple action function. If the action function returns an error the transaction will be rolled back. If there is no error then the transaction is committed.
func (*HttpServer) Home ¶
func (h *HttpServer) Home(rw http.ResponseWriter, _ *http.Request, _ httprouter.Params, auth UserAuth)
func (*HttpServer) ManageAppsGet ¶
func (h *HttpServer) ManageAppsGet(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth)
func (*HttpServer) ManageAppsPost ¶
func (h *HttpServer) ManageAppsPost(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth)
func (*HttpServer) ManageUsersGet ¶
func (h *HttpServer) ManageUsersGet(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth)
func (*HttpServer) ManageUsersPost ¶
func (h *HttpServer) ManageUsersPost(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth)
func (*HttpServer) OptionalAuthentication ¶
func (h *HttpServer) OptionalAuthentication(next UserHandler) httprouter.Handle
func (*HttpServer) RequireAdminAuthentication ¶
func (h *HttpServer) RequireAdminAuthentication(next UserHandler) httprouter.Handle
func (*HttpServer) RequireAuthentication ¶
func (h *HttpServer) RequireAuthentication(next UserHandler) httprouter.Handle
func (*HttpServer) SafeRedirect ¶
func (h *HttpServer) SafeRedirect(rw http.ResponseWriter, req *http.Request)
type IdTokenClaims ¶
type IdTokenClaims struct {
Subject string `json:"subject"`
}
IdTokenClaims contains the JWT claims for an access token
func (IdTokenClaims) Type ¶
func (a IdTokenClaims) Type() string
func (IdTokenClaims) Valid ¶
func (a IdTokenClaims) Valid() error
type JWTAccessGenerate ¶
type JWTAccessGenerate struct {
// contains filtered or unexported fields
}
func NewJWTAccessGenerate ¶
func NewJWTAccessGenerate(signer mjwt.Signer, db *database.DB) *JWTAccessGenerate
type UserAuth ¶
type UserAuth struct { ID string DisplayName string UserInfo UserInfoFields }
type UserHandler ¶
type UserHandler func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, auth UserAuth)
type UserInfoFields ¶
func (UserInfoFields) GetBoolean ¶
func (u UserInfoFields) GetBoolean(key string) (bool, bool)
func (UserInfoFields) GetStringOrDefault ¶
func (u UserInfoFields) GetStringOrDefault(key, other string) string
func (UserInfoFields) GetStringOrEmpty ¶
func (u UserInfoFields) GetStringOrEmpty(key string) string
Click to show internal directories.
Click to hide internal directories.