Skip to content

krakend/krakend-oauth2-clientcredentials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

KrakenD oauth2 client credentials

A http client for the KrakenD framework supporting the oauth2 client credentials workflow.

How to use it?

This package exposes single factory capable to create a instances of the proxy.HTTPClientFactory interface embedding a http client supporting the oauth2 client credentials workflow

import 	(
	"context"
	"net/http"
	"github.com/luraproject/lura/v2/config"
	"github.com/luraproject/lura/v2/proxy"
	"github.com/krakendio/krakend-oauth2-clientcredentials/v2"
)

requestExecutorFactory := func(cfg *config.Backend) proxy.HTTPRequestExecutor {
	clientFactory := oauth2client.NewHTTPClient(cfg)
	return func(ctx context.Context, req *http.Request) (*http.Response, error) {
		return clientFactory(ctx).Do(req.WithContext(ctx))
	}
}

You can create your own proxy.HTTPRequestExecutor and inject it into your BackendFactory

About

Add support for auth2 client credentials grant to the KrakenD framework

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages