iam

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClientIDKey is the key for the property client id.
	ClientIDKey = "client_id"
	// ClientSecretKey is the key for the property client secret.
	ClientSecretKey = "client_secret"
)
View Source
const (
	// ServiceName is the name of the service
	ServiceName = "iam-proxy"
)

Variables

View Source
var (
	// ErrInvalidDomain is the error when the domain provided is invalid.
	ErrInvalidDomain = errors.New("invalid domain")
	// ErrInvalidPort is the error when the port provided is invalid.
	ErrInvalidPort = errors.New("invalid port")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	URL        string
	HTTPClient *http.Client
}

Client implements the service logic by making http requests to the server.

func New

func New(url string, client *http.Client) *Client

New returns a client

func NewDefault

func NewDefault() *Client

NewDefault returns a client with default configuration

func (*Client) Health

func (c *Client) Health() (*health.Health, error)

Health calls the health endpoint.

func (*Client) Identity

func (c *Client) Identity(token string) (string, error)

Identity calls the iam service and validates the given token while returning the identity information e.g. claims subject.

func (*Client) Ready

func (c *Client) Ready() error

Ready calls the ready endpoint.

func (*Client) Token

func (c *Client) Token(clientID, clientSecret string) (string, error)

Token calls the iam service and returns the access token based on the provided clientID and clientSecret.

func (*Client) Validate

func (c *Client) Validate(token string) error

Validate calls the iam service and validates the given token.

type Servicer

type Servicer interface {
	Health() (*health.Health, error)
	Ready() error
	Token() (string, error)
	Validate(token string) error
	Identity(token string) (string, error)
}

Servicer defines the interface for interacting with the server.

func NewWithMetrics

func NewWithMetrics(base Servicer, instanceName string) Servicer

NewWithMetrics returns an instance of the Servicer decorated with metrics

type ServicerWithMetrics

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

ServicerWithMetrics implements Servicer interface with all methods wrapped with metrics

func (ServicerWithMetrics) Health

func (_d ServicerWithMetrics) Health() (hp1 *health.Health, err error)

Health implements Servicer

func (ServicerWithMetrics) Identity

func (_d ServicerWithMetrics) Identity(token string) (s1 string, err error)

Identity implements Servicer

func (ServicerWithMetrics) Ready

func (_d ServicerWithMetrics) Ready() (err error)

Ready implements Servicer

func (ServicerWithMetrics) Token

func (_d ServicerWithMetrics) Token() (s1 string, err error)

Token implements Servicer

func (ServicerWithMetrics) Validate

func (_d ServicerWithMetrics) Validate(token string) (err error)

Validate implements Servicer

type Token

type Token struct {
	TokenType     string `json:"tokenType"`
	AccessToken   string `json:"accessToken"`
	IdentityToken string `json:"identityToken"`
	ExpiresIn     int64  `json:"expiresIn"`
	ExtExpiresIn  int64  `json:"extExpiresIn"`
}

Token for IAM verification swagger:model token

type TokenIdentity

type TokenIdentity struct {
	Identity string `json:"identity"`
}

TokenIdentity for getting the IAM token identity swagger:model tokenIdentity

Jump to

Keyboard shortcuts

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