Documentation ¶
Index ¶
- type Auth
- func (a *Auth) AuthenticationMiddleware(handler http.Handler, s source.Source) http.Handler
- func (a *Auth) AuthorizationMiddleware(handler http.Handler) http.Handler
- func (a *Auth) CheckAuthentication(w http.ResponseWriter, r *http.Request, domain domain) bool
- func (a *Auth) CheckAuthenticationWithoutProject(w http.ResponseWriter, r *http.Request, domain domain) bool
- func (a *Auth) CheckResponseForInvalidToken(w http.ResponseWriter, r *http.Request, resp *http.Response) bool
- func (a *Auth) DecryptCode(jwt, domain string) (string, error)
- func (a *Auth) EncryptAndSignCode(domain, code string) (string, error)
- func (a *Auth) GetTokenIfExists(w http.ResponseWriter, r *http.Request) (string, error)
- func (a *Auth) IsAuthSupported() bool
- func (a *Auth) RequireAuth(w http.ResponseWriter, r *http.Request) bool
- func (a *Auth) TryAuthenticate(w http.ResponseWriter, r *http.Request, domains source.Source) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth handles authenticating users with GitLab API
func New ¶
func New(pagesDomain, storeSecret, clientID, clientSecret, redirectURI, internalGitlabServer, publicGitlabServer, authScope string, authTimeout, cookieSessionTimeout time.Duration) (*Auth, error)
New when authentication supported this will be used to create authentication handler
func (*Auth) AuthenticationMiddleware ¶ added in v1.46.0
AuthenticationMiddleware handles authentication requests
func (*Auth) AuthorizationMiddleware ¶ added in v1.46.0
AuthorizationMiddleware handles authorization
func (*Auth) CheckAuthentication ¶
CheckAuthentication checks if user is authenticated and has access to the project will return contentServed = false when authFailed = true
func (*Auth) CheckAuthenticationWithoutProject ¶
func (a *Auth) CheckAuthenticationWithoutProject(w http.ResponseWriter, r *http.Request, domain domain) bool
CheckAuthenticationWithoutProject checks if user is authenticated and has a valid token
func (*Auth) CheckResponseForInvalidToken ¶ added in v1.10.0
func (a *Auth) CheckResponseForInvalidToken(w http.ResponseWriter, r *http.Request, resp *http.Response, ) bool
CheckResponseForInvalidToken checks response for invalid token and destroys session if it was invalid
func (*Auth) DecryptCode ¶ added in v1.28.1
DecryptCode decodes the secureCode as a JWT token and validates its signature. It then decrypts the code from the token claims and returns it.
func (*Auth) EncryptAndSignCode ¶ added in v1.28.1
EncryptAndSignCode encrypts the OAuth code deriving the key from the domain. It adds the code and domain as JWT token claims and signs it using signingKey derived from the Auth secret.
func (*Auth) GetTokenIfExists ¶ added in v1.10.0
GetTokenIfExists returns the token if it exists
func (*Auth) IsAuthSupported ¶
IsAuthSupported checks if pages is running with the authentication support
func (*Auth) RequireAuth ¶ added in v1.10.0
RequireAuth will trigger authentication flow if no token exists
func (*Auth) TryAuthenticate ¶
TryAuthenticate tries to authenticate user and fetch access token if request is a callback to /auth?