oauth2support

package
v0.6.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EnvOAuthJwksUrl string = "HEXA_TOKEN_JWKSURL"
	EnvJwtAuth      string = "HEXA_JWT_AUTH_ENABLE"
	EnvJwtRealm     string = "HEXA_JWT_REALM"
	EnvJwtAudience  string = "HEXA_JWT_AUDIENCE"
	EnvJwtScope     string = "HEXA_JWT_SCOPE"

	EnvOAuthClientId      string = "HEXA_OAUTH_CLIENT_ID"
	EnvOAuthClientSecret  string = "HEXA_OAUTH_CLIENT_SECRET"
	EnvOAuthClientScope   string = "HEXA_OAUTH_CLIENT_SCOPE"
	EnvOAuthTokenEndpoint string = "HEXA_OAUTH_TOKEN_ENDPOINT"
)

Variables

This section is empty.

Functions

func JwtAuthenticationHandler

func JwtAuthenticationHandler(next http.HandlerFunc, s *ResourceJwtAuthorizer) http.HandlerFunc

Types

type AccessTokenInfo

type AccessTokenInfo struct {
	*jwt.RegisteredClaims
	Scope string `json:"scope"`
}

type HTTPClient

type HTTPClient interface {
	Get(url string) (resp *http.Response, err error)
	Do(req *http.Request) (*http.Response, error)
}

type JwtClientHandler

type JwtClientHandler interface {
	GetHttpClient() *http.Client
	GetToken() (*oauth2.Token, error)
}

func NewJwtClientHandler

func NewJwtClientHandler() JwtClientHandler

NewJwtClientHandler opens a new JwtClientHandler which allows an OAuth Client to make calls to a JWT protected endpoint. Configuration parameters are pulled from environment variables.

func NewJwtClientHandlerWithConfig

func NewJwtClientHandlerWithConfig(config *clientcredentials.Config) JwtClientHandler

NewJwtClientHandlerWithConfig opens a new JwtClientHandler which allows an OAuth Client to make calls to a JWT protected endpoint. The `config` parameter specifies a client credential for the OAuth2 Client Credential Flow

type ResourceJwtAuthorizer

type ResourceJwtAuthorizer struct {
	Key   keyfunc.Keyfunc
	Aud   string
	Scope string
	// contains filtered or unexported fields
}

func NewResourceJwtAuthorizer

func NewResourceJwtAuthorizer() *ResourceJwtAuthorizer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL