controllers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package controllers adds support for RESTful endpoints.

Index

Constants

View Source
const (
	UserSchemaURI           SCIMSchemaURI = "urn:ietf:params:scim:schemas:core:2.0:User"
	UserEnterpriseSchemaURI SCIMSchemaURI = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
	GroupSchemaURI          SCIMSchemaURI = "urn:ietf:params:scim:schemas:core:2.0:Group"
	ListSchemaURI           SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:ListResponse"
	UpdateSchemaURI         SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:PatchOp"
	ErrorSchemaURI          SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:Error"

	UserResourceType  SCIMResourceType = "User"
	GroupResourceType SCIMResourceType = "Group"
)

SCIMSchemaURI constants are used to indicate the schema type. SCIMResourceType constants are used to indicate the resource type being returned.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	// RegisterRoutes adds controller handlers to the router
	RegisterRoutes(router chi.Router)
}

Controller encapsulates the logic for registering handler functions

func NewHealthController

func NewHealthController(respWriter response.Writer) Controller

NewHealthController creates an instance of HealthController

func NewOIDCController

func NewOIDCController(respWriter response.Writer, jwsProvider jws.Provider, phobosAPIURL string) Controller

NewOIDCController creates an instance of oidcController

func NewPluginRegistryController

func NewPluginRegistryController(
	logger logger.Logger,
	respWriter response.Writer,
	jwtAuthMiddleware middleware.Handler,
	pluginRegistryService pluginregistry.Service,
) Controller

NewPluginRegistryController creates a new instance of the pluginRegistryController

func NewSCIMController

func NewSCIMController(
	logger logger.Logger,
	respWriter response.Writer,
	jwtAuthMiddleware middleware.Handler,
	userService user.Service,
	teamService team.Service,
	scimService scim.Service,
) Controller

NewSCIMController creates an instance of scimController

func NewServiceDiscoveryController

func NewServiceDiscoveryController(logger logger.Logger, respWriter response.Writer, apiURL, port string) (Controller, error)

NewServiceDiscoveryController returns a new discoveryHandler.

func NewVCSController

func NewVCSController(
	logger logger.Logger,
	respWriter response.Writer,
	authenticator *auth.Authenticator,
	vcsService vcs.Service,
) Controller

NewVCSController creates an instance of vcsController.

type CreateSCIMGroupRequest

type CreateSCIMGroupRequest struct {
	DisplayName string          `json:"displayName"`
	ExternalID  string          `json:"externalId"`
	Schemas     []SCIMSchemaURI `json:"schemas"`
}

CreateSCIMGroupRequest represents a SCIM create group (Team) request.

type CreateSCIMUserRequest

type CreateSCIMUserRequest struct {
	ExternalID string          `json:"externalId"`
	Emails     []SCIMEmail     `json:"emails"`
	Schemas    []SCIMSchemaURI `json:"schemas"`
	Active     bool            `json:"active"`
}

CreateSCIMUserRequest represents a SCIM create user request.

type SCIMEmail

type SCIMEmail struct {
	Type    string `json:"type"`
	Value   string `json:"value"`
	Primary bool   `json:"primary"`
}

SCIMEmail represents a SCIM user email.

type SCIMGroup

type SCIMGroup struct {
	Metadata    SCIMMetadata    `json:"meta"`
	ID          string          `json:"id"`
	ExternalID  string          `json:"externalId"`
	DisplayName string          `json:"displayName"`
	SchemaURIs  []SCIMSchemaURI `json:"schemas"`
}

SCIMGroup represents a SCIM group resource.

func PhobosTeamToSCIMGroup

func PhobosTeamToSCIMGroup(team *models.Team) *SCIMGroup

PhobosTeamToSCIMGroup converts from Phobos team to a SCIMGroup.

type SCIMListResponse

type SCIMListResponse struct {
	SchemaURIs   []SCIMSchemaURI `json:"schemas"`
	Resources    []interface{}   `json:"Resources"`
	TotalResults int             `json:"totalResults"`
	StartIndex   int             `json:"startIndex"`
	ItemsPerPage int             `json:"itemsPerPage"`
}

SCIMListResponse is a SCIM list response.

type SCIMMetadata

type SCIMMetadata struct {
	CreatedAt    *time.Time       `json:"created,omitempty"`
	LastModified *time.Time       `json:"lastModified,omitempty"`
	ResourceType SCIMResourceType `json:"resourceType"`
}

SCIMMetadata is the metadata for SCIM resources.

type SCIMOperation

type SCIMOperation struct {
	Value interface{} `json:"value"`
	OP    string      `json:"op"`
	Path  string      `json:"path"`
}

SCIMOperation represents a SCIM PATCH request operation.

type SCIMResourceType

type SCIMResourceType string

SCIMResourceType represents a SCIM resource type.

type SCIMSchemaURI

type SCIMSchemaURI string

SCIMSchemaURI defines the SchemaURI used by SCIM resources. See: https://www.rfc-editor.org/rfc/rfc7644#section-8.2.

type SCIMUpdateRequest

type SCIMUpdateRequest struct {
	Schemas    []SCIMSchemaURI `json:"schemas"`
	Operations []SCIMOperation `json:"operations"`
}

SCIMUpdateRequest represents a SCIM update request.

type SCIMUser

type SCIMUser struct {
	SchemaURIs []SCIMSchemaURI `json:"schemas"`
	ID         string          `json:"id"`
	ExternalID string          `json:"externalId"`
	Metadata   SCIMMetadata    `json:"meta"`
	Username   string          `json:"userName"`
	Emails     []SCIMEmail     `json:"emails"`
	Active     bool            `json:"active"`
}

SCIMUser represents a SCIM user resource.

func PhobosUserToSCIMUser

func PhobosUserToSCIMUser(user *models.User) *SCIMUser

PhobosUserToSCIMUser converts a Phobos user to a SCIM user.

type ScimErrorResponse

type ScimErrorResponse struct {
	Detail     string          `json:"detail"`
	Status     string          `json:"status"`
	SchemaURIs []SCIMSchemaURI `json:"schemas"`
}

ScimErrorResponse is the SCIM specific error response.

Jump to

Keyboard shortcuts

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