{"modulePath":"github.com/theopenlane/core","version":"v1.34.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package authmanager\n\nPackage authmanager provides the authentication manager for the server to handle session issuance and validation\n\n## Constants\n\n```go\nconst (\n\tAnonTrustCenterJWTPrefix   = \"anon_trustcenter_\"\n\tAnonQuestionnaireJWTPrefix = \"anon_questionnaire_\"\n)\n```\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient holds the necessary clients and configuration for the auth manager\n\n```go\nfunc New(db *generated.Client) *Client\n```\nNew creates a new auth manager client with the provided database client\n\n```go\nfunc (a *Client) GenerateAnonymousTrustCenterSession(ctx context.Context, w http.ResponseWriter, targetOrgID string, targetTrustCenterID string) (*models.AuthData, error)\n```\nGenerateAnonymousTrustCenterSession creates a new auth session for the anonymous trust center user\n\n```go\nfunc (a *Client) GenerateOauthAuthSession(ctx context.Context, w http.ResponseWriter, user *generated.User, oauthRequest models.OauthTokenRequest) (*models.AuthData, error)\n```\nGenerateOauthAuthSession creates a new auth session for the oauth user and their default organization id\n\n```go\nfunc (a *Client) GenerateUserAuthSession(ctx context.Context, w http.ResponseWriter, user *generated.User) (*models.AuthData, error)\n```\nGenerateUserAuthSession creates a new auth session for the user and their default organization id this is used during the login process\n\n```go\nfunc (a *Client) GenerateUserAuthSessionWithOrg(ctx context.Context, w http.ResponseWriter, user *generated.User, targetOrgID string) (*models.AuthData, error)\n```\nGenerateUserAuthSessionWithOrg 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\n\n```go\nfunc (a *Client) GetDBClient() *generated.Client\n```\nGetDBClient returns the database client\n\n```go\nfunc (a *Client) GetSessionConfig() *sessions.SessionConfig\n```\nGetSessionConfig returns the session config\n\n```go\nfunc (a *Client) SetDBClient(db *generated.Client)\n```\nSetDBClient sets the database client in the config\n\n","path":"github.com/theopenlane/core/internal/httpserve/authmanager","name":"authmanager","synopsis":"Package authmanager provides the authentication manager for the server to handle session issuance and validation","isRedistributable":true}
