session

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SessionKey = keySession("cat-session")
)

Functions

func NewManager

func NewManager(logger zerolog.Logger, expiration time.Duration, filePath string) (*sessionManager, error)

NewManager creates a new sessionManager with the given logger, expiration duration, and file path. It loads the active sessions from the given file path, and returns an error if the file does not exist or if there is an error loading the sessions.

Types

type OidcParams

type OidcParams struct {
	MetadataUrl   string        `json:"metadata_url" yaml:"metadata_url"`
	PublicClient  bool          `json:"public_client" yaml:"public_client"`
	PKCE          bool          `json:"pkce" yaml:"pkce"`
	PKCEData      *pkce.PKCE    `json:"-" yaml:"-"`
	ResponseType  responseType  `json:"response_type" yaml:"response_type"`
	ClientID      string        `json:"client_id" yaml:"client_id"`
	Secret        string        `json:"secret" yaml:"secret"`
	RedirectURI   string        `json:"redirect_uri" yaml:"redirect_uri"`
	Scopes        []string      `json:"scopes" yaml:"scopes"`
	ErrorResponse errorResponse `json:"error_response" yaml:"-"`
}

type SamlParams

type SamlParams struct {
	IdpUrl             string        `json:"idp_url" yaml:"idp_url"`
	SPEntityID         string        `json:"sp_entity_id" yaml:"sp_entity_id"`
	SPMetadataUrl      string        `json:"sp_metadata_url" yaml:"sp_metadata_url"`
	IdpMetadata        string        `json:"idp_metadata" yaml:"idp_metadata"`
	RequestSigning     bool          `json:"request_signing" yaml:"request_signing"`
	RequestSigningAlgo string        `json:"request_signing_algo" yaml:"request_signing_algo"`
	AddEncryptionCert  bool          `json:"add_encryption_cert" yaml:"add_encryption_cert"`
	AllowIdpInitiated  bool          `json:"allow_idp_initiated" yaml:"allow_idp_initiated"`
	NameIdFormat       string        `json:"name_id_format" yaml:"name_id_format"`
	Certificates       certificates  `json:"certificates" yaml:"certificates"`
	ActiveCert         string        `json:"active_cert" yaml:"active_cert"`
	ErrorResponse      errorResponse `json:"error_response" yaml:"-"`
}

type Session

type Session struct {
	ID         string             `json:"id" yaml:"id"`
	Shared     bool               `json:"shared" yaml:"shared"`
	Expires    time.Time          `json:"expires" yaml:"expires"`
	SAMLConfig SamlParams         `json:"saml,omitempty" yaml:"saml,omitempty"`
	OIDCConfig OidcParams         `json:"oidc,omitempty" yaml:"oidc,omitempty"`
	SAMLSP     *samlsp.Middleware `json:"-" yaml:"-"`
	OIDCClient oidcClient         `json:"-" yaml:"-"`
}

func (*Session) Valid

func (s *Session) Valid() bool

Valid returns true if the session has not expired, false otherwise.

Jump to

Keyboard shortcuts

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