Documentation ¶
Index ¶
- func GetProjectManager(req *http.Request) (promgr.ProjectManager, error)
- func GetSecurityContext(req *http.Request) (security.Context, error)
- func Init()
- func MediaTypeFilter(mediaType ...string) func(*beegoctx.Context)
- func ReadonlyFilter(ctx *context.Context)
- func ReqCarriesSession(req *http.Request) bool
- func SecurityFilter(ctx *beegoctx.Context)
- func SessionCheck(ctx *beegoctx.Context)
- type ContextValueKey
- type ReqCtxModifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProjectManager ¶
func GetProjectManager(req *http.Request) (promgr.ProjectManager, error)
GetProjectManager tries to get project manager from request and returns it
func GetSecurityContext ¶
GetSecurityContext tries to get security context from request and returns it
func MediaTypeFilter ¶
MediaTypeFilter filters the POST request, it returns 415 if the content type of the request doesn't match the preset ones.
func ReadonlyFilter ¶
ReadonlyFilter filters the deletion or creation (e.g. retag) of repo/tag requests and returns 503.
func ReqCarriesSession ¶ added in v1.8.5
ReqCarriesSession verifies if the request carries session when
func SecurityFilter ¶
SecurityFilter authenticates the request and passes a security context and a project manager with it which can be used to do some authN & authZ
func SessionCheck ¶ added in v1.8.5
SessionCheck is a filter to mark the requests that carries a session id, it has to be registered as "beego.BeforeStatic" because beego will modify the request after execution of these filters, all requests will appear to have a session id cookie.
Types ¶
type ContextValueKey ¶
type ContextValueKey string
ContextValueKey for content value
const ( // SecurCtxKey is context value key for security context SecurCtxKey ContextValueKey = "harbor_security_context" // PmKey is context value key for the project manager PmKey ContextValueKey = "harbor_project_manager" // AuthModeKey is context key for auth mode AuthModeKey ContextValueKey = "harbor_auth_mode" )
const SessionReqKey ContextValueKey = "harbor_with_session_req"
SessionReqKey is the key in the context of a request to mark the request carries session when reaching the backend
type ReqCtxModifier ¶
ReqCtxModifier modifies the context of request