auth

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

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 string, storeSecret string, clientID string, clientSecret string,
	redirectURI string, gitLabServer string) *Auth

New when authentication supported this will be used to create authentication handler

func (*Auth) CheckAuthentication

func (a *Auth) CheckAuthentication(w http.ResponseWriter, r *http.Request, projectID uint64) bool

CheckAuthentication checks if user is authenticated and has access to the project

func (*Auth) CheckAuthenticationWithoutProject

func (a *Auth) CheckAuthenticationWithoutProject(w http.ResponseWriter, r *http.Request) 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) GetTokenIfExists added in v1.10.0

func (a *Auth) GetTokenIfExists(w http.ResponseWriter, r *http.Request) (string, error)

GetTokenIfExists returns the token if it exists

func (*Auth) IsAuthSupported

func (a *Auth) IsAuthSupported() bool

IsAuthSupported checks if pages is running with the authentication support

func (*Auth) RequireAuth added in v1.10.0

func (a *Auth) RequireAuth(w http.ResponseWriter, r *http.Request) bool

RequireAuth will trigger authentication flow if no token exists

func (*Auth) TryAuthenticate

func (a *Auth) TryAuthenticate(w http.ResponseWriter, r *http.Request, domains source.Source) bool

TryAuthenticate tries to authenticate user and fetch access token if request is a callback to auth

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL