Documentation ¶
Index ¶
- type AuthManager
- func (am *AuthManager) Auth(c context.Context, session *web.Session) (domain.Auth, error)
- func (am *AuthManager) DeleteAuthState(session *web.Session)
- func (am *AuthManager) DeleteTokenDetails(session *web.Session)
- func (am *AuthManager) ExtractRawIDToken(oauth2Token *oauth2.Token) (string, error)
- func (am *AuthManager) GetRawIDToken(c context.Context, session *web.Session) (string, error)
- func (am *AuthManager) HTTPClient(c context.Context, session *web.Session) (*http.Client, error)
- func (am *AuthManager) IDToken(c context.Context, session *web.Session) (*oidc.IDToken, error)
- func (am *AuthManager) Inject(logger flamingo.Logger, router *web.Router, openIDProvider *oidc.Provider, ...)
- func (am *AuthManager) LoadAuthState(session *web.Session) (string, bool)
- func (am *AuthManager) OAuth2Config(ctx context.Context, req *web.Request) *oauth2.Config
- func (am *AuthManager) OAuth2Token(session *web.Session) (*oauth2.Token, error)
- func (am *AuthManager) OpenIDProvider() *oidc.Provider
- func (am *AuthManager) StoreAuthState(session *web.Session, state string)
- func (am *AuthManager) StoreTokenDetails(session *web.Session, oauth2Token *oauth2.Token, rawToken string, ...)
- func (am *AuthManager) TokenSource(c context.Context, session *web.Session) (oauth2.TokenSource, error)
- func (am *AuthManager) Verifier() *oidc.IDTokenVerifier
- type AuthRoleProvider
- type EventHandler
- type EventPublisher
- type UserService
- type UserServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthManager ¶
type AuthManager struct {
// contains filtered or unexported fields
}
AuthManager handles authentication related operations
func (*AuthManager) DeleteAuthState ¶
func (am *AuthManager) DeleteAuthState(session *web.Session)
DeleteAuthState deletes auth state from session
func (*AuthManager) DeleteTokenDetails ¶
func (am *AuthManager) DeleteTokenDetails(session *web.Session)
DeleteTokenDetails deletes all token related data from session
func (*AuthManager) ExtractRawIDToken ¶
func (am *AuthManager) ExtractRawIDToken(oauth2Token *oauth2.Token) (string, error)
ExtractRawIDToken from the provided (fresh) oatuh2token
func (*AuthManager) GetRawIDToken ¶
GetRawIDToken gets the raw IDToken from session
func (*AuthManager) HTTPClient ¶
HTTPClient to retrieve a client with automatic tokensource
func (*AuthManager) Inject ¶
func (am *AuthManager) Inject(logger flamingo.Logger, router *web.Router, openIDProvider *oidc.Provider, config *struct { Server string `inject:"config:oauth.server"` Secret string `inject:"config:oauth.secret"` ClientID string `inject:"config:oauth.clientid"` DisableOfflineToken bool `inject:"config:oauth.disableOfflineToken"` Scopes config.Slice `inject:"config:oauth.scopes"` IDTokenMapping config.Slice `inject:"config:oauth.claims.idToken"` UserInfoMapping config.Slice `inject:"config:oauth.claims.userInfo"` })
Inject authManager dependencies
func (*AuthManager) LoadAuthState ¶
func (am *AuthManager) LoadAuthState(session *web.Session) (string, bool)
LoadAuthState loads auth state from session
func (*AuthManager) OAuth2Config ¶
OAuth2Config is lazy setup oauth2config
func (*AuthManager) OAuth2Token ¶
OAuth2Token retrieves the oauth2 token from the session
func (*AuthManager) OpenIDProvider ¶
func (am *AuthManager) OpenIDProvider() *oidc.Provider
OpenIDProvider is a lazy initialized OID provider
func (*AuthManager) StoreAuthState ¶
func (am *AuthManager) StoreAuthState(session *web.Session, state string)
StoreAuthState stores auth state into session, used to connect passed state id in auth callback with the one stored in session
func (*AuthManager) StoreTokenDetails ¶
func (am *AuthManager) StoreTokenDetails(session *web.Session, oauth2Token *oauth2.Token, rawToken string, tokenExtras *domain.TokenExtras)
StoreTokenDetails stores all token related data into session
func (*AuthManager) TokenSource ¶
func (am *AuthManager) TokenSource(c context.Context, session *web.Session) (oauth2.TokenSource, error)
TokenSource to be used in situations where you need it
func (*AuthManager) Verifier ¶
func (am *AuthManager) Verifier() *oidc.IDTokenVerifier
Verifier creates an OID verifier
type AuthRoleProvider ¶
type AuthRoleProvider struct {
// contains filtered or unexported fields
}
AuthRoleProvider implements the RoleProvider interface for authenticated users
func (*AuthRoleProvider) All ¶
func (p *AuthRoleProvider) All(ctx context.Context, session *web.Session) []securityDomain.Role
All return all associated roles
func (*AuthRoleProvider) Inject ¶
func (p *AuthRoleProvider) Inject(us UserServiceInterface)
Inject userService dependency
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
EventHandler for logout events
func (*EventHandler) Inject ¶
func (e *EventHandler) Inject(authManager *AuthManager)
Inject dependencies
type EventPublisher ¶
type EventPublisher struct {
// contains filtered or unexported fields
}
EventPublisher struct
func (*EventPublisher) Inject ¶
func (e *EventPublisher) Inject(router flamingo.EventRouter)
Inject dependencies
func (*EventPublisher) PublishLoginEvent ¶
func (e *EventPublisher) PublishLoginEvent(ctx context.Context, event *domain.LoginEvent)
PublishLoginEvent dispatches the login event on the contexts event router
func (*EventPublisher) PublishLogoutEvent ¶
func (e *EventPublisher) PublishLogoutEvent(ctx context.Context, event *domain.LogoutEvent)
PublishLogoutEvent dispatches the logout event on the contexts event router
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService helps to use the authenticated user information
func (*UserService) Inject ¶
func (us *UserService) Inject(manager *AuthManager, ums *domain.UserMappingService)
Inject dependencies
func (*UserService) IsLoggedIn ¶
IsLoggedIn determines the user's login status