Documentation
¶
Index ¶
- Variables
- type AuthnType
- type Client
- func (c *Client) CreateAccessor(ctx context.Context, fa userstore.Accessor) (*userstore.Accessor, error)
- func (c *Client) CreateColumn(ctx context.Context, column userstore.Column) (*userstore.Column, error)
- func (c *Client) CreateMutator(ctx context.Context, fa userstore.Mutator) (*userstore.Mutator, error)
- func (c *Client) CreateUser(ctx context.Context, profile userstore.Record, externalAlias string) (uuid.UUID, error)
- func (c *Client) DeleteAccessor(ctx context.Context, accessorID uuid.UUID) error
- func (c *Client) DeleteColumn(ctx context.Context, columnID uuid.UUID) error
- func (c *Client) DeleteMutator(ctx context.Context, mutatorID uuid.UUID) error
- func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error
- func (c *Client) ExecuteAccessor(ctx context.Context, accessorID uuid.UUID, clientContext policy.ClientContext, ...) ([]string, error)
- func (c *Client) ExecuteMutator(ctx context.Context, mutatorID uuid.UUID, clientContext policy.ClientContext, ...) ([]uuid.UUID, error)
- func (c *Client) GetAccessor(ctx context.Context, accessorID uuid.UUID) (*userstore.Accessor, error)
- func (c *Client) GetAccessorByVersion(ctx context.Context, accessorID uuid.UUID, version int) (*userstore.Accessor, error)
- func (c *Client) GetColumn(ctx context.Context, columnID uuid.UUID) (*userstore.Column, error)
- func (c *Client) GetMutator(ctx context.Context, mutatorID uuid.UUID) (*userstore.Mutator, error)
- func (c *Client) GetMutatorByVersion(ctx context.Context, mutatorID uuid.UUID, version int) (*userstore.Mutator, error)
- func (c *Client) GetUser(ctx context.Context, id uuid.UUID) (*UserAndAuthnResponse, error)
- func (c *Client) GetUserByExternalAlias(ctx context.Context, alias string) (*UserAndAuthnResponse, error)
- func (c *Client) ListAccessors(ctx context.Context) ([]userstore.Accessor, error)
- func (c *Client) ListColumns(ctx context.Context) ([]userstore.Column, error)
- func (c *Client) ListMutators(ctx context.Context) ([]userstore.Mutator, error)
- func (c *Client) UpdateAccessor(ctx context.Context, accessorID uuid.UUID, updatedAccessor userstore.Accessor) (*userstore.Accessor, error)
- func (c *Client) UpdateColumn(ctx context.Context, columnID uuid.UUID, updatedColumn userstore.Column) (*userstore.Column, error)
- func (c *Client) UpdateMutator(ctx context.Context, mutatorID uuid.UUID, updatedMutator userstore.Mutator) (*userstore.Mutator, error)
- func (c *Client) UpdateUser(ctx context.Context, id uuid.UUID, req UpdateUserRequest) (*UserAndAuthnResponse, error)
- type CreateAccessorRequest
- type CreateAccessorResponse
- type CreateColumnRequest
- type CreateColumnResponse
- type CreateMutatorRequest
- type CreateMutatorResponse
- type CreateUserAndAuthnRequest
- type ExecuteAccessorRequest
- type ExecuteAccessorResponse
- type ExecuteMutatorRequest
- type ExecuteMutatorResponse
- type ListAccessorsResponse
- type ListColumnsResponse
- type ListMutatorsResponse
- type UpdateAccessorRequest
- type UpdateAccessorResponse
- type UpdateColumnRequest
- type UpdateColumnResponse
- type UpdateMutatorRequest
- type UpdateMutatorResponse
- type UpdateUserRequest
- type UserAndAuthnResponse
- type UserAuthn
- type UserProfile
Constants ¶
This section is empty.
Variables ¶
var MutatorColumnCurrentValue = mutatorSystemValue{SystemValue: "current"}
MutatorColumnCurrentValue is a special value that can be used to set a column to its current value
var MutatorColumnDefaultValue = mutatorSystemValue{SystemValue: "default"}
MutatorColumnDefaultValue is a special value that can be used to set a column to its default value
Functions ¶
This section is empty.
Types ¶
type AuthnType ¶
type AuthnType string
AuthnType defines the kinds of authentication factors
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client to talk to the Userclouds IDP
func (*Client) CreateAccessor ¶ added in v0.3.0
func (c *Client) CreateAccessor(ctx context.Context, fa userstore.Accessor) (*userstore.Accessor, error)
CreateAccessor creates a new accessor for the associated tenant
func (*Client) CreateColumn ¶ added in v0.3.0
func (c *Client) CreateColumn(ctx context.Context, column userstore.Column) (*userstore.Column, error)
CreateColumn creates a new column for the associated tenant
func (*Client) CreateMutator ¶ added in v0.4.0
func (c *Client) CreateMutator(ctx context.Context, fa userstore.Mutator) (*userstore.Mutator, error)
CreateMutator creates a new mutator for the associated tenant
func (*Client) CreateUser ¶ added in v0.3.0
func (c *Client) CreateUser(ctx context.Context, profile userstore.Record, externalAlias string) (uuid.UUID, error)
CreateUser creates a user without authn. profile & externalAlias are optional
func (*Client) DeleteAccessor ¶ added in v0.3.0
DeleteAccessor deletes the accessor specified by the accessor ID for the associated tenant
func (*Client) DeleteColumn ¶ added in v0.3.0
DeleteColumn deletes the column specified by the column ID for the associated tenant
func (*Client) DeleteMutator ¶ added in v0.4.0
DeleteMutator deletes the mutator specified by the mutator ID for the associated tenant
func (*Client) DeleteUser ¶
DeleteUser deletes a user by ID
func (*Client) ExecuteAccessor ¶ added in v0.3.0
func (c *Client) ExecuteAccessor(ctx context.Context, accessorID uuid.UUID, clientContext policy.ClientContext, selectorValues userstore.UserSelectorValues) ([]string, error)
ExecuteAccessor accesses a column via an accessor for the associated tenant
func (*Client) ExecuteMutator ¶ added in v0.5.0
func (c *Client) ExecuteMutator(ctx context.Context, mutatorID uuid.UUID, clientContext policy.ClientContext, selectorValues userstore.UserSelectorValues, rowValues map[string]interface{}) ([]uuid.UUID, error)
ExecuteMutator modifies columns in userstore via a mutator for the associated tenant
func (*Client) GetAccessor ¶ added in v0.3.0
func (c *Client) GetAccessor(ctx context.Context, accessorID uuid.UUID) (*userstore.Accessor, error)
GetAccessor returns the accessor specified by the accessor ID for the associated tenant
func (*Client) GetAccessorByVersion ¶ added in v0.4.0
func (c *Client) GetAccessorByVersion(ctx context.Context, accessorID uuid.UUID, version int) (*userstore.Accessor, error)
GetAccessorByVersion returns the version of an accessor specified by the accessor ID and version for the associated tenant
func (*Client) GetColumn ¶ added in v0.3.0
GetColumn returns the column specified by the column ID for the associated tenant
func (*Client) GetMutator ¶ added in v0.4.0
GetMutator returns the mutator specified by the mutator ID for the associated tenant
func (*Client) GetMutatorByVersion ¶ added in v0.5.0
func (c *Client) GetMutatorByVersion(ctx context.Context, mutatorID uuid.UUID, version int) (*userstore.Mutator, error)
GetMutatorByVersion returns the version of an mutator specified by the mutator ID and version for the associated tenant
func (*Client) GetUserByExternalAlias ¶ added in v0.3.0
func (c *Client) GetUserByExternalAlias(ctx context.Context, alias string) (*UserAndAuthnResponse, error)
GetUserByExternalAlias gets a user by external alias
func (*Client) ListAccessors ¶ added in v0.3.0
ListAccessors lists all the available accessors for the associated tenant
func (*Client) ListColumns ¶ added in v0.3.0
ListColumns lists all columns for the associated tenant
func (*Client) ListMutators ¶ added in v0.4.0
ListMutators lists all the available mutators for the associated tenant
func (*Client) UpdateAccessor ¶ added in v0.3.0
func (c *Client) UpdateAccessor(ctx context.Context, accessorID uuid.UUID, updatedAccessor userstore.Accessor) (*userstore.Accessor, error)
UpdateAccessor updates the accessor specified by the accessor ID with the specified data for the associated tenant
func (*Client) UpdateColumn ¶ added in v0.3.0
func (c *Client) UpdateColumn(ctx context.Context, columnID uuid.UUID, updatedColumn userstore.Column) (*userstore.Column, error)
UpdateColumn updates the column specified by the column ID with the specified data for the associated tenant
func (*Client) UpdateMutator ¶ added in v0.4.0
func (c *Client) UpdateMutator(ctx context.Context, mutatorID uuid.UUID, updatedMutator userstore.Mutator) (*userstore.Mutator, error)
UpdateMutator updates the mutator specified by the mutator ID with the specified data for the associated tenant
func (*Client) UpdateUser ¶
func (c *Client) UpdateUser(ctx context.Context, id uuid.UUID, req UpdateUserRequest) (*UserAndAuthnResponse, error)
UpdateUser updates user profile data for a given user ID
type CreateAccessorRequest ¶ added in v0.3.0
CreateAccessorRequest is the request body for creating a new accessor
type CreateAccessorResponse ¶ added in v0.3.0
CreateAccessorResponse is the response body for creating a new accessor
type CreateColumnRequest ¶ added in v0.3.0
CreateColumnRequest is the request body for creating a new column TODO: should this support multiple at once before we ship this API?
type CreateColumnResponse ¶ added in v0.3.0
CreateColumnResponse is the response body for creating a new column
type CreateMutatorRequest ¶ added in v0.4.0
CreateMutatorRequest is the request body for creating a new mutator
type CreateMutatorResponse ¶ added in v0.4.0
CreateMutatorResponse is the response body for creating a new mutator
type CreateUserAndAuthnRequest ¶ added in v0.3.0
type CreateUserAndAuthnRequest struct {
// TODO: these fields really belong in a better client-facing User type
ExternalAlias *string `json:"external_alias,omitempty"`
RequireMFA bool `json:"require_mfa"`
Profile userstore.Record `json:"profile"`
OrganizationID uuid.UUID `json:"organization_id"`
UserAuthn
}
CreateUserAndAuthnRequest creates a user on the IDP
type ExecuteAccessorRequest ¶ added in v0.3.0
type ExecuteAccessorRequest struct {
AccessorID uuid.UUID `json:"accessor_id"` // the accessor that specifies what data to access
Context policy.ClientContext `json:"context"` // context that is provided to the accessor Access Policy
SelectorValues userstore.UserSelectorValues `json:"selector_values"` // the values to use for the selector
}
ExecuteAccessorRequest is the request body for accessing a column
type ExecuteAccessorResponse ¶ added in v0.3.0
type ExecuteAccessorResponse struct {
Value []string `json:"value"`
}
ExecuteAccessorResponse is the response body for accessing a column
type ExecuteMutatorRequest ¶ added in v0.5.0
type ExecuteMutatorRequest struct {
MutatorID uuid.UUID `json:"mutator_id"` // the mutator that specifies what columns to edit
Context policy.ClientContext `json:"context"` // context that is provided to the mutator's Access Policy
SelectorValues userstore.UserSelectorValues `json:"selector_values"` // the values to use for the selector
RowValues map[string]interface{} `json:"row_values"` // the values to use for the users table row
}
ExecuteMutatorRequest is the request body for modifying data in the userstore
type ExecuteMutatorResponse ¶ added in v0.5.0
ExecuteMutatorResponse is the response body for modifying data in the userstore
type ListAccessorsResponse ¶ added in v0.3.0
ListAccessorsResponse is the response body for listing accessors
type ListColumnsResponse ¶ added in v0.3.0
ListColumnsResponse is the response body for listing columns
type ListMutatorsResponse ¶ added in v0.4.0
ListMutatorsResponse is the response body for listing mutators
type UpdateAccessorRequest ¶ added in v0.3.0
UpdateAccessorRequest is the request body for updating an accessor
type UpdateAccessorResponse ¶ added in v0.3.0
UpdateAccessorResponse is the response body for updating an accessor
type UpdateColumnRequest ¶ added in v0.3.0
UpdateColumnRequest is the request body for updating a column
type UpdateColumnResponse ¶ added in v0.3.0
UpdateColumnResponse is the response body for updating a column
type UpdateMutatorRequest ¶ added in v0.4.0
UpdateMutatorRequest is the request body for updating a mutator
type UpdateMutatorResponse ¶ added in v0.4.0
UpdateMutatorResponse is the response body for updating a mutator
type UpdateUserRequest ¶
type UpdateUserRequest struct {
// TODO: add MFA factors
RequireMFA *bool `json:"require_mfa,omitempty"`
// Only fields set in the underlying map will be updated
Profile userstore.Record `json:"profile"`
OrganizationID *uuid.UUID `json:"organization_id"`
}
UpdateUserRequest optionally updates some or all mutable fields of a user struct. Pointers are used to distinguish between unset vs. set to default value (false, "", etc). TODO: should we allow changing Email? That's a more complex one as there are more implications to changing email that may affect AuthNs and security (e.g. account hijacking, unverified emails, etc).
type UserAndAuthnResponse ¶ added in v0.3.0
type UserAndAuthnResponse struct {
ID uuid.UUID `json:"id"`
UpdatedAt int64 `json:"updated_at"` // seconds since the Unix Epoch (UTC)
ExternalAlias *string `json:"external_alias,omitempty"`
RequireMFA bool `json:"require_mfa"`
Profile userstore.Record `json:"profile"`
OrganizationID uuid.UUID `json:"organization_id"`
Authns []UserAuthn `json:"authns"`
}
UserAndAuthnResponse is the response body for methods which return user data.
type UserAuthn ¶
type UserAuthn struct {
AuthnType AuthnType `json:"authn_type"`
// Fields specified if AuthnType == 'password'
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
// Fields specified if AuthnType == 'social'
SocialProvider socialprovider.SocialProvider `json:"social_provider,omitempty"`
OIDCSubject string `json:"oidc_subject,omitempty"`
}
UserAuthn represents an authentication factor for a user. NOTE: some fields are not used in some circumstances, e.g. Password is only used when creating an account but never used when getting an account. TODO: use this for UpdateUser too.
type UserProfile ¶
type UserProfile struct {
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
Name string `json:"name,omitempty"` // Full name in displayable form (incl titles, suffixes, etc) localized to end-user.
Nickname string `json:"nickname,omitempty"` // Casual name of the user, may or may not be same as Given Name.
Picture string `json:"picture,omitempty"` // URL of the user's profile picture.
}
UserProfile is a collection of per-user properties stored in the DB as JSON since they are likely to be sparse and change more frequently. Follow conventions of https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims for all standard fields.
func (*UserProfile) Validate ¶
func (o *UserProfile) Validate() error
Validate implements Validateable