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 PostgresOIDCSessionManager
- func (p PostgresOIDCSessionManager) DestroySession(ctx context.Context, sessionID ccc.UUID) error
- func (p *PostgresOIDCSessionManager) DestroySessionOIDC(ctx context.Context, oidcSID string) error
- func (p *PostgresOIDCSessionManager) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)
- func (p PostgresOIDCSessionManager) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
- func (p PostgresOIDCSessionManager) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
- type SpannerOIDCSessionManager
- func (p SpannerOIDCSessionManager) DestroySession(ctx context.Context, sessionID ccc.UUID) error
- func (p *SpannerOIDCSessionManager) DestroySessionOIDC(ctx context.Context, oidcSID string) error
- func (p *SpannerOIDCSessionManager) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)
- func (p SpannerOIDCSessionManager) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
- func (p SpannerOIDCSessionManager) UpdateSessionActivity(ctx context.Context, sessionID ccc.UUID) error
- 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 PostgresOIDCSessionManager ¶ added in v0.1.2
type PostgresOIDCSessionManager struct {
// contains filtered or unexported fields
}
func NewPostgresOIDCSessionManager ¶ added in v0.1.2
func NewPostgresOIDCSessionManager(userManager UserManager, db postgres.Queryer) *PostgresOIDCSessionManager
func (PostgresOIDCSessionManager) DestroySession ¶ added in v0.1.2
DestroySession marks the session as expired
func (*PostgresOIDCSessionManager) DestroySessionOIDC ¶ added in v0.1.2
func (p *PostgresOIDCSessionManager) DestroySessionOIDC(ctx context.Context, oidcSID string) error
DestroySessionOIDC marks the session as expired
func (*PostgresOIDCSessionManager) NewSession ¶ added in v0.1.2
func (p *PostgresOIDCSessionManager) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)
NewSession inserts SessionInfo into database
func (PostgresOIDCSessionManager) Session ¶ added in v0.1.2
func (p PostgresOIDCSessionManager) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
Session returns the session information from the database for given sessionID
type SpannerOIDCSessionManager ¶ added in v0.1.2
type SpannerOIDCSessionManager struct {
// contains filtered or unexported fields
}
func NewSpannerOIDCSessionManager ¶ added in v0.1.2
func NewSpannerOIDCSessionManager(userManager UserManager, db *cloudspanner.Client) *SpannerOIDCSessionManager
func (SpannerOIDCSessionManager) DestroySession ¶ added in v0.1.2
DestroySession marks the session as expired
func (*SpannerOIDCSessionManager) DestroySessionOIDC ¶ added in v0.1.2
func (p *SpannerOIDCSessionManager) DestroySessionOIDC(ctx context.Context, oidcSID string) error
DestroySessionOIDC marks the session as expired
func (*SpannerOIDCSessionManager) NewSession ¶ added in v0.1.2
func (p *SpannerOIDCSessionManager) NewSession(ctx context.Context, username, oidcSID string) (ccc.UUID, error)
NewSession inserts SessionInfo into database
func (SpannerOIDCSessionManager) Session ¶ added in v0.1.2
func (p SpannerOIDCSessionManager) Session(ctx context.Context, sessionID ccc.UUID) (*sessioninfo.SessionInfo, error)
Session returns the session information from the database for given sessionID
type UserManager ¶
type UserManager interface {
Domains(ctx context.Context) ([]accesstypes.Domain, error)
UserRoles(ctx context.Context, username accesstypes.User, domain ...accesstypes.Domain) (map[accesstypes.Domain][]accesstypes.Role, error)
RoleExists(ctx context.Context, role accesstypes.Role, domain accesstypes.Domain) bool
AddUserRoles(ctx context.Context, user accesstypes.User, roles []accesstypes.Role, domain accesstypes.Domain) error
DeleteUserRole(ctx context.Context, user accesstypes.User, role accesstypes.Role, domain accesstypes.Domain) error
UserPermissions(ctx context.Context, username accesstypes.User, domain ...accesstypes.Domain) (map[accesstypes.Domain][]accesstypes.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_postgres is a generated GoMock package.
|
Package mock_postgres 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. |
|
spanner provides our data storage API backed by Google Cloud Spanner
|
spanner provides our data storage API backed by Google Cloud Spanner |
|
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 |