scim

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	UserSchema  = "urn:ietf:params:scim:schemas:core:2.0:User"
	GroupSchema = "urn:ietf:params:scim:schemas:core:2.0:Group"
	ListSchema  = "urn:ietf:params:scim:api:messages:2.0:ListResponse"
	PatchSchema = "urn:ietf:params:scim:api:messages:2.0:PatchOp"
	ErrorSchema = "urn:ietf:params:scim:api:messages:2.0:Error"
)

Variables

View Source
var (
	ErrUniqueness         = errors.New("scim uniqueness conflict")
	ErrInvalidMember      = errors.New("scim member does not exist")
	ErrNoTarget           = errors.New("scim patch target does not exist")
	ErrFinalAdministrator = errors.New("cannot remove the final active administrator")
)
View Source
var ErrPasswordNotSupported = errors.New("scim password is not supported")

Functions

This section is empty.

Types

type AuthenticationScheme

type AuthenticationScheme struct {
	Type        string `json:"type"`
	Name        string `json:"name"`
	Description string `json:"description"`
	SpecURI     string `json:"specUri"`
	Primary     bool   `json:"primary"`
}

type BulkConfig

type BulkConfig struct {
	Supported      bool `json:"supported"`
	MaxOperations  int  `json:"maxOperations"`
	MaxPayloadSize int  `json:"maxPayloadSize"`
}

type Email

type Email struct {
	Value   string `json:"value"`
	Type    string `json:"type,omitempty"`
	Primary bool   `json:"primary,omitempty"`
}

type Error

type Error struct {
	Status   int    `json:"status,string"`
	SCIMType string `json:"scimType,omitempty"`
	Detail   string `json:"detail,omitempty"`
}

func ParseRequestError

func ParseRequestError(err error) (Error, bool)

func (Error) Error

func (e Error) Error() string

func (Error) MarshalJSON

func (e Error) MarshalJSON() ([]byte, error)

type Filter

type Filter struct{ Attribute, Value string }

func ParseFilter

func ParseFilter(resource ResourceType, raw string) (Filter, error)

type FilterConfig

type FilterConfig struct {
	Supported  bool `json:"supported"`
	MaxResults int  `json:"maxResults"`
}

type Group

type Group struct {
	Schemas     []string `json:"schemas"`
	ID          string   `json:"id,omitempty"`
	ExternalID  string   `json:"externalId,omitempty"`
	DisplayName string   `json:"displayName,omitempty"`
	Members     []Member `json:"members,omitempty"`
	Meta        Meta     `json:"meta"`
}

func NewGroup

func NewGroup() Group

type GroupMutation

type GroupMutation struct {
	ReplaceMembers            *[]int64
	AddMembers, RemoveMembers []int64
}

func ParseGroupPatch

func ParseGroupPatch(request PatchRequest) (GroupMutation, error)

type ListResponse

type ListResponse[T any] struct {
	Schemas      []string `json:"schemas"`
	TotalResults int      `json:"totalResults"`
	StartIndex   int      `json:"startIndex"`
	ItemsPerPage int      `json:"itemsPerPage"`
	Resources    []T      `json:"Resources"`
}

func NewListResponse

func NewListResponse[T any](resources []T, totalResults, startIndex int) ListResponse[T]

func ResourceTypes

func ResourceTypes() ListResponse[ResourceTypeDocument]

func Schemas

func Schemas() ListResponse[SchemaDocument]

type Member

type Member struct {
	Value   string `json:"value"`
	Ref     string `json:"$ref,omitempty"`
	Display string `json:"display,omitempty"`
}

type Meta

type Meta struct {
	ResourceType string `json:"resourceType"`
	Created      string `json:"created,omitempty"`
	LastModified string `json:"lastModified,omitempty"`
	Location     string `json:"location,omitempty"`
}

type Name

type Name struct {
	Formatted       string `json:"formatted,omitempty"`
	FamilyName      string `json:"familyName,omitempty"`
	GivenName       string `json:"givenName,omitempty"`
	MiddleName      string `json:"middleName,omitempty"`
	HonorificPrefix string `json:"honorificPrefix,omitempty"`
	HonorificSuffix string `json:"honorificSuffix,omitempty"`
}

type Optional

type Optional[T any] struct {
	Set   bool
	Value T
}

type Page

type Page struct{ StartIndex, Count int }

func ParsePage

func ParsePage(values url.Values, max int) (Page, error)

type PatchOperation

type PatchOperation struct {
	Op    string          `json:"op"`
	Path  string          `json:"path,omitempty"`
	Value json.RawMessage `json:"value,omitempty"`
}

type PatchRequest

type PatchRequest struct {
	Schemas    []string         `json:"schemas"`
	Operations []PatchOperation `json:"Operations"`
}

func NewPatchRequest

func NewPatchRequest(operations []PatchOperation) PatchRequest

type Projection

type Projection struct {
	Include, Exclude map[string]bool
	// contains filtered or unexported fields
}

func ParseProjection

func ParseProjection(values url.Values, resource ResourceType) (Projection, error)

type ResourceType

type ResourceType string
const (
	ResourceUsers  ResourceType = "Users"
	ResourceGroups ResourceType = "Groups"
)

type ResourceTypeDocument

type ResourceTypeDocument struct {
	Schemas          []string          `json:"schemas"`
	ID               string            `json:"id"`
	Name             string            `json:"name"`
	Endpoint         string            `json:"endpoint"`
	Description      string            `json:"description"`
	Schema           string            `json:"schema"`
	SchemaExtensions []SchemaExtension `json:"schemaExtensions"`
}

func ResourceTypeByID

func ResourceTypeByID(id string) (ResourceTypeDocument, bool)

type SchemaAttribute

type SchemaAttribute struct {
	Name            string            `json:"name"`
	Type            string            `json:"type"`
	MultiValued     bool              `json:"multiValued"`
	Description     string            `json:"description"`
	Required        bool              `json:"required"`
	CaseExact       bool              `json:"caseExact"`
	Mutability      string            `json:"mutability"`
	Returned        string            `json:"returned"`
	Uniqueness      string            `json:"uniqueness"`
	CanonicalValues []string          `json:"canonicalValues,omitempty"`
	SubAttributes   []SchemaAttribute `json:"subAttributes,omitempty"`
	ReferenceTypes  []string          `json:"referenceTypes,omitempty"`
}

type SchemaDocument

type SchemaDocument struct {
	Schemas     []string          `json:"schemas"`
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Attributes  []SchemaAttribute `json:"attributes"`
}

func Schema

func Schema(id string) (SchemaDocument, bool)

type SchemaExtension

type SchemaExtension struct {
	Schema   string `json:"schema"`
	Required bool   `json:"required"`
}

type Service

type Service struct {
	Store      Store
	Audit      audit.Recorder
	BaseURL    string
	MaxResults int
}

func (*Service) CreateGroup

func (s *Service) CreateGroup(ctx context.Context, group Group) (Group, error)

func (*Service) CreateUser

func (s *Service) CreateUser(ctx context.Context, user User) (User, error)

func (*Service) DeleteGroup

func (s *Service) DeleteGroup(ctx context.Context, id int64) error

func (*Service) DeleteUser

func (s *Service) DeleteUser(ctx context.Context, id int64) error

func (*Service) Group

func (s *Service) Group(ctx context.Context, id int64, projection Projection) (Group, error)

func (*Service) Groups

func (s *Service) Groups(ctx context.Context, filter Filter, page Page, projection Projection) (ListResponse[Group], error)

func (*Service) PatchGroup

func (s *Service) PatchGroup(ctx context.Context, id int64, request PatchRequest) (Group, error)

func (*Service) PatchUser

func (s *Service) PatchUser(ctx context.Context, id int64, request PatchRequest) (User, error)

func (*Service) ReplaceGroup

func (s *Service) ReplaceGroup(ctx context.Context, id int64, group Group) (Group, error)

func (*Service) ReplaceUser

func (s *Service) ReplaceUser(ctx context.Context, id int64, user User) (User, error)

func (*Service) User

func (s *Service) User(ctx context.Context, id int64, projection Projection) (User, error)

func (*Service) Users

func (s *Service) Users(ctx context.Context, filter Filter, page Page, projection Projection) (ListResponse[User], error)

type ServiceProviderConfigDocument

type ServiceProviderConfigDocument struct {
	Schemas               []string               `json:"schemas"`
	Patch                 Supported              `json:"patch"`
	Bulk                  BulkConfig             `json:"bulk"`
	Filter                FilterConfig           `json:"filter"`
	ChangePassword        Supported              `json:"changePassword"`
	Sort                  Supported              `json:"sort"`
	ETag                  Supported              `json:"etag"`
	AuthenticationSchemes []AuthenticationScheme `json:"authenticationSchemes"`
}

func ServiceProviderConfig

func ServiceProviderConfig(maxResults int) ServiceProviderConfigDocument

type Store

type Store interface {
	ListUsers(context.Context, Filter, Page) ([]User, int, error)
	User(context.Context, int64) (User, error)
	CreateUser(context.Context, User) (User, error)
	ReplaceUser(context.Context, int64, User) (User, error)
	PatchUser(context.Context, int64, UserMutation) (User, error)
	DeleteUser(context.Context, int64) error
	ListGroups(context.Context, Filter, Page) ([]Group, int, error)
	Group(context.Context, int64) (Group, error)
	CreateGroup(context.Context, Group) (Group, error)
	ReplaceGroup(context.Context, int64, Group) (Group, error)
	PatchGroup(context.Context, int64, GroupMutation) (Group, error)
	DeleteGroup(context.Context, int64) error
	// contains filtered or unexported methods
}

type Supported

type Supported struct {
	Supported bool `json:"supported"`
}

type User

type User struct {
	Schemas     []string `json:"schemas"`
	ID          string   `json:"id,omitempty"`
	ExternalID  string   `json:"externalId,omitempty"`
	UserName    string   `json:"userName,omitempty"`
	DisplayName string   `json:"displayName,omitempty"`
	Active      *bool    `json:"active,omitempty"`
	Name        Name     `json:"name,omitempty"`
	Emails      []Email  `json:"emails,omitempty"`
	Meta        Meta     `json:"meta"`
}

func NewUser

func NewUser() User

func (*User) UnmarshalJSON

func (u *User) UnmarshalJSON(data []byte) error

type UserMutation

type UserMutation struct {
	Active                Optional[bool]
	UserName, DisplayName Optional[string]
	Name                  Optional[Name]
	Emails                Optional[[]Email]
}

func ParseUserPatch

func ParseUserPatch(request PatchRequest) (UserMutation, error)

Jump to

Keyboard shortcuts

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