interfaces

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// Authenticate receives an HTTP request and returns the identity of the caller.
	// The same identity will be available to the service backend through the request
	// context. To avoid issues with value types, it's best to return a pointer type.
	//
	// Note that the implementations of this method should not alter the state of the
	// received request instance.
	//
	// If the returned identity is nil it will be regarded as authentication failure.
	//
	// To return an error, the implementations should use the provided error functions
	// (e.g., `NewAuthenticationError`) and avoid creating ad-hoc errors.
	Authenticate(r *http.Request) (any, error)
}

Authenticator defines an abstract backend to perform authentication on HTTP requests.

type CapabilitiesService

type CapabilitiesService interface {
	ListCapabilities(ctx context.Context) ([]resources.Capability, error)
}

CapabilitiesService defines an abstract backend to handle capabilities related operations.

type EntitlementsService

type EntitlementsService interface {
	// ListEntitlements returns the list of entitlements in JSON format.
	ListEntitlements(ctx context.Context, params *resources.GetEntitlementsParams) ([]resources.EntitlementSchema, error)

	// RawEntitlements returns the list of entitlements as raw text.
	RawEntitlements(ctx context.Context) (string, error)
}

EntitlementsService defines an abstract backend to handle entitlement schema related operations.

type GroupsService

type GroupsService interface {

	// ListGroups returns a page of Group objects of at least `size` elements if available.
	ListGroups(ctx context.Context, params *resources.GetGroupsParams) (*resources.PaginatedResponse[resources.Group], error)
	// CreateGroup creates a single Group.
	CreateGroup(ctx context.Context, group *resources.Group) (*resources.Group, error)

	// GetGroup returns a single Group identified by `groupId`.
	GetGroup(ctx context.Context, groupId string) (*resources.Group, error)

	// UpdateGroup updates a Group.
	UpdateGroup(ctx context.Context, group *resources.Group) (*resources.Group, error)
	// DeleteGroup deletes a Group identified by `groupId`.
	// returns (true, nil) in case the group was successfully deleted.
	// returns (false, error) in case something went wrong.
	// implementors may want to return (false, nil) for idempotency cases.
	DeleteGroup(ctx context.Context, groupId string) (bool, error)

	// GetGroupIdentities returns a page of identities in a Group identified by `groupId`.
	GetGroupIdentities(ctx context.Context, groupId string, params *resources.GetGroupsItemIdentitiesParams) (*resources.PaginatedResponse[resources.Identity], error)
	// PatchGroupIdentities performs addition or removal of identities to/from a Group identified by `groupId`.
	PatchGroupIdentities(ctx context.Context, groupId string, identityPatches []resources.GroupIdentitiesPatchItem) (bool, error)

	// GetGroupRoles returns a page of Roles for Group `groupId`.
	GetGroupRoles(ctx context.Context, groupId string, params *resources.GetGroupsItemRolesParams) (*resources.PaginatedResponse[resources.Role], error)
	// PatchGroupRoles performs addition or removal of a Role to/from a Group identified by `groupId`.
	PatchGroupRoles(ctx context.Context, groupId string, rolePatches []resources.GroupRolesPatchItem) (bool, error)

	// GetGroupEntitlements returns a page of Entitlements for Group `groupId`.
	GetGroupEntitlements(ctx context.Context, groupId string, params *resources.GetGroupsItemEntitlementsParams) (*resources.PaginatedResponse[resources.EntityEntitlement], error)
	// PatchGroupEntitlements performs addition or removal of an Entitlement to/from a Group identified by `groupId`.
	PatchGroupEntitlements(ctx context.Context, groupId string, entitlementPatches []resources.GroupEntitlementsPatchItem) (bool, error)
}

GroupsService defines an abstract backend to handle Groups related operations.

type IdentitiesService

type IdentitiesService interface {

	// ListIdentities returns a page of Identity objects of at least `size` elements if available
	ListIdentities(ctx context.Context, params *resources.GetIdentitiesParams) (*resources.PaginatedResponse[resources.Identity], error)
	// CreateIdentity creates a single Identity.
	CreateIdentity(ctx context.Context, identity *resources.Identity) (*resources.Identity, error)

	// GetIdentity returns a single Identity.
	GetIdentity(ctx context.Context, identityId string) (*resources.Identity, error)

	// UpdateIdentity updates an Identity.
	UpdateIdentity(ctx context.Context, identity *resources.Identity) (*resources.Identity, error)
	// DeleteIdentity deletes an Identity
	// returns (true, nil) in case an identity was successfully delete
	// return (false, error) in case something went wrong
	// implementors may want to return (false, nil) for idempotency cases
	DeleteIdentity(ctx context.Context, identityId string) (bool, error)

	// GetIdentityGroups returns a page of Groups for identity `identityId`.
	GetIdentityGroups(ctx context.Context, identityId string, params *resources.GetIdentitiesItemGroupsParams) (*resources.PaginatedResponse[resources.Group], error)
	// PatchIdentityGroups performs addition or removal of a Group to/from an Identity.
	PatchIdentityGroups(ctx context.Context, identityId string, groupPatches []resources.IdentityGroupsPatchItem) (bool, error)

	// GetIdentityRoles returns a page of Roles for identity `identityId`.
	GetIdentityRoles(ctx context.Context, identityId string, params *resources.GetIdentitiesItemRolesParams) (*resources.PaginatedResponse[resources.Role], error)
	// PatchIdentityRoles performs addition or removal of a Role to/from an Identity.
	PatchIdentityRoles(ctx context.Context, identityId string, rolePatches []resources.IdentityRolesPatchItem) (bool, error)

	// GetIdentityEntitlements returns a page of Entitlements for identity `identityId`.
	GetIdentityEntitlements(ctx context.Context, identityId string, params *resources.GetIdentitiesItemEntitlementsParams) (*resources.PaginatedResponse[resources.EntityEntitlement], error)
	// PatchIdentityEntitlements performs addition or removal of an Entitlement to/from an Identity.
	PatchIdentityEntitlements(ctx context.Context, identityId string, entitlementPatches []resources.IdentityEntitlementsPatchItem) (bool, error)
}

IdentitiesService defines an abstract backend to handle Identities related operations.

type IdentityProvidersService

type IdentityProvidersService interface {

	// ListAvailableIdentityProviders returns the static list of supported identity providers.
	ListAvailableIdentityProviders(ctx context.Context, params *resources.GetAvailableIdentityProvidersParams) (*resources.PaginatedResponse[resources.AvailableIdentityProvider], error)

	// ListIdentityProviders returns a list of registered identity providers configurations.
	ListIdentityProviders(ctx context.Context, params *resources.GetIdentityProvidersParams) (*resources.PaginatedResponse[resources.IdentityProvider], error)

	// RegisterConfiguration register a new authentication provider configuration.
	RegisterConfiguration(ctx context.Context, provider *resources.IdentityProvider) (*resources.IdentityProvider, error)

	// DeleteConfiguration removes an authentication provider configuration identified by `id`.
	DeleteConfiguration(ctx context.Context, id string) (bool, error)

	// GetConfiguration returns the authentication provider configuration identified by `id`.
	GetConfiguration(ctx context.Context, id string) (*resources.IdentityProvider, error)

	// UpdateConfiguration update the authentication provider configuration identified by `id`.
	UpdateConfiguration(ctx context.Context, provider *resources.IdentityProvider) (*resources.IdentityProvider, error)
}

IdentityProvidersService defines an abstract backend to handle Roles related operations.

type ResourcesService

type ResourcesService interface {
	// ListResources returns a page of Resource objects of at least `size` elements if available.
	ListResources(ctx context.Context, params *resources.GetResourcesParams) (*resources.PaginatedResponse[resources.Resource], error)
}

ResourcesService defines an abstract backend to handle Resources related operations.

type RolesService

type RolesService interface {
	// ListRoles returns a page of Role objects of at least `size` elements if available.
	ListRoles(ctx context.Context, params *resources.GetRolesParams) (*resources.PaginatedResponse[resources.Role], error)
	// CreateRole creates a single Role.
	CreateRole(ctx context.Context, role *resources.Role) (*resources.Role, error)

	// GetRole returns a single Role.
	GetRole(ctx context.Context, roleId string) (*resources.Role, error)
	// UpdateRole updates a Role.
	UpdateRole(ctx context.Context, role *resources.Role) (*resources.Role, error)
	// DeleteRole deletes a Role
	// returns (true, nil) in case a Role was successfully deleted
	// returns (false, error) in case something went wrong
	// implementors may want to return (false, nil) for idempotency cases.
	DeleteRole(ctx context.Context, roleId string) (bool, error)

	// GetRoleEntitlements returns a page of Entitlements for Role `roleId`.
	GetRoleEntitlements(ctx context.Context, roleId string, params *resources.GetRolesItemEntitlementsParams) (*resources.PaginatedResponse[resources.EntityEntitlement], error)
	// PatchRoleEntitlements performs addition or removal of an Entitlement to/from a Role.
	PatchRoleEntitlements(ctx context.Context, roleId string, entitlementPatches []resources.RoleEntitlementsPatchItem) (bool, error)
}

RolesService defines an abstract backend to handle Roles related operations.

Jump to

Keyboard shortcuts

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