Documentation
¶
Overview ¶
Package authmanager provides the authentication manager for the server to handle session issuance and validation
Index ¶
- Variables
- type Client
- func (a *Client) GenerateOauthAuthSession(ctx context.Context, w http.ResponseWriter, user *generated.User, ...) (*models.AuthData, error)
- func (a *Client) GenerateUserAuthSession(ctx context.Context, w http.ResponseWriter, user *generated.User) (*models.AuthData, error)
- func (a *Client) GenerateUserAuthSessionWithOrg(ctx context.Context, w http.ResponseWriter, user *generated.User, ...) (*models.AuthData, error)
- func (a *Client) GetDBClient() *generated.Client
- func (a *Client) GetSessionConfig() *sessions.SessionConfig
- func (a *Client) SetDBClient(db *generated.Client)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSubscriptionNotFound is the error message when the subscription is not found ErrSubscriptionNotFound = errors.New("subscription not found") // ErrSubscriptionNotActive is the error message when the subscription is not active ErrSubscriptionNotActive = errors.New("subscription not active") )
var ( // ErrOrgSubscriptionNotActive is the error message when the organization subscription is not active ErrOrgSubscriptionNotActive = errors.New("organization subscription is not active") )
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.7.0
type Client struct {
// contains filtered or unexported fields
}
Client holds the necessary clients and configuration for the auth manager
func (*Client) GenerateOauthAuthSession ¶ added in v0.7.0
func (a *Client) GenerateOauthAuthSession(ctx context.Context, w http.ResponseWriter, user *generated.User, oauthRequest models.OauthTokenRequest) (*models.AuthData, error)
GenerateOauthAuthSession creates a new auth session for the oauth user and their default organization id
func (*Client) GenerateUserAuthSession ¶ added in v0.7.0
func (a *Client) GenerateUserAuthSession(ctx context.Context, w http.ResponseWriter, user *generated.User) (*models.AuthData, error)
GenerateUserAuthSession creates a new auth session for the user and their default organization id this is used during the login process
func (*Client) GenerateUserAuthSessionWithOrg ¶ added in v0.7.0
func (a *Client) GenerateUserAuthSessionWithOrg(ctx context.Context, w http.ResponseWriter, user *generated.User, targetOrgID string) (*models.AuthData, error)
GenerateUserAuthSessionWithOrg creates a new auth session for the user and the new target organization id this is used when the user is switching organizations, or when the user deletes their authorized organization and is automatically switched into another organization Before the sessions is issues, we check that the user still has access to the target organization if not, the user's default org (or personal org) is used
func (*Client) GetDBClient ¶ added in v0.7.0
GetDBClient returns the database client
func (*Client) GetSessionConfig ¶ added in v0.7.0
func (a *Client) GetSessionConfig() *sessions.SessionConfig
GetSessionConfig returns the session config
func (*Client) SetDBClient ¶ added in v0.7.0
SetDBClient sets the database client in the config