Documentation
¶
Index ¶
- Variables
- type Client
- type ClientRepository
- type ClientResponse
- type CreateClientInput
- type GrpcHandler
- func (h *GrpcHandler) CreateClient(ctx context.Context, req *proto.InternalOAuthClientsServiceCreateClientRequest) (*proto.InternalOAuthClientsServiceCreateClientResponse, error)
- func (h *GrpcHandler) DeleteClient(ctx context.Context, req *proto.InternalOAuthClientsServiceDeleteClientRequest) (*proto.InternalOAuthClientsServiceDeleteClientResponse, error)
- func (h *GrpcHandler) GetClient(ctx context.Context, req *proto.InternalOAuthClientsServiceGetClientRequest) (*proto.InternalOAuthClientsServiceGetClientResponse, error)
- type Registry
- func (cm *Registry) CreateClient(ctx context.Context, client *Client) (*Client, error)
- func (cm *Registry) DeleteClient(ctx context.Context, clientID string) error
- func (cm *Registry) GetClient(ctx context.Context, clientID string) (*Client, error)
- func (cm *Registry) SetupRoutes(mux *http.ServeMux)
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 (*Client) GetUpdatedAt ¶
type ClientRepository ¶
type ClientRepository struct {
// contains filtered or unexported fields
}
func NewClientRepository ¶
func NewClientRepository(db querier) *ClientRepository
func (*ClientRepository) CreateClient ¶
func (*ClientRepository) DeleteClient ¶
func (r *ClientRepository) DeleteClient(ctx context.Context, id string) 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
func (*GrpcHandler) CreateClient ¶ added in v1.31.1
func (h *GrpcHandler) CreateClient(ctx context.Context, req *proto.InternalOAuthClientsServiceCreateClientRequest) (*proto.InternalOAuthClientsServiceCreateClientResponse, error)
func (*GrpcHandler) DeleteClient ¶ added in v1.31.1
func (h *GrpcHandler) DeleteClient(ctx context.Context, req *proto.InternalOAuthClientsServiceDeleteClientRequest) (*proto.InternalOAuthClientsServiceDeleteClientResponse, error)
func (*GrpcHandler) GetClient ¶ added in v1.31.1
func (h *GrpcHandler) GetClient(ctx context.Context, req *proto.InternalOAuthClientsServiceGetClientRequest) (*proto.InternalOAuthClientsServiceGetClientResponse, error)
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry(r *ClientRepository, hasher fosite.Hasher) *Registry
func (*Registry) CreateClient ¶
func (*Registry) DeleteClient ¶
func (*Registry) SetupRoutes ¶
Click to show internal directories.
Click to hide internal directories.