Documentation
¶
Index ¶
- Constants
- Variables
- type AuthenticationScheme
- type BulkConfig
- type Email
- type Error
- type Filter
- type FilterConfig
- type Group
- type GroupMutation
- type ListResponse
- type Member
- type Meta
- type Name
- type Optional
- type Page
- type PatchOperation
- type PatchRequest
- type Projection
- type ResourceType
- type ResourceTypeDocument
- type SchemaAttribute
- type SchemaDocument
- type SchemaExtension
- type Service
- func (s *Service) CreateGroup(ctx context.Context, group Group) (Group, error)
- func (s *Service) CreateUser(ctx context.Context, user User) (User, error)
- func (s *Service) DeleteGroup(ctx context.Context, id int64) error
- func (s *Service) DeleteUser(ctx context.Context, id int64) error
- func (s *Service) Group(ctx context.Context, id int64, projection Projection) (Group, error)
- func (s *Service) Groups(ctx context.Context, filter Filter, page Page, projection Projection) (ListResponse[Group], error)
- func (s *Service) PatchGroup(ctx context.Context, id int64, request PatchRequest) (Group, error)
- func (s *Service) PatchUser(ctx context.Context, id int64, request PatchRequest) (User, error)
- func (s *Service) ReplaceGroup(ctx context.Context, id int64, group Group) (Group, error)
- func (s *Service) ReplaceUser(ctx context.Context, id int64, user User) (User, error)
- func (s *Service) User(ctx context.Context, id int64, projection Projection) (User, error)
- func (s *Service) Users(ctx context.Context, filter Filter, page Page, projection Projection) (ListResponse[User], error)
- type ServiceProviderConfigDocument
- type Store
- type Supported
- type User
- type UserMutation
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 BulkConfig ¶
type Error ¶
type Error struct {
Status int `json:"status,string"`
SCIMType string `json:"scimType,omitempty"`
Detail string `json:"detail,omitempty"`
}
func ParseRequestError ¶
func (Error) MarshalJSON ¶
type Filter ¶
type Filter struct{ Attribute, Value string }
func ParseFilter ¶
func ParseFilter(resource ResourceType, raw string) (Filter, error)
type FilterConfig ¶
type Group ¶
type GroupMutation ¶
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 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 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 Service ¶
func (*Service) CreateGroup ¶
func (*Service) CreateUser ¶
func (*Service) Groups ¶
func (s *Service) Groups(ctx context.Context, filter Filter, page Page, projection Projection) (ListResponse[Group], error)
func (*Service) PatchGroup ¶
func (*Service) ReplaceGroup ¶
func (*Service) ReplaceUser ¶
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 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 (*User) UnmarshalJSON ¶
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)
Click to show internal directories.
Click to hide internal directories.