Documentation ¶
Index ¶
- func ContentTypeJSON(next http.Handler) http.Handler
- type AccessType
- type Auth
- func (auth *Auth) BasicAuthenticate(next http.Handler) http.Handler
- func (auth *Auth) BasicAuthenticateWithRedirect(next http.Handler) http.Handler
- func (auth *Auth) DoesUserHaveAWSIntegrationAccess(next http.Handler, projLoc IDLocation, awsLoc IDLocation, optional bool) http.Handler
- func (auth *Auth) DoesUserHaveClusterAccess(next http.Handler, projLoc IDLocation, clusterLoc IDLocation) http.Handler
- func (auth *Auth) DoesUserHaveDOIntegrationAccess(next http.Handler, projLoc IDLocation, doLoc IDLocation, optional bool) http.Handler
- func (auth *Auth) DoesUserHaveGCPIntegrationAccess(next http.Handler, projLoc IDLocation, gcpLoc IDLocation, optional bool) http.Handler
- func (auth *Auth) DoesUserHaveGitRepoAccess(next http.Handler, projLoc IDLocation, gitRepoLoc IDLocation) http.Handler
- func (auth *Auth) DoesUserHaveInfraAccess(next http.Handler, projLoc IDLocation, infraLoc IDLocation) http.Handler
- func (auth *Auth) DoesUserHaveInviteAccess(next http.Handler, projLoc IDLocation, inviteLoc IDLocation) http.Handler
- func (auth *Auth) DoesUserHaveProjectAccess(next http.Handler, projLoc IDLocation, accessType AccessType) http.Handler
- func (auth *Auth) DoesUserHaveRegistryAccess(next http.Handler, projLoc IDLocation, registryLoc IDLocation) http.Handler
- func (auth *Auth) DoesUserIDMatch(next http.Handler, loc IDLocation) http.Handler
- type IDLocation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessType ¶
type AccessType string
AccessType represents the various access types for a project
const ( ReadAccess AccessType = "read" WriteAccess AccessType = "write" )
The various access types
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth implements the authorization functions
func NewAuth ¶
func NewAuth( store sessions.Store, cookieName string, tokenConf *token.TokenGeneratorConf, repo *repository.Repository, ) *Auth
NewAuth returns a new Auth instance
func (*Auth) BasicAuthenticate ¶
BasicAuthenticate just checks that a user is logged in
func (*Auth) BasicAuthenticateWithRedirect ¶
BasicAuthenticateWithRedirect checks that a user is logged in, and if they're not, the user is redirected to the login page with the redirect path stored in the session
func (*Auth) DoesUserHaveAWSIntegrationAccess ¶
func (auth *Auth) DoesUserHaveAWSIntegrationAccess( next http.Handler, projLoc IDLocation, awsLoc IDLocation, optional bool, ) http.Handler
DoesUserHaveAWSIntegrationAccess looks for a project_id parameter and an aws_integration_id parameter, and verifies that the infra belongs to the project
func (*Auth) DoesUserHaveClusterAccess ¶
func (auth *Auth) DoesUserHaveClusterAccess( next http.Handler, projLoc IDLocation, clusterLoc IDLocation, ) http.Handler
DoesUserHaveClusterAccess looks for a project_id parameter and a cluster_id parameter, and verifies that the cluster belongs to the project
func (*Auth) DoesUserHaveDOIntegrationAccess ¶
func (auth *Auth) DoesUserHaveDOIntegrationAccess( next http.Handler, projLoc IDLocation, doLoc IDLocation, optional bool, ) http.Handler
DoesUserHaveDOIntegrationAccess looks for a project_id parameter and an do_integration_id parameter, and verifies that the infra belongs to the project
func (*Auth) DoesUserHaveGCPIntegrationAccess ¶
func (auth *Auth) DoesUserHaveGCPIntegrationAccess( next http.Handler, projLoc IDLocation, gcpLoc IDLocation, optional bool, ) http.Handler
DoesUserHaveGCPIntegrationAccess looks for a project_id parameter and an gcp_integration_id parameter, and verifies that the infra belongs to the project
func (*Auth) DoesUserHaveGitRepoAccess ¶
func (auth *Auth) DoesUserHaveGitRepoAccess( next http.Handler, projLoc IDLocation, gitRepoLoc IDLocation, ) http.Handler
DoesUserHaveGitRepoAccess looks for a project_id parameter and a git_repo_id parameter, and verifies that the git repo belongs to the project
func (*Auth) DoesUserHaveInfraAccess ¶
func (auth *Auth) DoesUserHaveInfraAccess( next http.Handler, projLoc IDLocation, infraLoc IDLocation, ) http.Handler
DoesUserHaveInfraAccess looks for a project_id parameter and an infra_id parameter, and verifies that the infra belongs to the project
func (*Auth) DoesUserHaveInviteAccess ¶
func (auth *Auth) DoesUserHaveInviteAccess( next http.Handler, projLoc IDLocation, inviteLoc IDLocation, ) http.Handler
DoesUserHaveInviteAccess looks for a project_id parameter and a invite_id parameter, and verifies that the invite belongs to the project
func (*Auth) DoesUserHaveProjectAccess ¶
func (auth *Auth) DoesUserHaveProjectAccess( next http.Handler, projLoc IDLocation, accessType AccessType, ) http.Handler
DoesUserHaveProjectAccess looks for a project_id parameter and checks that the user has access via the specified accessType
func (*Auth) DoesUserHaveRegistryAccess ¶
func (auth *Auth) DoesUserHaveRegistryAccess( next http.Handler, projLoc IDLocation, registryLoc IDLocation, ) http.Handler
DoesUserHaveRegistryAccess looks for a project_id parameter and a registry_id parameter, and verifies that the registry belongs to the project
func (*Auth) DoesUserIDMatch ¶
DoesUserIDMatch checks the id URL parameter and verifies that it matches the one stored in the session
type IDLocation ¶
type IDLocation uint
IDLocation represents the location of the ID to use for authentication
const ( // URLParam location looks for a parameter in the URL endpoint URLParam IDLocation = iota // BodyParam location looks for a parameter in the body BodyParam // QueryParam location looks for a parameter in the query string QueryParam )