clients

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientNotFound = errors.New("client not found")
	ErrClientExists   = errors.New("client already exists")
)
View Source
var ErrInvalidClient = errors.New("invalid client")

Functions

This section is empty.

Types

type Client

type Client struct {
	fosite.DefaultClient
	Name      string    `json:"client_name"`
	Owner     string    `json:"owner"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Trusted   bool      `json:"trusted"`
}

Client extends fosite.DefaultClient with IAM-specific fields.

func (*Client) GetCreatedAt

func (c *Client) GetCreatedAt() time.Time

func (*Client) GetName

func (c *Client) GetName() string

func (*Client) GetOwner

func (c *Client) GetOwner() string

func (*Client) GetUpdatedAt

func (c *Client) GetUpdatedAt() time.Time

func (*Client) IsTrusted

func (c *Client) IsTrusted() bool

type ClientRepository

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

func NewClientRepository

func NewClientRepository(db querier) *ClientRepository

func (*ClientRepository) CreateClient

func (r *ClientRepository) CreateClient(ctx context.Context, client *Client) (*Client, error)

func (*ClientRepository) DeleteClient

func (r *ClientRepository) DeleteClient(ctx context.Context, id string) error

func (*ClientRepository) GetClient

func (r *ClientRepository) GetClient(ctx context.Context, id string) (*Client, error)

type ClientResponse

type ClientResponse struct {
	ID            string    `json:"client_id"`
	RedirectURIs  []string  `json:"redirect_uris"`
	GrantTypes    []string  `json:"grant_types"`
	ResponseTypes []string  `json:"response_types"`
	Scopes        []string  `json:"scopes"`
	Public        bool      `json:"public"`
	Name          string    `json:"client_name"`
	Owner         string    `json:"owner"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	Trusted       bool      `json:"trusted"`
}

ClientResponse is used for API responses to ensure the secret is never exposed.

func ToResponse

func ToResponse(c *Client) *ClientResponse

type CreateClientInput

type CreateClientInput struct {
	ID            string    `json:"client_id"`
	Secret        string    `json:"client_secret"`
	RedirectURIs  []string  `json:"redirect_uris"`
	GrantTypes    []string  `json:"grant_types"`
	ResponseTypes []string  `json:"response_types"`
	Scopes        []string  `json:"scopes"`
	Public        bool      `json:"public"`
	Name          string    `json:"client_name"`
	Owner         string    `json:"owner"`
	Trusted       bool      `json:"trusted"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

CreateClientInput is used for API requests to create a client. It uses string for Secret to allow plain text secrets in JSON payloads.

func (*CreateClientInput) ToClient

func (i *CreateClientInput) ToClient() *Client

ToClient converts a CreateClientInput to a Client.

type GrpcHandler added in v1.31.1

type GrpcHandler struct {
	proto.UnimplementedInternalOAuthClientsServiceServer
	// contains filtered or unexported fields
}

GrpcHandler serves the InternalOAuthClientsService gRPC API. It mirrors the internal HTTP client-management endpoints, delegating to the same registry so both transports share identical create/get/delete behaviour.

func NewGrpcHandler added in v1.31.1

func NewGrpcHandler(registry clientRegistry) *GrpcHandler

type Registry

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

func NewRegistry

func NewRegistry(r *ClientRepository, hasher fosite.Hasher) *Registry

func (*Registry) CreateClient

func (cm *Registry) CreateClient(ctx context.Context, client *Client) (*Client, error)

func (*Registry) DeleteClient

func (cm *Registry) DeleteClient(ctx context.Context, clientID string) error

func (*Registry) GetClient

func (cm *Registry) GetClient(ctx context.Context, clientID string) (*Client, error)

func (*Registry) SetupRoutes

func (cm *Registry) SetupRoutes(mux *http.ServeMux)

Jump to

Keyboard shortcuts

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