Documentation ¶
Index ¶
- Variables
- func IsOAuthPassThruEnabled(ds *datasources.DataSource) bool
- type OAuthTokenService
- type Service
- func (o *Service) GetCurrentOAuthToken(ctx context.Context, usr identity.Requester) *oauth2.Token
- func (o *Service) HasOAuthEntry(ctx context.Context, usr identity.Requester) (*login.UserAuth, bool, error)
- func (o *Service) InvalidateOAuthTokens(ctx context.Context, usr *login.UserAuth) error
- func (o *Service) IsOAuthPassThruEnabled(ds *datasources.DataSource) bool
- func (o *Service) TryTokenRefresh(ctx context.Context, usr identity.Requester) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ExpiryDelta is used to prevent any issue that is caused by the clock skew (server times can differ slightly between different machines). // Shouldn't be more than 30s ExpiryDelta = 10 * time.Second ErrNoRefreshTokenFound = errors.New("no refresh token found") ErrNotAnOAuthProvider = errors.New("not an oauth provider") )
Functions ¶
func IsOAuthPassThruEnabled ¶
func IsOAuthPassThruEnabled(ds *datasources.DataSource) bool
IsOAuthPassThruEnabled returns true if Forward OAuth Identity (oauthPassThru) is enabled for the provided data source.
Types ¶
type OAuthTokenService ¶
type OAuthTokenService interface { GetCurrentOAuthToken(context.Context, identity.Requester) *oauth2.Token IsOAuthPassThruEnabled(*datasources.DataSource) bool HasOAuthEntry(context.Context, identity.Requester) (*login.UserAuth, bool, error) TryTokenRefresh(context.Context, identity.Requester) error InvalidateOAuthTokens(context.Context, *login.UserAuth) error }
type Service ¶
type Service struct { Cfg *setting.Cfg SocialService social.Service AuthInfoService login.AuthInfoService // contains filtered or unexported fields }
func ProvideService ¶
func ProvideService(socialService social.Service, authInfoService login.AuthInfoService, cfg *setting.Cfg, registerer prometheus.Registerer) *Service
func (*Service) GetCurrentOAuthToken ¶
GetCurrentOAuthToken returns the OAuth token, if any, for the authenticated user. Will try to refresh the token if it has expired.
func (*Service) HasOAuthEntry ¶
func (o *Service) HasOAuthEntry(ctx context.Context, usr identity.Requester) (*login.UserAuth, bool, error)
HasOAuthEntry returns true and the UserAuth object when OAuth info exists for the specified User
func (*Service) InvalidateOAuthTokens ¶
InvalidateOAuthTokens invalidates the OAuth tokens (access_token, refresh_token) and sets the Expiry to default/zero
func (*Service) IsOAuthPassThruEnabled ¶
func (o *Service) IsOAuthPassThruEnabled(ds *datasources.DataSource) bool
IsOAuthPassThruEnabled returns true if Forward OAuth Identity (oauthPassThru) is enabled for the provided data source.
Click to show internal directories.
Click to hide internal directories.