Skip to content

Add support for strapi local authentication method to the KrakenD framework

License

Notifications You must be signed in to change notification settings

pushrbx/krakend-strapi-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KrakenD strapi authentication

A http client for the KrakenD framework supporting the strapi "local" authentication method.

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/devopsfaith/krakend/config"
	"github.com/devopsfaith/krakend/proxy"
	"github.com/pushrbx/krakend-strapi-auth"
)

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

Disclaimer

Big chunk of the code is a copy/paste from golang/oauth2 and devopsfaith/krakend-oauth2-clientcredentials.

About

Add support for strapi local authentication method to the KrakenD framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages