Welcome to mirror list, hosted at ThFree Co, Russian Federation.

interface.go « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 55ed72fa7f1bcd92ff81d36675fd9c8952a399fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package internal

import (
	"net/http"
)

// Artifact allows to handle artifact related requests
type Artifact interface {
	TryMakeRequest(w http.ResponseWriter, r *http.Request, token string, responseHandler func(*http.Response) bool) bool
}

// Auth handles the authentication logic
type Auth interface {
	IsAuthSupported() bool
	RequireAuth(w http.ResponseWriter, r *http.Request, domain Domain) bool
	GetTokenIfExists(w http.ResponseWriter, r *http.Request) (string, error)
	CheckResponseForInvalidToken(w http.ResponseWriter, r *http.Request, resp *http.Response) bool
}

type Domain interface {
	GetProjectID(r *http.Request) uint64
	GetProjectPrefix(r *http.Request) string
	ServeNotFoundAuthFailed(w http.ResponseWriter, r *http.Request)
}