Documentation
¶
Overview ¶
Package scimtest is an in-memory example SCIM server used by tests and as a usage example for github.com/singlestore-labs/scim.
Index ¶
- Constants
- Variables
- type CoreGroup
- type CoreUser
- type Email
- type Entitlement
- type Group
- type Name
- type Role
- type SCIMGroup
- type SCIMGroupID
- type SCIMGroupMember
- type SCIMID
- type SCIMMeta
- type SCIMUser
- type SCIMUserDBJSONFields
- type SCIMUserID
- type Server
- func (h Server) Authorization(inner func() error, r *http.Request) error
- func (h Server) BulkHandler() (nvelope.Response, error)
- func (h Server) DeleteResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, ...) (nvelope.Response, error)
- func (h Server) GetResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, ...) (nvelope.Response, error)
- func (h Server) GetResourceListHandler(r *http.Request, resourceType scimprotocol.ResourceType, ...) (nvelope.Response, error)
- func (h Server) GetResourceTypes() []scimprotocol.ResourceType
- func (h Server) GetResourceTypesHandler() (nvelope.Response, error)
- func (h Server) GetServiceProviderConfigHandler(r *http.Request, w http.ResponseWriter) (nvelope.Response, error)
- func (h Server) PatchResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, ...) (nvelope.Response, error)
- func (h Server) PostResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, ...) (nvelope.Response, error)
- func (h Server) SchemasHandler() (resp nvelope.Response, err error)
- func (h Server) UpdateResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, ...) (nvelope.Response, error)
- type Storage
- func (s *Storage) CreateSCIMGroup(ctx context.Context, _ string, group SCIMGroup) (SCIMGroup, error)
- func (s *Storage) CreateSCIMUser(ctx context.Context, _ string, user SCIMUser) (SCIMUser, error)
- func (s *Storage) DeleteSCIMGroup(ctx context.Context, _ string, id string) error
- func (s *Storage) DeleteSCIMUser(ctx context.Context, _ string, id string) error
- func (s Storage) GetAllSCIMGroup(ctx context.Context, _ string) ([]SCIMGroup, error)
- func (s Storage) GetAllSCIMUser(ctx context.Context, _ string) ([]SCIMUser, error)
- func (s Storage) GetSCIMGroup(ctx context.Context, _ string, id string) (SCIMGroup, error)
- func (s Storage) GetSCIMUser(ctx context.Context, _ string, userID string) (SCIMUser, error)
- func (s *Storage) UpdateSCIMGroup(ctx context.Context, _ string, id string, group SCIMGroup) (SCIMGroup, error)
- func (s *Storage) UpdateSCIMUser(ctx context.Context, _ string, id string, user SCIMUser) (SCIMUser, error)
- type TeamID
- type UserID
Constants ¶
View Source
const DummyToken = "dummyToken"
Variables ¶
View Source
var ExampleFullUserJSON []byte
View Source
var ExampleUserCore = SCIMUser{ CoreUser: CoreUser{ Active: true, DisplayName: "Babs Jensen", Emails: []Email{ { Value: "bjensen@example.com", Type: "work", Primary: true, }, { Value: "babs@jensen.org", Type: "home", }, }, ExternalID: "701984", Groups: []Group{ { Value: "e9e30dba-f08f-4109-8486-d5c6a331660a", Ref: "https://example.com/v2/Groups/e9e30dba-f08f-4109-8486-d5c6a331660a", Display: "Tour Guides", }, { Value: "fc348aa8-3835-40eb-a20b-c726e15c55b5", Ref: "https://example.com/v2/Groups/fc348aa8-3835-40eb-a20b-c726e15c55b5", Display: "Employees", }, { Value: "71ddacd2-a8e7-49b8-a5db-ae50d0a5bfd7", Ref: "https://example.com/v2/Groups/71ddacd2-a8e7-49b8-a5db-ae50d0a5bfd7", Display: "US Employees", }, }, ID: "2819c223-7f76-453a-919d-413861904646", Name: Name{ Formatted: "Ms. Barbara J Jensen, III", FamilyName: "Jensen", GivenName: "Barbara", MiddleName: "Jane", HonorificPrefix: "Ms.", HonorificSuffix: "III", }, Timezone: "America/Los_Angeles", Title: "Tour Guide", UserName: "bjensen@example.com", UserType: "Employee", }, }
View Source
var ExampleUserCoreJSON []byte
View Source
var ExampleUserWithExtension = SCIMUser{ CoreUser: CoreUser{ Active: true, DisplayName: "Babs Jensen", Emails: []Email{ { Value: "bjensen@example.com", Type: "work", Primary: true, }, { Value: "babs@jensen.org", Type: "home", }, }, ExternalID: "701984", Groups: []Group{ { Value: "e9e30dba-f08f-4109-8486-d5c6a331660a", Ref: "https://example.com/v2/Groups/e9e30dba-f08f-4109-8486-d5c6a331660a", Display: "Tour Guides", }, { Value: "fc348aa8-3835-40eb-a20b-c726e15c55b5", Ref: "https://example.com/v2/Groups/fc348aa8-3835-40eb-a20b-c726e15c55b5", Display: "Employees", }, { Value: "71ddacd2-a8e7-49b8-a5db-ae50d0a5bfd7", Ref: "https://example.com/v2/Groups/71ddacd2-a8e7-49b8-a5db-ae50d0a5bfd7", Display: "US Employees", }, }, ID: "2819c223-7f76-453a-919d-413861904646", Name: Name{ Formatted: "Ms. Barbara J Jensen, III", FamilyName: "Jensen", GivenName: "Barbara", MiddleName: "Jane", HonorificPrefix: "Ms.", HonorificSuffix: "III", }, Timezone: "America/Los_Angeles", Title: "Tour Guide", UserName: "bjensen@example.com", UserType: "Employee", }, }
View Source
var ExampleUserWithExtensionJSON []byte
Functions ¶
This section is empty.
Types ¶
type CoreGroup ¶
type CoreGroup struct {
ID string `scim:"id,mutability=readOnly,returned=always,ignoreUnmarshal"`
ExternalID string `scim:"externalId"`
DisplayName string `scim:"displayName"`
Members []SCIMGroupMember `scim:"members"`
}
type CoreUser ¶
type CoreUser struct {
Active bool `scim:"active,returned=keepEmpty"`
DisplayName string `scim:"displayName,caseExact"`
Emails []Email `scim:"emails"`
Entitlements []Entitlement `scim:"entitlements"`
ExternalID string `scim:"externalId"`
Groups []Group `scim:"groups,mutability=readOnly"`
ID string `scim:"id,mutability=readOnly,returned=always,ignoreUnmarshal"`
Name Name `scim:"name"`
PreferredLanguage string `scim:"preferredLanguage"`
Roles []Role `scim:"roles"`
Timezone string `scim:"timezone"`
Title string `scim:"title"`
UserName string `scim:"userName,required"`
UserType string `scim:"userType"`
}
type Email ¶
type Entitlement ¶
type Entitlement struct {
Value string `json:"value" scim:"value"`
Display string `json:"display" scim:"display"`
Type string `json:"type" scim:"type,canonicalValues= "` // special canonicalValues to return empty [] in schemas
Primary bool `json:"primary" scim:"primary"`
}
func (*Entitlement) IsEmpty ¶
func (e *Entitlement) IsEmpty() bool
type Name ¶
type Name struct {
Formatted string `json:"formatted" scim:"formatted"`
FamilyName string `json:"familyName" scim:"familyName"`
GivenName string `json:"givenName" scim:"givenName"`
MiddleName string `json:"middleName" scim:"middleName"`
HonorificPrefix string `json:"honorificPrefix" scim:"honorificPrefix"`
HonorificSuffix string `json:"honorificSuffix" scim:"honorificSuffix"`
}
type Role ¶
type SCIMGroup ¶
type SCIMGroup struct {
scimprotocol.SCIMResourceMarker
TeamID TeamID
CoreGroup `scim:"urn:ietf:params:scim:schemas:core:2.0:Group"`
Meta SCIMMeta `scim:"meta,ignoreUnmarshal"`
}
type SCIMGroupID ¶
type SCIMGroupID string
type SCIMGroupMember ¶
type SCIMUser ¶
type SCIMUser struct {
scimprotocol.SCIMResourceMarker
UserID *UserID // non-scim tagged field will not be considered in SCIM related operations like marshal/filter/patch
CoreUser `scim:"urn:ietf:params:scim:schemas:core:2.0:User"` // core schema required to be the first field with a scim tag
Meta SCIMMeta `scim:"meta,ignoreUnmarshal,returned=always"`
}
type SCIMUserDBJSONFields ¶
type SCIMUserID ¶
type SCIMUserID string
type Server ¶
type Server struct {
ResourceTypes []scimprotocol.ResourceType
// contains filtered or unexported fields
}
func (Server) Authorization ¶
func (Server) DeleteResourceHandler ¶
func (h Server) DeleteResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, params scimprotocol.EndpointSCIMIDAndResourceID) (nvelope.Response, error)
func (Server) GetResourceHandler ¶
func (h Server) GetResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, params scimprotocol.EndpointSCIMIDAndResourceID) (nvelope.Response, error)
func (Server) GetResourceListHandler ¶
func (h Server) GetResourceListHandler(r *http.Request, resourceType scimprotocol.ResourceType, params scimprotocol.EndpointSCIMID) (nvelope.Response, error)
func (Server) GetResourceTypes ¶
func (h Server) GetResourceTypes() []scimprotocol.ResourceType
func (Server) GetResourceTypesHandler ¶
func (Server) GetServiceProviderConfigHandler ¶
func (Server) PatchResourceHandler ¶
func (h Server) PatchResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, params scimprotocol.EndpointSCIMIDAndResourceID) (nvelope.Response, error)
func (Server) PostResourceHandler ¶
func (h Server) PostResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, params scimprotocol.EndpointSCIMID) (nvelope.Response, error)
func (Server) UpdateResourceHandler ¶
func (h Server) UpdateResourceHandler(r *http.Request, resourceType scimprotocol.ResourceType, params scimprotocol.EndpointSCIMIDAndResourceID) (nvelope.Response, error)
type Storage ¶
type Storage struct {
Users map[SCIMUserID]SCIMUser
Groups map[SCIMGroupID]SCIMGroup
}
In-memory storage for SCIM users and groups we don't care SCIMID in in-memory storage for testing purpose
func NewInMemStorage ¶
func NewInMemStorage() *Storage
func (*Storage) CreateSCIMGroup ¶
func (*Storage) CreateSCIMUser ¶
func (*Storage) DeleteSCIMGroup ¶
func (*Storage) DeleteSCIMUser ¶
func (Storage) GetAllSCIMGroup ¶
func (Storage) GetAllSCIMUser ¶
func (Storage) GetSCIMGroup ¶
func (Storage) GetSCIMUser ¶
func (*Storage) UpdateSCIMGroup ¶
Click to show internal directories.
Click to hide internal directories.