session

package
v1.5.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SessionManagerClaimsIssuer fills the "iss" field of the token.
	SessionManagerClaimsIssuer = "argocd"
)

Variables

This section is empty.

Functions

func Groups added in v1.3.0

func Groups(ctx context.Context) []string

func Iat added in v1.5.0

func Iat(ctx context.Context) (time.Time, error)

func Iss added in v1.3.0

func Iss(ctx context.Context) string

func LoggedIn added in v1.3.0

func LoggedIn(ctx context.Context) bool

func Sub added in v1.3.0

func Sub(ctx context.Context) string

func Username

func Username(ctx context.Context) string

Username is a helper to extract a human readable username from a context

Types

type SessionManager

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

SessionManager generates and validates JWT tokens for login sessions.

func NewSessionManager

func NewSessionManager(settingsMgr *settings.SettingsManager, dexServerAddr string) *SessionManager

NewSessionManager creates a new session manager from Argo CD settings

func (*SessionManager) Create

func (mgr *SessionManager) Create(subject string, secondsBeforeExpiry int64, id string) (string, error)

Create creates a new token for a given subject (user) and returns it as a string. Passing a value of `0` for secondsBeforeExpiry creates a token that never expires. The id parameter holds an optional unique JWT token identifier and stored as a standard claim "jti" in the JWT token.

func (*SessionManager) Parse

func (mgr *SessionManager) Parse(tokenString string) (jwt.Claims, error)

Parse tries to parse the provided string and returns the token claims for local login.

func (*SessionManager) VerifyToken

func (mgr *SessionManager) VerifyToken(tokenString string) (jwt.Claims, error)

VerifyToken verifies if a token is correct. Tokens can be issued either from us or by an IDP. We choose how to verify based on the issuer.

func (*SessionManager) VerifyUsernamePassword

func (mgr *SessionManager) VerifyUsernamePassword(username string, password string) error

VerifyUsernamePassword verifies if a username/password combo is correct

Jump to

Keyboard shortcuts

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