auth

package
v1.1.61 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Package auth implements the apic service account token management. Contributed by Xenon team

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApicAuth

type ApicAuth struct {
	// contains filtered or unexported fields
}

ApicAuth provides authentication methods for calls against APIC Cloud services.

func NewWithFlow

func NewWithFlow(tenantID, privKey, publicKey, password, url, aud, clientID string, singleURL string, timeout time.Duration) *ApicAuth

NewWithFlow returns an ApicAuth that uses the axway authentication flow

func NewWithStatic

func NewWithStatic(tenantID, token string) *ApicAuth

NewWithStatic returns an ApicAuth that uses a fixed token

func (*ApicAuth) Authenticate

func (aa *ApicAuth) Authenticate(hs HeaderSetter) error

Authenticate applies the authentication headers

func (*ApicAuth) AuthenticateNet

func (aa *ApicAuth) AuthenticateNet(req *http.Request) error

AuthenticateNet applies the authentication headers

type Config

type Config struct {
	PrivateKey  string        `mapstructure:"private_key"`
	PublicKey   string        `mapstructure:"public_key"`
	KeyPassword string        `mapstructure:"key_password"`
	URL         string        `mapstructure:"url"`
	Audience    string        `mapstructure:"audience"`
	ClientID    string        `mapstructure:"client_id"`
	Timeout     time.Duration `mapstructure:"timeout"`
}

Config the auth config

type HeaderSetter

type HeaderSetter interface {
	// SetHeader sets a header on a http request
	SetHeader(key, value string)
}

HeaderSetter sets a header for a request

type NetHeaderSetter

type NetHeaderSetter struct {
	*http.Request
}

NetHeaderSetter sets headers an a net/http request

func (NetHeaderSetter) SetHeader

func (nhs NetHeaderSetter) SetHeader(key, value string)

SetHeader sets a header on a net/http request

type PlatformTokenGetter

type PlatformTokenGetter interface {
	// contains filtered or unexported methods
}

PlatformTokenGetter - Interface for token getter

func NewPlatformTokenGetter

func NewPlatformTokenGetter(privKey, publicKey, password, url, aud, clientID string, singleURL string, timeout time.Duration) PlatformTokenGetter

NewPlatformTokenGetter returns a token getter for axway ID

func NewPlatformTokenGetterWithCentralConfig

func NewPlatformTokenGetterWithCentralConfig(centralCfg config.CentralConfig) PlatformTokenGetter

NewPlatformTokenGetterWithCentralConfig returns a token getter for axway ID

type TokenGetter

type TokenGetter interface {
	GetToken() (string, error)
}

TokenGetter provides a bearer token to be used in api calls. Might block

func NewTokenAuth

func NewTokenAuth(ac Config, tenantID string) TokenGetter

NewTokenAuth Create a new auth token requester

Jump to

Keyboard shortcuts

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