Documentation ¶
Index ¶
- type AuthManager
- func (am *AuthManager) AccessToken(ctx context.Context, session *web.Session) (string, error)
- 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, config ...)
- func (am *AuthManager) LoadAuthState(session *web.Session) (string, bool)
- func (am *AuthManager) OAuth2Config(_ context.Context, req *web.Request) *oauth2.Config
- func (am *AuthManager) OAuth2Token(session *web.Session) (*oauth2.Token, error)
- func (am *AuthManager) OAuthCtx(ctx context.Context) context.Context
- func (am *AuthManager) OpenIDProvider() *oidc.Provider
- func (am *AuthManager) StoreAuthState(session *web.Session, state string)
- func (am *AuthManager) StoreTokenDetails(ctx context.Context, session *web.Session, oauth2Token *oauth2.Token) error
- 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) AccessToken ¶
AccessToken - used to get access token
func (*AuthManager) Auth ¶
Auth tries to retrieve the authentication context for a active session - this is used to pass Authentication to services
- if the stored token for the Auth is not valid anymore it will refresh the token before
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, config *struct { Server string `inject:"config:core.oauth.server"` Secret string `inject:"config:core.oauth.secret"` ClientID string `inject:"config:core.oauth.clientid"` DisableOfflineToken bool `inject:"config:core.oauth.disableOfflineToken"` Scopes config.Slice `inject:"config:core.oauth.scopes"` IDTokenMapping config.Slice `inject:"config:core.oauth.claims.idToken"` UserInfoMapping config.Slice `inject:"config:core.oauth.claims.userInfo"` TokenExtras config.Slice `inject:"config:core.oauth.tokenExtras"` DebugMode bool `inject:"config:flamingo.debug.mode"` Enabled bool `inject:"config:core.oauth.enabled"` })
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) OAuthCtx ¶
func (am *AuthManager) OAuthCtx(ctx context.Context) context.Context
OAuthCtx - returns ctx that should be used to pass to oauth2 lib - it enables logging for Debug reasons
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(ctx context.Context, session *web.Session, oauth2Token *oauth2.Token) error
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 - return oauth2.TokenSource initialized with the Refreshtoken stored in the 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