session

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionStateNew            = SessionState("NEW")
	SessionStateRemoteAttached = SessionState("REMOTE_ATTACHED")
	SessionStateIdentified     = SessionState("IDENTIFIED")
	SessionStateDead           = SessionState("EXCHANGED")
)
View Source
const (

	// The default token expiration time.
	// This is exported, so it can be used to set the expiration
	// time in refresh token flow.
	DefaultSessionValidityWindow = 12 * time.Hour
)

Variables

This section is empty.

Functions

func DefaultGenerateCode

func DefaultGenerateCode() (string, error)

Types

type GenerateCodeFunc

type GenerateCodeFunc func() (string, error)

type Session

type Session struct {
	ConnectorID string
	ID          string
	State       SessionState
	CreatedAt   time.Time
	ExpiresAt   time.Time
	ClientID    string
	ClientState string
	RedirectURL url.URL
	Identity    oidc.Identity
	UserID      string

	// Regsiter indicates that this session is a registration flow.
	Register bool

	// Nonce is optionally provided in the initial authorization request, and propogated in such cases to the generated claims.
	Nonce string

	// Scope is the 'scope' field in the authentication request. Example scopes are 'openid', 'email', 'offline', etc.
	Scope []string
}

func (*Session) Claims

func (s *Session) Claims(issuerURL string) jose.Claims

Claims returns a new set of Claims for the current session. The "sub" of the returned Claims is that of the dex User, not whatever remote Identity was used to authenticate.

type SessionKey

type SessionKey struct {
	Key       string
	SessionID string
}

type SessionKeyRepo

type SessionKeyRepo interface {
	Push(SessionKey, time.Duration) error
	Pop(string) (string, error)
}

func NewSessionKeyRepo

func NewSessionKeyRepo() SessionKeyRepo

func NewSessionKeyRepoWithClock

func NewSessionKeyRepoWithClock(clock clockwork.Clock) SessionKeyRepo

type SessionManager

type SessionManager struct {
	GenerateCode   GenerateCodeFunc
	Clock          clockwork.Clock
	ValidityWindow time.Duration
	// contains filtered or unexported fields
}

func NewSessionManager

func NewSessionManager(sRepo SessionRepo, skRepo SessionKeyRepo) *SessionManager

func (*SessionManager) AttachRemoteIdentity

func (m *SessionManager) AttachRemoteIdentity(sessionID string, ident oidc.Identity) (*Session, error)

func (*SessionManager) AttachUser

func (m *SessionManager) AttachUser(sessionID string, userID string) (*Session, error)

func (*SessionManager) ExchangeKey

func (m *SessionManager) ExchangeKey(key string) (string, error)

func (*SessionManager) Get

func (m *SessionManager) Get(sessionID string) (*Session, error)

func (*SessionManager) Kill

func (m *SessionManager) Kill(sessionID string) (*Session, error)

func (*SessionManager) NewSession

func (m *SessionManager) NewSession(connectorID, clientID, clientState string, redirectURL url.URL, nonce string, register bool, scope []string) (string, error)

func (*SessionManager) NewSessionKey

func (m *SessionManager) NewSessionKey(sessionID string) (string, error)

type SessionRepo

type SessionRepo interface {
	Get(string) (*Session, error)
	Create(Session) error
	Update(Session) error
}

func NewSessionRepo

func NewSessionRepo() SessionRepo

func NewSessionRepoWithClock

func NewSessionRepoWithClock(clock clockwork.Clock) SessionRepo

type SessionState

type SessionState string

Jump to

Keyboard shortcuts

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