Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandlers ¶
func RegisterHandlers(r *routing.RouteGroup, service Service, authHandler routing.Handler, logger log.Logger, store *sessions.CookieStore)
RegisterHandlers sets up the routing of the HTTP handlers.
Types ¶
type ProviderConfigs ¶
type ProviderConfigs struct { Google *config.OAuthConfig Outlook *config.OAuthConfig }
ProviderConfigs represents the OAuth configurations for different providers.
type Repository ¶
type Repository interface { // GetProviderByName returns the oauth provider by name GetProviderByName(ctx context.Context, name string) (entity.Provider, error) // StoreUserProviderAccount stores the user provider account StoreUserProviderAccount(ctx context.Context, userProviderAccount entity.UserProviderAccount) error }
Repository encapsulates the logic to access the data source.
func NewRepository ¶
func NewRepository(db *dbcontext.DB, logger log.Logger) Repository
NewRepository creates a new oauth repository
type Service ¶
type Service interface { // GetAuthURL Generates the URL for the OAuth provider's consent page. GetAuthURL(provider string, state string) string // HandleCallback Exchanges the OAuth code for a token. HandleCallback(provider string, code string) (*oauth2.Token, error) // StoreAccount stores the user provider account StoreAccount(ctx context.Context, account entity.UserProviderAccount, provider string) error }
Service encapsulates usecase logic for oauth.
func NewService ¶
func NewService(repo Repository, logger log.Logger, configs *ProviderConfigs, signingKey string) Service
NewService creates a new oauth service.
Click to show internal directories.
Click to hide internal directories.