{"modulePath":"github.com/liquidgecka/blobby","version":"v0.0.0-20261108055455-e9a390ceacc7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package access\n\n## Types\n\n```go\ntype ACL struct {\n\t// A list of Required accessors. These must be true for all requests that\n\t// pass through this resource.\n\tRequired []Method\n\n\t// A list of optional accessors. At least one of these must be true\n\t// in order for a request to flow through this resource. If this is not\n\t// defined then only Required will be used.\n\tAny []Method\n}\n```\nFor some request times access can be limited in several different ways including: IP white listing and authentication. This object allows those methods to be configured.\n\n```go\nfunc (a *ACL) Assert(ir *request.Request)\n```\nChecks a given Request and sees if it should be allowed.\n\n```go\nfunc (a *ACL) Proxy(source, dest *http.Request)\n```\nWhen proxying a request forward to a different blobby server this will walk through each access control method to make sure that it can set the appropriate values on the request so that it gets auth details forwarded.\n\n```go\ntype BasicAuth struct {\n\t// Access to the htpasswd data.\n\tUsers *secretloader.HTPasswd\n\n\t// The realm that will be returned to the user if they fail to auth.\n\tRealm string\n\n\t// The tags required for this resource. If no tags are required then\n\t// all users will be allowed.\n\tUserTags []string\n}\n```\nIf a Request can be authenticated with Basic Auth then this will handle the authentication cycle.\n\n```go\ntype Method interface {\n\t// contains filtered or unexported methods\n}\n```\nA tool used to validate that a given request is allowed to proceed. It is expected that this gets implemented by the various authentication methods in the access package.\n\n```go\ntype SAML struct {\n\t// The Secret Loader that manages access to the SAML Identity Provider.\n\tProvider *secretloader.SAMLProvider\n\n\t// How long to allow SAML based authentication to be valid for. Setting\n\t// this too high will make it impossible to expunge a logged in user from\n\t// the system without removing the user completely. Setting it too low\n\t// will be annoying for users as they will have to login constantly.\n\tCookieValidity time.Duration\n\n\t// The name of the cookie to use for authentication. This name should\n\t// not conflict with any other possible cookies used on this domain.\n\tCookieName string\n\n\t// The domain that the cookie will be limited too.\n\tCookieDomain string\n\n\t// Used for encrypting the contents of the cookie.\n\tCookieTool *cookie.CookieTool\n\n\t// Set to secure if the cookie should only ever be returned over https.\n\tCookieSecure bool\n\n\t// The amount of time that a user has after being directed to the\n\t// Identity Provider before the login attempt is considered\n\t// expired.\n\tLoginDuration time.Duration\n\n\t// The name of the SAML attribute that will be used when assigning login\n\t// names. This is useful if your provider uses displayName over say\n\t// uid. If not set this will default to \"uid\"\n\tUserNameAttribute string\n\n\t// The name of the SAML attribute that will be used when setting up\n\t// tags. Each tag within this attribute will be usable with the\n\t// UserTags portion of the SAMLAuth object type.\n\tTagAttribute string\n}\n```\nHandle all of configuration for a SAML provider that can be used with access control lists.\n\n```go\nfunc (s *SAML) MetaData(ir *request.Request)\n```\nWrites the meta data for the service provider out to the given request object.\n\n```go\nfunc (s *SAML) Post(ir *request.Request)\n```\nCalled when an IDP response is issued to the httpserver. This will take the response, validate it, and if its valid then sets a cookie that will be used for future requests.\n\n```go\ntype SAMLAuth struct {\n\t// The reference to the common provider for this SAML instance.\n\tSource *SAML\n\n\t// If provided then users must have all of the given tags to be able\n\t// to authenticate to this service.\n\tUserTags []string\n}\n```\nA specific implementation of a SAMLAuth that will validate that the user has logged in.\n\n```go\ntype WebAuth struct {\n\t// The Provider that configures users.\n\tProvider *WebAuthProvider\n\n\t// A list of tags that users must have in order to access this\n\t// resource. All tags must be present in the user profile for this\n\t// to work. Alternatively if this is left nil then all users\n\t// will be allowed access.\n\tUserTags []string\n}\n```\nAn acl.Method implementation of WebAuthProvider that uses the provider but allows individual resources to configure Tags required by users.\n\n```go\ntype WebAuthProvider struct {\n\t// Access to the htpasswd data.\n\tUsers *secretloader.HTPasswd\n\n\t// How long to allow the web authentication to be valid for. Setting this\n\t// too high will make it impossible to expunge a logged in user from the\n\t// system without removing the user entry completely. Setting it too low\n\t// will be annoying for users as they will have to login in constantly.\n\tCookieValidity time.Duration\n\n\t// The Name of the cookie to use when setting the authorized cookie.\n\tCookieName string\n\n\t// The domain that web login cookies should be restricted too.\n\tCookieDomain string\n\n\t// Used for encrypting the contents of the cookie.\n\tCookieTool *cookie.CookieTool\n}\n```\nIf a Request can be authenticated with Web Auth then this will handle the authentication cycle.\n\n```go\nfunc (w *WebAuthProvider) LoginGet(ir *request.Request)\n```\nHandles requests to /\\_login (GET)\n\n```go\nfunc (w *WebAuthProvider) LoginPost(ir *request.Request)\n```\nHandles request to /\\_login (POST)\n\n```go\ntype WhiteList struct {\n\t// A list of IP/Mask combinations that can be used to limit who can\n\t// access a given resource within the HTTP server.\n\tCIDRs []net.IPNet\n\n\t// Allow the following IPs to set the value of RemoteAddr via the\n\t// X-Forwarded-For header. This should be restricted to a list of\n\t// trusted hosts as they will effectively be able to circumvent the\n\t// IP white listing process.\n\tAllowXForwardedForFrom []net.IPNet\n}\n```\nHandles CIDR white listing requests.\n\n","path":"github.com/liquidgecka/blobby/httpserver/access","name":"access","synopsis":"","isRedistributable":true}
