Giter Site home page Giter Site logo

grafana-azure-sdk-go's Introduction

github.com/grafana/grafana-azure-sdk-go

SDK for integration of Grafana datasources with Azure services.

Packages

azsettings

Common Azure configuration. Can be read from either the environment variables of the Grafana instance (if supplied to the plugin) or from the context supplied to the plugin (if available).

This can be achieved by making use of ReadSettings which will determine the settings based on the available context.

Note: If the plugin context contains any Azure related variable then it will be used in place of any environment variables present.

azcredentials

The built-in AzureCredentials:

  • AadCurrentUserCredentials
  • AzureManagedIdentityCredentials
  • AzureClientSecretCredentials
  • AzureClientSecretOboCredentials

azhttpclient

Azure authentication middleware for Grafana Plugin SDK httpclient.

Usage

// Initialize the authentication options
authOpts := azhttpclient.NewAuthOptions(azureSettings)

// Configure instance-level scopes
authOpts.Scopes([]string{"https://datasource.example.org/.default"})

// Optionally, register custom token providers
authOpts.AddTokenProvider("custom-auth-type", func (...) (aztokenprovider.AzureTokenProvider, error) {
	return NewCustomTokenProvider(...), nil
})

// Configure the client
clientOpts := httpclient.Options{}
azhttpclient.AddAzureAuthentication(&clientOpts, authOpts, credentials)

httpClient, err := httpclient.NewProvider().New(clientOpts)

azusercontext

Context object CurrentUserContext of the currently signed-in Grafana user which can be passed via context between business layers.

Used by token provider to get information about the current user for user identity authentication.

Read/write functions:

  • context = azusercontext.WithCurrentUser(context, currentUser) extends given context with information about the current user.
  • currentUser = azusercontext.GetCurrentUser(context) extracts current user from the given context

Helper functions for datasource requests:

  • WithUserFromQueryReq extracts current user from query request and adds to context.
  • WithUserFromResourceReq extracts current user from resource call and adds to context.
  • WithUserFromHealthCheckReq extracts current from health check request and adds to context.

aztokenprovider

util

  • maputil

License

Apache 2.0 License

grafana-azure-sdk-go's People

Contributors

aangelisc avatar andresmgot avatar asimpson avatar bossinc avatar dependabot[bot] avatar itsmylife avatar joncole avatar kostrse avatar ms-hujia avatar nilfr avatar oscarkilhed avatar patst avatar sunker avatar vickyyyyyyy avatar wbrowne avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grafana-azure-sdk-go's Issues

Discard access token if resource returned 401

AzureMiddleware and AzureTokenProvider are implemented in a way that tokens being kept in cache until their expiration time regardless whether the token is still accepted or not.

In cases when resource endpoint starts rejecting a token and returns 401, the middleware should invalidate the token and subsequent request should trigger token refresh.

Could be implemented here.

Add a parser of custom Azure cloud configuration

Currently we support only three known clouds: Public, China and US Gov.
To support custom cloud configurations (e.g. Azure Stack), we need a way to pass cloud metadata parse it into collection of available clouds.

az cloud list

Add support for user identity authentication via custom token endpoint

Similar to how Managed Identity (MSI) authentication uses a token endpoint to request access tokens in the scope of the Grafana instance, a custom configurable token endpoint can be used to request access tokens in the scope of the currently signed in user.

This would allow user identity authentication scenarios where Grafana envrironment configured accordingly.

Support Client Secret OBO in the SDK

ADX currently implements this authentication method outside of the SDK (see here and here).

This feature has been experimental for some time but there's no reason for this anymore. Additionally, it may be the case that other data sources need to support it in the future so standardising the implementation would be useful.

Add a reader of AzureSettings from plugin environment

azsettings.AzureSettings is a struct which keeps the Azure environment configuration.
Currently it's responsibility of a plugin to fill up and supply this struct.

We need to implement a shared reusable reader of azsettings.AzureSettings which could be used by all Azure plugins.

Support Define Tenant ID and Client ID for Workload Identity

What happened:

At the moment, Grafana fully rely on Environment Variables or grafana.ini for Workload Identity.

What you expected to happen:

I would like to use the same Workload Identity source (token file) in multiple datasource against different Tenant ID. I have multiple Tenants which different Client that trust the OIDC issuer for my AKS cluster. But this requires different Client ID and Tenant ID per datasource settings.

Like the Client ID for Managed Identity, which is also configurable per datasource.

Support service principal for user-auth

Update the SDK to support a service principal credential when using user-authentication methods. This will allow us to support backend functionality via the service principal credentials which will always be present.

Azure region in AzureSettings

azsettings.AzureSettings already contain information about the current Azure cloud, adding Azure region would be also definitional for authorization and datasources.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.