core

package
v0.0.0-...-47ace37 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceTypeURI = "urn:ietf:params:scim:schemas:core:2.0:ResourceType"

ResourceTypeURI is the Resource Type Configuration schema used by ResourceType

View Source
const SchemaURI = "urn:ietf:params:scim:schemas:core:2.0:Schema"

SchemaURI is the Schema Definitions Schema used by Schema

View Source
const ServiceProviderConfigURI = "urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"

ServiceProviderConfigURI is the Service Provider Configuration schema used by ServiceProviderConfig

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

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

Attribute describes a single attribute included within a Schema Definition. It includes the characteristics of a SCIM Attribute as per https://tools.ietf.org/html/rfc7643#section-2.2.

func NewAttribute

func NewAttribute() *Attribute

NewAttribute returns a new Attribute filled with defaults

func (*Attribute) Enforce

func (attribute *Attribute) Enforce(data interface{}) (interface{}, error)

Enforce a SCIM simple value by attribute definition

func (*Attribute) Unmarshal

func (attribute *Attribute) Unmarshal(data json.RawMessage) (interface{}, error)

Unmarshal a SCIM simple value by attribute definition

func (*Attribute) UnmarshalJSON

func (a *Attribute) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals an Attribute taking into account defaults

type Attributes

type Attributes []*Attribute

Attributes is a slice of Attribute that holds definitions of attributes included within a Schema Definition.

func Commons

func Commons() Attributes

Commons returns Attributes are considered to be part of every base resource schema and do not use their own "schemas" URI.

func (*Attributes) Enforce

func (attributes *Attributes) Enforce(data map[string]interface{}) (*datatype.Complex, error)

Enforce SCIM Types on data, using attributes definition.

func (Attributes) Some

func (attributes Attributes) Some(f func(attribute *Attribute) bool) Attributes

Some tests whether attributes satisfy f(attribute) and return them.

func (*Attributes) Unmarshal

func (attributes *Attributes) Unmarshal(data map[string]json.RawMessage) (*datatype.Complex, error)

Unmarshal a SCIM a complex value by attributes definition

func (Attributes) WithName

func (attributes Attributes) WithName(name string) *Attribute

WithName returns the *Attribute with the given name, performing a insensitive match. It returns nil if no attribute was found.

type AuthenticationScheme

type AuthenticationScheme struct {
	Type             string `json:"type" validate:"required,eq=oauth|eq=oauth2|eq=oauthbearertoken|eq=httpbasic|eq=httpdigest"`
	Name             string `json:"name" validate:"required"`
	Description      string `json:"description" validate:"required"`
	SpecURI          string `json:"specUri,omitempty" validate:"omitempty,uri"`
	DocumentationURI string `json:"documentationUri,omitempty" validate:"omitempty,uri"`
	Primary          bool   `json:"primary,omitempty" default:"false"`
}

AuthenticationScheme is ...

type CommonAttributes

type CommonAttributes struct {
	Schemas []string `json:"schemas" validate:"gt=0,dive,urn,required" mold:"dive,normurn"`

	// Common attributes
	ID         string `json:"id" validate:"excludes=bulkId,required"`
	ExternalID string `json:"externalId,omitempty"`
	Meta       Meta   `json:"meta" validate:"required"`
}

CommonAttributes represents SCIM Common Attributes as per https://tools.ietf.org/html/rfc7643#section-3.1

func NewCommon

func NewCommon(schema, resourceType, ID string) *CommonAttributes

NewCommon returns a Common filled with schema, resourceType, and ID

func (*CommonAttributes) Common

func (c *CommonAttributes) Common() *CommonAttributes

Common returns CommonAttributes of a SCIM resource

func (*CommonAttributes) ResourceType

func (c *CommonAttributes) ResourceType() *ResourceType

ResourceType returns the ResourceType of a SCIM resource

type Elem

type Elem generic.Type

Elem is generic

type Generic

type Generic generic.Type

Generic is generic

type GenericRepository

type GenericRepository interface {
	Pull(key string) *Elem // (fixme) > evaluate whether make senses to do not return a pointer ...
	Push(elem Elem) (Elem, error)
	PushFromFile(filename string) (Elem, error)
	PushFromData(data []byte) (Elem, error)
	List() []Elem
	Clean()
}

GenericRepository is the ...

func GetGenericRepository

func GetGenericRepository() GenericRepository

GetGenericRepository is a singleton repository for core schemas

type Identifiable

type Identifiable interface {
	GetIdentifier() string
}

Identifiable ...

type IncompatibleTypeError

type IncompatibleTypeError struct {
	// contains filtered or unexported fields
}

A IncompatibleTypeError is a SCIM error describing when a value is not compatible with attribute type.

func (*IncompatibleTypeError) Error

func (e *IncompatibleTypeError) Error() string

type Meta

type Meta struct {
	Location     string     `json:"location,omitempty" validate:"omitempty,uri"`
	ResourceType string     `json:"resourceType" validate:"required"`
	Created      *time.Time `json:"created,omitempty"`
	LastModified *time.Time `json:"lastModified,omitempty"`
	Version      string     `json:"version,omitempty"`
}

Meta ...

type ResourceType

type ResourceType struct {
	CommonAttributes
	Name             string            `json:"name" validate:"required"`
	Endpoint         string            `json:"endpoint" validate:"startswith=/,required"`
	Description      string            `json:"description,omitempty"`
	Schema           string            `json:"schema" validate:"urn,required" mold:"normurn"`
	SchemaExtensions []SchemaExtension `json:"schemaExtensions,omitempty" validate:"dive"`
}

ResourceType is a structured resource for "urn:ietf:params:scim:schemas:core:2.0:ResourceType"

func NewResourceType

func NewResourceType(schema, resourceType string) *ResourceType

NewResourceType returns a ResourceType filled with min values set which identify a particular schema and resourceType (eg. User)

func (ResourceType) GetIdentifier

func (rt ResourceType) GetIdentifier() string

GetIdentifier ...

func (ResourceType) GetSchema

func (rt ResourceType) GetSchema() *Schema

GetSchema returns the resource Schema, if any.

func (ResourceType) GetSchemaExtensions

func (rt ResourceType) GetSchemaExtensions() map[string]*Schema

GetSchemaExtensions returns a map of resource's extensions Schema(s) indexed by URN

func (ResourceType) GetSchemas

func (rt ResourceType) GetSchemas() (map[string]*Schema, error)

GetSchemas returns a map containing all the Schema(s) indexed by URN

type ResourceTypeRepository

type ResourceTypeRepository interface {
	Pull(key string) *ResourceType // (fixme) > evaluate whether make senses to do not return a pointer ...
	Push(elem ResourceType) (ResourceType, error)
	PushFromFile(filename string) (ResourceType, error)
	PushFromData(data []byte) (ResourceType, error)
	List() []ResourceType
	Clean()
}

ResourceTypeRepository is the ...

func GetResourceTypeRepository

func GetResourceTypeRepository() ResourceTypeRepository

GetResourceTypeRepository is a singleton repository for core schemas

type ResourceTyper

type ResourceTyper interface {
	ResourceType() *ResourceType
	Common() *CommonAttributes
}

ResourceTyper is the interface implemented by types representing a SCIM resource which embed CommonAttributes and can return the related ResourceType

type Schema

type Schema struct {
	CommonAttributes
	Name        string     `json:"name,omitempty"`
	Description string     `json:"description,omitempty"`
	Attributes  Attributes `json:"attributes,omitempty" validate:"uniqueattr=Name"`
}

Schema is a structured resource for "urn:ietf:params:scim:schemas:core:2.0:Schema"

func NewSchema

func NewSchema(id, name string) *Schema

NewSchema returns a new Schema filled with defaults

func (*Schema) Enforce

func (schema *Schema) Enforce(data map[string]interface{}) (*datatype.Complex, error)

Enforce SCIM Types on data, using schema definition.

func (Schema) GetIdentifier

func (s Schema) GetIdentifier() string

GetIdentifier ...

func (*Schema) Unmarshal

func (schema *Schema) Unmarshal(data map[string]json.RawMessage) (*datatype.Complex, error)

Unmarshal SCIM values by schema definition

type SchemaError

type SchemaError struct {
	// contains filtered or unexported fields
}

A SchemaError is a description of a SCIM error.

func (*SchemaError) Error

func (e *SchemaError) Error() string

type SchemaExtension

type SchemaExtension struct {
	Schema   string `json:"schema" validate:"urn,required" mold:"normurn"`
	Required bool   `json:"required"`
}

SchemaExtension ...

type SchemaRepository

type SchemaRepository interface {
	Pull(key string) *Schema // (fixme) > evaluate whether make senses to do not return a pointer ...
	Push(elem Schema) (Schema, error)
	PushFromFile(filename string) (Schema, error)
	PushFromData(data []byte) (Schema, error)
	List() []Schema
	Clean()
}

SchemaRepository is the ...

func GetSchemaRepository

func GetSchemaRepository() SchemaRepository

GetSchemaRepository is a singleton repository for core schemas

type ScimError

type ScimError struct {
	Msg string // description of error
}

A ScimError is a description of a SCIM error.

func (ScimError) Error

func (e ScimError) Error() string

type ServiceProviderConfig

type ServiceProviderConfig struct {
	Schemas               []string               `json:"schemas" validate:"gt=0,dive,urn,required" mold:"dive,normurn"`
	Meta                  Meta                   `json:"meta" validate:"required"`
	DocumentationURI      string                 `json:"documentationUri,omitempty" validate:"omitempty,uri"`
	Patch                 supported              `json:"patch" validate:"required"`
	Bulk                  bulk                   `json:"bulk" validate:"required"`
	Filter                filter                 `json:"filter" validate:"required"`
	ChangePassword        supported              `json:"changePassword" validate:"required"`
	Sort                  supported              `json:"sort" validate:"required"`
	Etag                  supported              `json:"etag" validate:"required"`
	AuthenticationSchemes []AuthenticationScheme `json:"authenticationSchemes" validate:"required"`
}

ServiceProviderConfig is a structured resource for "urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"

func NewServiceProviderConfig

func NewServiceProviderConfig() *ServiceProviderConfig

NewServiceProviderConfig returns a new ServiceProviderConfig filled with defaults

func (*ServiceProviderConfig) UnmarshalJSON

func (spc *ServiceProviderConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals an Attribute taking into account defaults

Jump to

Keyboard shortcuts

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