mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AzureMonitor: token provider into aztokenprovider and cleanup (#36102)
This commit is contained in:
25
pkg/api/pluginproxy/token_provider_azure.go
Normal file
25
pkg/api/pluginproxy/token_provider_azure.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package pluginproxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/aztokenprovider"
|
||||
)
|
||||
|
||||
type azureAccessTokenProvider struct {
|
||||
ctx context.Context
|
||||
tokenProvider aztokenprovider.AzureTokenProvider
|
||||
}
|
||||
|
||||
func newAzureAccessTokenProvider(ctx context.Context, cfg *setting.Cfg, authParams *plugins.JwtTokenAuth) *azureAccessTokenProvider {
|
||||
return &azureAccessTokenProvider{
|
||||
ctx: ctx,
|
||||
tokenProvider: aztokenprovider.NewAzureAccessTokenProvider(cfg, authParams),
|
||||
}
|
||||
}
|
||||
|
||||
func (provider *azureAccessTokenProvider) GetAccessToken() (string, error) {
|
||||
return provider.tokenProvider.GetAccessToken(provider.ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user