service

package
v0.0.0-...-2d73068 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 22 Imported by: 25

Documentation

Overview

Package service defines an interface used to provide access to objects in the service layer

Index

Constants

View Source
const (
	FACTORY_TYPE_CLUSTER_CACHE       = "factory.type.cluster.cache"
	FACTORY_TYPE_LINKING_PROVIDER    = "factory.type.linking.provider"
	FACTORY_TYPE_IDENTITY_PROVIDER   = "factory.type.identity.provider"
	FACTORY_TYPE_SUBSCRIPTION_LOADER = "factory.type.subscription.loader"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminConsoleService

type AdminConsoleService interface {
	CreateAuditLog(ctx context.Context, username string, eventType string) error
}

AdminConsoleService the Admin Console Service interface

type AuthenticationProviderService

type AuthenticationProviderService interface {
	AuthorizeCallback(ctx context.Context, state string, code string) (*string, error)
	CreateOrUpdateIdentityAndUser(ctx context.Context, referrerURL *url.URL,
		providerToken *oauth2.Token) (*string, *oauth2.Token, error)
	UpdateIdentityUsingUserInfoEndPoint(ctx context.Context, accessToken string) (*account.Identity, error)
	ExchangeAuthorizationCodeForUserToken(ctx context.Context, code string, clientID string, redirectURL *url.URL) (*string, *app.OauthToken, error)
	ExchangeCodeWithProvider(ctx context.Context, code string, redirectURL string) (*oauth2.Token, error)
	GenerateAuthCodeURL(ctx context.Context, redirect *string, apiClient *string,
		state *string, scopes []string, responseMode *string, referrer string, callbackURL string) (*string, error)
	LoginCallback(ctx context.Context, state string, code string, redirectURL string) (*string, error)
	LoadReferrerAndResponseMode(ctx context.Context, state string) (string, *string, error)
	SaveReferrer(ctx context.Context, state string, referrer string,
		responseMode *string, validReferrerURL string) error
}

type CheService

type CheService interface {
	DeleteUser(ctx context.Context, identity account.Identity) error
}

CheService service interface for Che

type ClusterCacheFactory

type ClusterCacheFactory interface {
	NewClusterCache(ctx context.Context, options ...rest.HTTPClientOption) cluster.ClusterCache
}

type ClusterService

type ClusterService interface {
	Clusters(ctx context.Context, options ...rest.HTTPClientOption) ([]cluster.Cluster, error)
	ClusterByURL(ctx context.Context, url string, options ...rest.HTTPClientOption) (*cluster.Cluster, error)
	Status(ctx context.Context, options ...rest.HTTPClientOption) (bool, error)
	UnlinkIdentityFromCluster(ctx context.Context, identityID uuid.UUID, clusterURL string, options ...rest.HTTPClientOption) error
	LinkIdentityToCluster(ctx context.Context, identityID uuid.UUID, clusterURL string, options ...rest.HTTPClientOption) error
	Stop()
}

type Factories

type Factories interface {
	ClusterCacheFactory() ClusterCacheFactory
	IdentityProviderFactory() IdentityProviderFactory
	LinkingProviderFactory() LinkingProviderFactory
}

Factories is the interface responsible for creating instances of factory objects

type IdentityProviderFactory

type IdentityProviderFactory interface {
	NewIdentityProvider(ctx context.Context, config provider.IdentityProviderConfiguration) provider.IdentityProvider
}

type InvitationService

type InvitationService interface {
	// Issue creates a new invitation for a user.
	Issue(ctx context.Context, issuingUserID uuid.UUID, inviteTo string, invitations []invitation.Invitation) error
	// Rescind revokes an invitation for a user.
	Rescind(ctx context.Context, rescindingUserID, invitationID uuid.UUID) error
	// Accept processes the invitation acceptance action from the user, converting the invitation into real memberships/roles
	Accept(ctx context.Context, token uuid.UUID) (string, string, error)
}

type LinkService

type LinkService interface {
	ProviderLocation(ctx context.Context, req *goa.RequestData, identityID string, forResource string, redirectURL string) (string, error)
	Callback(ctx context.Context, req *goa.RequestData, state string, code string) (string, error)
}

LinkService provides the ability to link 3rd party oauth accounts, such as Github and Openshift

type LinkingProviderFactory

type LinkingProviderFactory interface {
	NewLinkingProvider(ctx context.Context, identityID uuid.UUID, authURL string, forResource string) (provider.LinkingProvider, error)
}

type LogoutService

type LogoutService interface {
	Logout(ctx context.Context, redirectURL string) (string, error)
}

type NotificationService

type NotificationService interface {
	SendMessageAsync(ctx context.Context, msg notification.Message, options ...rest.HTTPClientOption) (chan error, error)
	SendMessagesAsync(ctx context.Context, messages []notification.Message, options ...rest.HTTPClientOption) (chan error, error)
	SendMessage(ctx context.Context, msg notification.Message, options ...rest.HTTPClientOption) error
}

type OSOSubscriptionService

type OSOSubscriptionService interface {
	LoadOSOSubscriptionStatus(ctx context.Context, token oauth2.Token) (string, error)
	DeactivateUser(ctx context.Context, username string) error
}

type OrganizationService

type OrganizationService interface {
	CreateOrganization(ctx context.Context, creatorIdentityID uuid.UUID, organizationName string) (*uuid.UUID, error)
	ListOrganizations(ctx context.Context, identityID uuid.UUID) ([]authorization.IdentityAssociation, error)
}

type PermissionService

type PermissionService interface {
	HasScope(ctx context.Context, identityID uuid.UUID, resourceID string, scopeName string) (bool, error)
	RequireScope(ctx context.Context, identityID uuid.UUID, resourceID string, scopeName string) error
}

type PrivilegeCacheService

type PrivilegeCacheService interface {
	CachedPrivileges(ctx context.Context, identityID uuid.UUID, resourceID string) (*permission.PrivilegeCache, error)
}

type ResourceService

type ResourceService interface {
	Delete(ctx context.Context, resourceID string) error
	Read(ctx context.Context, resourceID string) (*app.Resource, error)
	CheckExists(ctx context.Context, resourceID string) error
	Register(ctx context.Context, resourceTypeName string, resourceID, parentResourceID *string, identity *uuid.UUID) (*resource.Resource, error)
	FindWithRoleByResourceTypeAndIdentity(ctx context.Context, resourceType string, identityID uuid.UUID) ([]string, error)
}

type RoleManagementService

type RoleManagementService interface {
	ListByResource(ctx context.Context, currentIdentity uuid.UUID, resourceID string) ([]rolerepo.IdentityRole, error)
	ListAvailableRolesByResourceType(ctx context.Context, resourceType string) ([]role.RoleDescriptor, error)
	ListByResourceAndRoleName(ctx context.Context, currentIdentity uuid.UUID, resourceID string, roleName string) ([]rolerepo.IdentityRole, error)
	Assign(ctx context.Context, assignedBy uuid.UUID, roleAssignments map[string][]uuid.UUID, resourceID string, appendToExistingRoles bool) error
	ForceAssign(ctx context.Context, assignedTo uuid.UUID, roleName string, res resource.Resource) error
	RevokeResourceRoles(ctx context.Context, currentIdentity uuid.UUID, identities []uuid.UUID, resourceID string) error
}

type Services

type Services interface {
	AuthenticationProviderService() AuthenticationProviderService
	CheService() CheService
	ClusterService() ClusterService
	InvitationService() InvitationService
	LinkService() LinkService
	LogoutService() LogoutService
	NotificationService() NotificationService
	AdminConsoleService() AdminConsoleService
	OrganizationService() OrganizationService
	OSOSubscriptionService() OSOSubscriptionService
	PermissionService() PermissionService
	PrivilegeCacheService() PrivilegeCacheService
	ResourceService() ResourceService
	RoleManagementService() RoleManagementService
	SpaceService() SpaceService
	TeamService() TeamService
	TenantService() TenantService
	TokenService() TokenService
	UserProfileService() UserProfileService
	UserService() UserService
}

Services creates instances of service layer objects

type SpaceService

type SpaceService interface {
	CreateSpace(ctx context.Context, spaceCreatorIdentityID uuid.UUID, spaceID string) error
	DeleteSpace(ctx context.Context, byIdentityID uuid.UUID, spaceID string) error
}

type TeamService

type TeamService interface {
	CreateTeam(ctx context.Context, identityID uuid.UUID, spaceID string, teamName string) (*uuid.UUID, error)
	ListTeamsInSpace(ctx context.Context, identityID uuid.UUID, spaceID string) ([]account.Identity, error)
	ListTeamsForIdentity(ctx context.Context, identityID uuid.UUID) ([]authorization.IdentityAssociation, error)
}

type TenantService

type TenantService interface {
	Init(ctx context.Context) error
	Delete(ctx context.Context, identityID uuid.UUID) error
	View(ctx context.Context) (*tenant.TenantSingle, error)
}

TenantService represents the Tenant service

type TokenService

type TokenService interface {
	Audit(ctx context.Context, identity *account.Identity, tokenString string, resourceID string) (*string, error)
	CleanupExpiredTokens(ctx context.Context) error
	DeleteExternalToken(ctx context.Context, currentIdentity uuid.UUID, authURL string, forResource string) error
	ExchangeRefreshToken(ctx context.Context, refreshToken string, rptToken string) (*manager.TokenSet, error)
	RegisterToken(ctx context.Context, identityID uuid.UUID, tokenString string, tokenType string, privileges []tokenrepo.TokenPrivilege) (*tokenrepo.Token, error)
	RetrieveExternalToken(ctx context.Context, forResource string, req *goa.RequestData, forcePull *bool) (*app.ExternalToken, *string, error)
	SetStatusForAllIdentityTokens(ctx context.Context, identityID uuid.UUID, status int) error
	ValidateToken(ctx context.Context, tkn *jwt.Token) error
}

type UserProfileService

type UserProfileService interface {
	Get(ctx context.Context, accessToken string, profileURL string) (*provider.OAuthUserProfileResponse, error)
}

type UserService

type UserService interface {
	NotifyIdentitiesBeforeDeactivation(ctx context.Context, now func() time.Time) ([]account.Identity, error)
	ListIdentitiesToDeactivate(ctx context.Context, now func() time.Time) ([]account.Identity, error)
	DeactivateUser(ctx context.Context, username string) (*account.Identity, error)
	BanUser(ctx context.Context, username string) (*account.Identity, error)
	UserInfo(ctx context.Context, identityID uuid.UUID) (*account.User, *account.Identity, error)
	LoadContextIdentityAndUser(ctx context.Context) (*account.Identity, error)
	LoadContextIdentityIfNotBanned(ctx context.Context) (*account.Identity, error)
	ContextIdentityIfExists(ctx context.Context) (uuid.UUID, error)
	IdentityByUsernameAndEmail(ctx context.Context, username, email string) (*account.Identity, error)
	ResetBan(ctx context.Context, user account.User) error
	HardDeleteUser(ctx context.Context, identity account.Identity) error
	RescheduleDeactivation(ctx context.Context, identityID uuid.UUID) error
}

Directories

Path Synopsis
Package base contains the base service struct which service implementations should extend
Package base contains the base service struct which service implementations should extend

Jump to

Keyboard shortcuts

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