adminclient

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package adminclient constructs the CLI's gRPC client to the control plane's AdminService. It composes auth primitives (mTLS material + signed JWT assertions) with CP-specific network topology (127.0.0.1:adminPort target, Hydra token endpoint, ServerName).

Auth primitives live in internal/auth — this package owns the wiring that turns those primitives into a working AdminServiceClient.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, adminPort, hydraPort int, opts ...grpc.DialOption) (adminv1.AdminServiceClient, *grpc.ClientConn, error)

Dial connects to the CP's gRPC AdminService with mTLS + OAuth2.

  1. Load signing key + CA cert + client cert from auth material
  2. Build TLS config trusting the CLI CA
  3. Create a tokenSource that auto-refreshes via Hydra /oauth2/token
  4. Dial gRPC with mTLS + auto-refreshing bearer token in metadata

Callers may pass additional grpc.DialOption values (e.g. keepalive, observability interceptors via grpc.WithChainUnaryInterceptor). The auth/TLS baseline is appended last:

  • WithTransportCredentials: single-slot, last-wins — baseline mTLS cannot be disabled by caller intent.
  • Auth bearer-token interceptor: registered via grpc.WithChainUnaryInterceptor so it composes additively with caller chain interceptors; a caller's own grpc.WithUnaryInterceptor (if any) is prepended by grpc-go as the outermost wrapper.

Do NOT pass grpc.WithUnaryInterceptor — grpc-go stores it in a single field with last-wins semantics, so your interceptor will be silently dropped (baseline auth wins). Use grpc.WithChainUnaryInterceptor.

func ProbeCPTime added in v0.10.2

func ProbeCPTime(ctx context.Context, adminPort int) (time.Time, error)

ProbeCPTime returns the control plane's current wall-clock time via a single mTLS GetSystemTime round trip (the public bootstrap RPC, no bearer token). Callers gate assertion minting on it: an assertion's iat is in the host clock, and Hydra/fosite validates iat against the CP clock with zero leeway, so a caller waits until the CP clock is no longer behind the host before minting. Bounded internally by cpTimeProbeTimeout; respects ctx cancellation/deadline.

Types

This section is empty.

Jump to

Keyboard shortcuts

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