auth

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const RoleAdmin = "admin"

Variables

This section is empty.

Functions

This section is empty.

Types

type OIDCClient

type OIDCClient struct {
	// contains filtered or unexported fields
}

func NewOIDCClient

func NewOIDCClient(issuerURL, clientID, clientSecret string) (*OIDCClient, error)

func (*OIDCClient) GetAuthCodeURL

func (c *OIDCClient) GetAuthCodeURL(redirectURL string) (url, state string)

GetAuthCodeURL generates a random state and returns an auth code URL and the generated state

func (*OIDCClient) ValidateCallbackWithRoles

func (c *OIDCClient) ValidateCallbackWithRoles(ctx context.Context, expectedState, queryState, queryCode string, roles []string) (subject string, err error)

type SessionAuthenticator

type SessionAuthenticator struct {
	// contains filtered or unexported fields
}

func NewSessionAuthenticator

func NewSessionAuthenticator(sessionValidity time.Duration) *SessionAuthenticator

func (*SessionAuthenticator) MW

func (s *SessionAuthenticator) MW(redirectPathNotLoggedIn string) gin.HandlerFunc

func (*SessionAuthenticator) MustHaveSessionLogin

func (s *SessionAuthenticator) MustHaveSessionLogin(c *gin.Context) (username string, err error)

func (*SessionAuthenticator) StartSession

func (s *SessionAuthenticator) StartSession(session sessions.Session, username string) error

Jump to

Keyboard shortcuts

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