mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 10:50:37 -06:00
fe1563882a
* port oauth token service to identity requester * fix broken test * no need to check for render
43 lines
1.0 KiB
Go
43 lines
1.0 KiB
Go
package oauthtokentest
|
|
|
|
import (
|
|
"context"
|
|
|
|
"golang.org/x/oauth2"
|
|
|
|
"github.com/grafana/grafana/pkg/services/auth/identity"
|
|
"github.com/grafana/grafana/pkg/services/datasources"
|
|
"github.com/grafana/grafana/pkg/services/login"
|
|
"github.com/grafana/grafana/pkg/services/oauthtoken"
|
|
)
|
|
|
|
// Service an OAuth token service suitable for tests.
|
|
type Service struct {
|
|
Token *oauth2.Token
|
|
}
|
|
|
|
// ProvideService provides an OAuth token service suitable for tests.
|
|
func ProvideService() *Service {
|
|
return &Service{}
|
|
}
|
|
|
|
func (s *Service) GetCurrentOAuthToken(context.Context, identity.Requester) *oauth2.Token {
|
|
return s.Token
|
|
}
|
|
|
|
func (s *Service) IsOAuthPassThruEnabled(ds *datasources.DataSource) bool {
|
|
return oauthtoken.IsOAuthPassThruEnabled(ds)
|
|
}
|
|
|
|
func (s *Service) HasOAuthEntry(context.Context, identity.Requester) (*login.UserAuth, bool, error) {
|
|
return nil, false, nil
|
|
}
|
|
|
|
func (s *Service) TryTokenRefresh(context.Context, *login.UserAuth) error {
|
|
return nil
|
|
}
|
|
|
|
func (s *Service) InvalidateOAuthTokens(context.Context, *login.UserAuth) error {
|
|
return nil
|
|
}
|