api

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: 24 Imported by: 0

Documentation

Overview

Package api IAM API

Simple IAM verification procedure for OAuth2 authentication cycles. Generates a token for a valid user with expiration time, and provides functionality for the validation of tokens.

    Schemes: http, https
	Host: localhost:8080
    BasePath: /iam/v1
	Version: APP_VERSION_AUTOGENERATED

    Produces:
    - application/json

swagger:meta

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client for REST API

func New

func New(cfg Config) (*Client, error)

New creates a new HTTP Server

func (*Client) Health

func (cl *Client) Health(c *gin.Context)

Health swagger:route GET /health health

Responds to health checks.

Produces:
- application/json

Responses:
  200: body:health
  500:
  503:

func (*Client) Identity

func (cl *Client) Identity(c *gin.Context)

swagger:route POST /oauth2/identity identity

Responds with the subject embedded in the token claims, if there is one. If the token is invalid, an error is returned.

	Produces:
	- application/json

	Responses:
	  200: body:tokenIdentity
      400:
      401:

func (*Client) ListenAndServe

func (cl *Client) ListenAndServe() error

ListenAndServe long-running process that listens and accepts incoming requests

func (*Client) Ready

func (cl *Client) Ready(c *gin.Context)

Ready swagger:route GET /ready ready

Responds with 200 when service is ready to accept requests.

Responses:
  200:
  503:

func (*Client) Shutdown

func (cl *Client) Shutdown(ctx context.Context) error

Shutdown stops HTTP Server

func (*Client) Token

func (cl *Client) Token(c *gin.Context)

swagger:route POST /oauth2/token token

Responds with an access token.

	Produces:
	- application/json

	Responses:
	  200: body:token
      400:
      401:

Example: $ curl -d "client_id=<your-client-id>&client_secret=<your-client-secret>&grant_type=client_credentials" https://<domain>/iam/v1/oauth2/token

func (*Client) Validate

func (cl *Client) Validate(c *gin.Context)

swagger:route POST /oauth2/validate validate

Responds with an error if the token is not valid.

	Responses:
	  200:
      400:
      401:

type Config

type Config struct {
	*config.Config
	Service    service.Servicer
	ListenAddr string
}

Config for HTTP Server

type Server

type Server interface {
	ListenAndServe() error
	Shutdown(ctx context.Context) error
}

Server describes the methods needed to interact with this package interface.

func NewWithMetrics

func NewWithMetrics(base Server, instanceName string) Server

NewWithMetrics returns an instance of the Server decorated with metrics

type ServerWithMetrics

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

ServerWithMetrics implements Server interface with all methods wrapped with metrics

func (ServerWithMetrics) ListenAndServe

func (_d ServerWithMetrics) ListenAndServe() (err error)

ListenAndServe implements Server

func (ServerWithMetrics) Shutdown

func (_d ServerWithMetrics) Shutdown(ctx context.Context) (err error)

Shutdown implements Server

Jump to

Keyboard shortcuts

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