Documentation
¶
Index ¶
- Variables
- func NewServiceUserTokenSource(keylineURL string, virtualServer string, privateKeyPem string, kid string, ...) oauth2.TokenSource
- type ApiError
- type ApplicationClient
- type Client
- type IdentityProviderClient
- type ListApplicationParams
- type ListRoleParams
- type ListUserParams
- type ListUsersInRoleParams
- type OIDCRoundTripper
- type OidcClient
- type PatchVirtualServerInput
- type ProjectClient
- type RoleClient
- type Transport
- func (t *Transport) Do(req *http.Request) (*http.Response, error)
- func (t *Transport) DoNoRedirect(req *http.Request) (*http.Response, error)
- func (t *Transport) DoRaw(req *http.Request) (*http.Response, error)
- func (t *Transport) NewOidcRequest(ctx context.Context, method string, endpoint string, body io.Reader) (*http.Request, error)
- func (t *Transport) NewRootRequest(ctx context.Context, method string, endpoint string, body io.Reader) (*http.Request, error)
- func (t *Transport) NewTenantRequest(ctx context.Context, method string, endpoint string, body io.Reader) (*http.Request, error)
- type TransportOptions
- func WithBaseURL(baseURL string) TransportOptions
- func WithClient(client *http.Client) TransportOptions
- func WithOidc(tokenSource oauth2.TokenSource) TransportOptions
- func WithRoundTripper(roundTripperFactory func(next http.RoundTripper) http.RoundTripper) TransportOptions
- func WithServiceUser(privateKeyPem string, kid string, username string, application string) TransportOptions
- type UserClient
- type VirtualServerClient
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewServiceUserTokenSource ¶ added in v0.6.4
func NewServiceUserTokenSource(keylineURL string, virtualServer string, privateKeyPem string, kid string, username string, application string) oauth2.TokenSource
NewServiceUserTokenSource logs the given service user in through Keyline's RFC 7523 JWT bearer grant and hands out the access token itself.
WithServiceUser is the way to call Keyline's own API as a service user. This constructor exists for programs that need the token as a value, because they present it to another service that trusts Keyline as its issuer. Both share one login so a change to the grant reaches every caller.
Types ¶
type ApplicationClient ¶
type ApplicationClient interface {
Create(ctx context.Context, dto api.CreateApplicationRequestDto) (api.CreateApplicationResponseDto, error)
List(ctx context.Context, params ListApplicationParams) (api.PagedApplicationsResponseDto, error)
Get(ctx context.Context, id uuid.UUID) (api.GetApplicationResponseDto, error)
Patch(ctx context.Context, id uuid.UUID, dto api.PatchApplicationRequestDto) error
Delete(ctx context.Context, id uuid.UUID) error
AddKey(ctx context.Context, id uuid.UUID, dto api.AddApplicationKeyRequestDto) (api.AddApplicationKeyResponseDto, error)
ListKeys(ctx context.Context, id uuid.UUID) ([]api.ApplicationKeyResponseDto, error)
RemoveKey(ctx context.Context, id uuid.UUID, kid string) error
}
func NewApplicationClient ¶
func NewApplicationClient(transport *Transport, projectSlug string) ApplicationClient
type Client ¶
type Client interface {
VirtualServer() VirtualServerClient
User() UserClient
Oidc() OidcClient
Project() ProjectClient
}
type IdentityProviderClient ¶ added in v0.6.3
type IdentityProviderClient interface {
Create(ctx context.Context, dto api.CreateIdentityProviderRequestDto) (api.CreateIdentityProviderResponseDto, error)
Get(ctx context.Context, name string) (api.GetIdentityProviderResponseDto, error)
}
func NewIdentityProviderClient ¶ added in v0.6.3
func NewIdentityProviderClient(transport *Transport) IdentityProviderClient
type ListApplicationParams ¶
type ListRoleParams ¶ added in v0.3.10
type ListUserParams ¶
type ListUsersInRoleParams ¶ added in v0.3.11
type OIDCRoundTripper ¶
type OIDCRoundTripper struct {
// contains filtered or unexported fields
}
func NewOIDCRoundTripper ¶
func NewOIDCRoundTripper(next http.RoundTripper, tokenSource oauth2.TokenSource) *OIDCRoundTripper
type OidcClient ¶
type OidcClient interface {
BeginDeviceFlow(ctx context.Context, clientId string, scope string) (api.DeviceAuthorizationResponse, error)
PollDeviceToken(ctx context.Context, clientId string, deviceCode string) (api.DeviceTokenResponse, error)
PostActivate(ctx context.Context, userCode string) (loginToken string, err error)
VerifyPassword(ctx context.Context, loginToken string, username string, password string) error
FinishLogin(ctx context.Context, loginToken string) error
}
func NewOidcClient ¶
func NewOidcClient(transport *Transport) OidcClient
type PatchVirtualServerInput ¶ added in v0.3.0
type PatchVirtualServerInput struct {
DisplayName *string `json:"displayName"`
EnableRegistration *bool `json:"enableRegistration"`
Require2fa *bool `json:"require2fa"`
RequireEmailVerification *bool `json:"requireEmailVerification"`
PrimarySigningAlgorithm *string `json:"primarySigningAlgorithm,omitempty"`
AdditionalSigningAlgorithms *[]string `json:"additionalSigningAlgorithms,omitempty"`
}
PatchVirtualServerInput holds the fields that can be patched on a virtual server.
type ProjectClient ¶ added in v0.3.0
type ProjectClient interface {
Create(ctx context.Context, input api.CreateProjectRequestDto) (api.CreateProjectResponseDto, error)
Get(ctx context.Context, slug string) (api.GetProjectResponseDto, error)
Application(projectSlug string) ApplicationClient
Role(projectSlug string) RoleClient
}
func NewProjectClient ¶ added in v0.3.0
func NewProjectClient(transport *Transport) ProjectClient
type RoleClient ¶ added in v0.3.10
type RoleClient interface {
Create(ctx context.Context, dto api.CreateRoleRequestDto) (api.CreateRoleResponseDto, error)
List(ctx context.Context, params ListRoleParams) (api.PagedRolesResponseDto, error)
Get(ctx context.Context, id uuid.UUID) (api.GetRoleByIdResponseDto, error)
Patch(ctx context.Context, id uuid.UUID, dto api.PatchRoleRequestDto) error
Delete(ctx context.Context, id uuid.UUID) error
Assign(ctx context.Context, roleId uuid.UUID, userId uuid.UUID) error
ListUsers(ctx context.Context, roleId uuid.UUID, params ListUsersInRoleParams) (api.PagedUsersInRoleResponseDto, error)
}
func NewRoleClient ¶ added in v0.3.10
func NewRoleClient(transport *Transport, projectSlug string) RoleClient
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
func NewTransport ¶
func NewTransport(baseUrl string, virtualServer string, options ...TransportOptions) *Transport
func (*Transport) DoNoRedirect ¶
DoNoRedirect executes the request without following redirects.
func (*Transport) DoRaw ¶
DoRaw executes the request and returns the raw response without status code checking.
func (*Transport) NewOidcRequest ¶
func (*Transport) NewRootRequest ¶
type TransportOptions ¶
type TransportOptions func(*Transport)
func WithBaseURL ¶
func WithBaseURL(baseURL string) TransportOptions
func WithClient ¶
func WithClient(client *http.Client) TransportOptions
func WithOidc ¶
func WithOidc(tokenSource oauth2.TokenSource) TransportOptions
func WithRoundTripper ¶
func WithRoundTripper(roundTripperFactory func(next http.RoundTripper) http.RoundTripper) TransportOptions
func WithServiceUser ¶ added in v0.6.3
func WithServiceUser(privateKeyPem string, kid string, username string, application string) TransportOptions
WithServiceUser authenticates every request as the given service user through Keyline's RFC 7523 JWT bearer grant.
type UserClient ¶
type UserClient interface {
Create(ctx context.Context, dto api.CreateUserRequestDto) (api.CreateUserResponseDto, error)
List(ctx context.Context, params ListUserParams) (api.PagedUsersResponseDto, error)
Get(ctx context.Context, id uuid.UUID) (api.GetUserByIdResponseDto, error)
Patch(ctx context.Context, id uuid.UUID, dto api.PatchUserRequestDto) error
CreateServiceUser(ctx context.Context, username string) (uuid.UUID, error)
AssociateServiceUserPublicKey(ctx context.Context, serviceUserID uuid.UUID, dto api.AssociateServiceUserPublicKeyRequestDto) (api.AssociateServiceUserPublicKeyResponseDto, error)
RemoveServiceUserPublicKey(ctx context.Context, serviceUserID uuid.UUID, kid string) error
}
func NewUserClient ¶
func NewUserClient(transport *Transport) UserClient
type VirtualServerClient ¶
type VirtualServerClient interface {
Create(ctx context.Context, dto api.CreateVirtualServerRequestDto) error
Get(ctx context.Context) (api.GetVirtualServerResponseDto, error)
GetPublicInfo(ctx context.Context) (api.GetVirtualServerListResponseDto, error)
Patch(ctx context.Context, input PatchVirtualServerInput) error
IdentityProviders() IdentityProviderClient
}
func NewVirtualServerClient ¶
func NewVirtualServerClient(transport *Transport) VirtualServerClient