Documentation
¶
Overview ¶
Package adminclient is the client of the admin API: it builds the signed envelope of each mutating call and asks a Signer (a FIDO2 key) to sign it.
Index ¶
- func Dial(target string, cfg *tls.Config) (*grpc.ClientConn, error)
- func DialUnix(path string) (*grpc.ClientConn, error)
- func Enrol(ctx context.Context, conn grpc.ClientConnInterface, s Signer, name string) (*adminv1.AdminCredential, error)
- type Client
- func (c *Client) AddSSHKey(ctx context.Context, login, publicKey string) (*adminv1.SSHKey, error)
- func (c *Client) BindIdentity(ctx context.Context, issuer, subject, login string) (*adminv1.Identity, error)
- func (c *Client) CreateUser(ctx context.Context, login, display string) (*adminv1.User, error)
- func (c *Client) DisableUser(ctx context.Context, login string) error
- func (c *Client) Nonce(ctx context.Context) (nonce, exporter []byte, err error)
- func (c *Client) OpenSession(ctx context.Context) ([]byte, error)
- func (c *Client) RemoveSSHKey(ctx context.Context, fingerprint string) error
- func (c *Client) RevokeCredential(ctx context.Context, id []byte) error
- func (c *Client) SetCollaborator(ctx context.Context, owner, repository, login string, member bool) error
- func (c *Client) SetOIDCClient(ctx context.Context, issuer, clientID, redirectURI string, secret []byte) error
- func (c *Client) SetPolicy(ctx context.Context, p *adminv1.Policy) error
- func (c *Client) SetRefProtection(ctx context.Context, owner, repository, pattern string, protected bool) error
- func (c *Client) Sign(ctx context.Context, method string, params proto.Message) (*adminv1.Envelope, error)
- func (c *Client) UnbindIdentity(ctx context.Context, issuer, subject string) error
- type FIDOSigner
- type Signer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
Conn *grpc.ClientConn
Admin adminv1.AdminServiceClient
Signer Signer
RPID string
CredentialID []byte
}
Client talks to the admin API.
func (*Client) BindIdentity ¶
func (c *Client) BindIdentity(ctx context.Context, issuer, subject, login string) (*adminv1.Identity, error)
BindIdentity binds (issuer, subject) to a user.
func (*Client) CreateUser ¶
CreateUser creates a user.
func (*Client) DisableUser ¶
DisableUser disables a user.
func (*Client) OpenSession ¶
OpenSession signs one assertion and returns a read-only session token.
func (*Client) RemoveSSHKey ¶
RemoveSSHKey removes the key with this fingerprint.
func (*Client) RevokeCredential ¶
RevokeCredential revokes an admin credential.
func (*Client) SetCollaborator ¶
func (c *Client) SetCollaborator(ctx context.Context, owner, repository, login string, member bool) error
SetCollaborator grants (member) or revokes push on owner/repository to login.
func (*Client) SetOIDCClient ¶
func (c *Client) SetOIDCClient(ctx context.Context, issuer, clientID, redirectURI string, secret []byte) error
SetOIDCClient replaces the OIDC registration. The secret goes in the signed request body only.
func (*Client) SetRefProtection ¶
func (c *Client) SetRefProtection(ctx context.Context, owner, repository, pattern string, protected bool) error
SetRefProtection protects or unprotects a ref pattern of owner/repository.
type FIDOSigner ¶
FIDOSigner signs with a hardware key through go-authn/fido. It asks for user verification ("uv": true), which on a key with built-in verification (a YubiKey Bio's fingerprint) needs no PIN token. A key that can only verify by PIN is refused by the key itself and the error says so.
type Signer ¶
type Signer interface {
// Assert returns authenticator data and an ES256 signature, with user
// verification, over authenticatorData || cdh.
Assert(ctx context.Context, rpID string, credentialID []byte, cdh [32]byte) (authData, signature []byte, err error)
// Make creates a credential and returns the attestation object's parts.
Make(ctx context.Context, rpID string, userHandle []byte, name string, cdh [32]byte) (format string, authData, attStmt []byte, err error)
}
Signer produces FIDO2 assertions and attestations. The hardware implementation is FIDOSigner; tests use a software authenticator.