authentication

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const CookieOauth = "state"

CookieOauth is the cookie name used for login

View Source
const Disabled = 3

Disabled authentication ignores all internal authentication procedures. A reverse proxy needs to restrict access

View Source
const Header = 2

Header authentication relies on a header from a reverse proxy to parse the username

View Source
const Internal = 0

Internal authentication method uses a user / password combination handled by Gokapi

View Source
const OAuth2 = 1

OAuth2 authentication retrieves the users email with Open Connect ID

Variables

This section is empty.

Functions

func CheckOauthUserAndRedirect added in v1.8.1

func CheckOauthUserAndRedirect(userInfo OAuthUserInfo, w http.ResponseWriter) error

CheckOauthUserAndRedirect checks if the user is allowed to use the Gokapi instance

func Init

func Init(config models.AuthenticationConfig)

Init needs to be called first to process the authentication configuration

func IsAuthenticated

func IsAuthenticated(w http.ResponseWriter, r *http.Request) bool

IsAuthenticated returns true if the user provides a valid authentication

func IsCorrectUsernameAndPassword

func IsCorrectUsernameAndPassword(username, password string) bool

IsCorrectUsernameAndPassword checks if a provided username and password is correct

func IsEqualStringConstantTime

func IsEqualStringConstantTime(s1, s2 string) bool

IsEqualStringConstantTime uses ConstantTimeCompare to prevent timing attack.

func IsLogoutAvailable

func IsLogoutAvailable() bool

IsLogoutAvailable returns true if a logout button should be shown with the current form of authentication

func Logout

func Logout(w http.ResponseWriter, r *http.Request)

Logout logs the user out and removes the session

Types

type OAuthUserClaims added in v1.8.1

type OAuthUserClaims interface {
	Claims(v interface{}) error
}

OAuthUserClaims contains the claims

type OAuthUserInfo added in v1.8.1

type OAuthUserInfo struct {
	Subject    string
	Email      string
	ClaimsSent OAuthUserClaims
}

OAuthUserInfo is used to make testing easier. This results in an additional parameter for the subject unfortunately

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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