Documentation
¶
Overview ¶
package session implements the session management for the application.
Index ¶
- type LogHandler
- type OIDCAzureHandlers
- type OIDCAzureSession
- func (s *OIDCAzureSession) Authenticated() http.HandlerFunc
- func (o *OIDCAzureSession) CallbackOIDC() http.HandlerFunc
- func (o *OIDCAzureSession) FrontChannelLogout() http.HandlerFunc
- func (o *OIDCAzureSession) Login() http.HandlerFunc
- func (s *OIDCAzureSession) Logout() http.HandlerFunc
- func (s *OIDCAzureSession) SetSessionTimeout(next http.Handler) http.Handler
- func (s *OIDCAzureSession) SetXSRFToken(next http.Handler) http.Handler
- func (s *OIDCAzureSession) StartSession(next http.Handler) http.Handler
- func (s *OIDCAzureSession) ValidateSession(next http.Handler) http.Handler
- func (s *OIDCAzureSession) ValidateXSRFToken(next http.Handler) http.Handler
- type OIDCAzureSessionStorage
- type PostgresqlOIDCSessionManager
- func (p *PostgresqlOIDCSessionManager) DestroySessionOIDC(ctx context.Context, oidcSID string) error
- func (p *PostgresqlOIDCSessionManager) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)
- func (p *PostgresqlOIDCSessionManager) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
- type PostgresqlSessionManager
- type StorageManager
- type UserManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogHandler ¶
type LogHandler func(handler func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc
type OIDCAzureHandlers ¶
type OIDCAzureHandlers interface {
Authenticated() http.HandlerFunc
CallbackOIDC() http.HandlerFunc
FrontChannelLogout() http.HandlerFunc
Login() http.HandlerFunc
Logout() http.HandlerFunc
}
type OIDCAzureSession ¶
type OIDCAzureSession struct {
// contains filtered or unexported fields
}
func NewOIDCAzure ¶
func NewOIDCAzure( oidcAuthenticator oidc.Authenticator, oidcSession OIDCAzureSessionStorage, userManager UserManager, logHandler LogHandler, secureCookie *securecookie.SecureCookie, sessionTimeout time.Duration, ) *OIDCAzureSession
func (*OIDCAzureSession) Authenticated ¶
func (s *OIDCAzureSession) Authenticated() http.HandlerFunc
Authenticated is the handler reports if the session is authenticated
func (*OIDCAzureSession) CallbackOIDC ¶
func (o *OIDCAzureSession) CallbackOIDC() http.HandlerFunc
CallbackOIDC is the handler for the callback from the OIDC auth provider
func (*OIDCAzureSession) FrontChannelLogout ¶
func (o *OIDCAzureSession) FrontChannelLogout() http.HandlerFunc
FrontChannelLogout is a handler which destroys the current session for a logout request initiated by the OIDC provider
func (*OIDCAzureSession) Login ¶
func (o *OIDCAzureSession) Login() http.HandlerFunc
func (*OIDCAzureSession) Logout ¶
func (s *OIDCAzureSession) Logout() http.HandlerFunc
Logout is a handler which destroys the current session
func (*OIDCAzureSession) SetSessionTimeout ¶
SetSessionTimeout is a Handler to set the session timeout
func (*OIDCAzureSession) SetXSRFToken ¶
SetXSRFToken sets the XSRF Token
func (*OIDCAzureSession) StartSession ¶
func (*OIDCAzureSession) ValidateSession ¶
ValidateSession checks the sessionID in the database to validate that it has not expired and updates the last activity timestamp if it is still valid.
type OIDCAzureSessionStorage ¶
type PostgresqlOIDCSessionManager ¶
type PostgresqlOIDCSessionManager struct {
*PostgresqlSessionManager
}
func NewPostgresqlOIDCSessionManager ¶
func NewPostgresqlOIDCSessionManager(accessor UserManager, db postgresql.Queryer) *PostgresqlOIDCSessionManager
func (*PostgresqlOIDCSessionManager) DestroySessionOIDC ¶
func (p *PostgresqlOIDCSessionManager) DestroySessionOIDC(ctx context.Context, oidcSID string) error
DestroySessionOIDC marks the session as expired
func (*PostgresqlOIDCSessionManager) NewSession ¶
func (p *PostgresqlOIDCSessionManager) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)
NewSession inserts SessionInfo into database
func (*PostgresqlOIDCSessionManager) Session ¶
func (p *PostgresqlOIDCSessionManager) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
Session returns the session information from the database for given sessionID
type PostgresqlSessionManager ¶
type PostgresqlSessionManager struct {
// contains filtered or unexported fields
}
func NewPostgresqlManager ¶
func NewPostgresqlManager(accessor UserManager, dbcon postgresql.Queryer) *PostgresqlSessionManager
func (*PostgresqlSessionManager) DestroySession ¶
DestroySession marks the session as expired
func (*PostgresqlSessionManager) UpdateSessionActivity ¶
func (p *PostgresqlSessionManager) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
UpdateSessionActivity updates the database with the current time for the session activity
type StorageManager ¶
type UserManager ¶
type UserManager interface {
Domains(ctx context.Context) ([]access.Domain, error)
UserRoles(ctx context.Context, username access.User, domain ...access.Domain) (map[access.Domain][]access.Role, error)
RoleExists(ctx context.Context, role access.Role, domain access.Domain) bool
AddUserRoles(ctx context.Context, user access.User, roles []access.Role, domain access.Domain) error
DeleteUserRole(ctx context.Context, user access.User, role access.Role, domain access.Domain) error
UserPermissions(ctx context.Context, username access.User, domain ...access.Domain) (map[access.Domain][]access.Permission, error)
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
mock package is used to generate mock files for testing
|
mock package is used to generate mock files for testing |
|
mock_oidc
Package mock_oidc is a generated GoMock package.
|
Package mock_oidc is a generated GoMock package. |
|
mock_postgres
Package mock_postgresql is a generated GoMock package.
|
Package mock_postgresql is a generated GoMock package. |
|
mock_session
Package mock_session is a generated GoMock package.
|
Package mock_session is a generated GoMock package. |
|
oidc contains the app-specific methods related to auth via Open ID Connect (OIDC)
|
oidc contains the app-specific methods related to auth via Open ID Connect (OIDC) |
|
package postgresql implements the database layer for postgresql
|
package postgresql implements the database layer for postgresql |
|
sessioninfo package handles session information.
|
sessioninfo package handles session information. |
|
util is used for general utility function such as generic sorting/filtering and more
|
util is used for general utility function such as generic sorting/filtering and more |