scim

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package scim implements a very basic scim client with utility needed to extract users from IdP Groups A scim client is initialized via it's base url and authentication method. As for now only basic auth is implemented

Index

Constants

View Source
const (
	InitialStartID = "initial"
)

Variables

View Source
var (
	AttrName        = Attribute{/* contains filtered or unexported fields */}
	AttrEmails      = Attribute{/* contains filtered or unexported fields */}
	AttrDisplayName = Attribute{/* contains filtered or unexported fields */}
	AttrActive      = Attribute{/* contains filtered or unexported fields */}
	AttrMembers     = Attribute{/* contains filtered or unexported fields */}
)

Predefined SCIM attributes

Functions

func ReturnDefaultGroupResponseMockServer

func ReturnDefaultGroupResponseMockServer() *httptest.Server

func ReturnUserResponseMockServer

func ReturnUserResponseMockServer() *httptest.Server

func SetAttributes

func SetAttributes(attributes ...Attribute) string

SetAttributes sets a comma-separated string for multiple attributes

Types

type Attribute

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

Attribute represents a SCIM attribute

func AttrCustom

func AttrCustom(name string) Attribute

func (Attribute) String

func (a Attribute) String() string

String returns the attribute string

type AuthType

type AuthType string
const (
	Basic       AuthType = "basic"
	BearerToken AuthType = "token"
)

type BasicAuthConfig

type BasicAuthConfig struct {
	Username string
	Password string
}

type BearerTokenConfig

type BearerTokenConfig struct {
	Token  string
	Header string
	Prefix string
}

type Config

type Config struct {
	URL         string
	AuthType    AuthType
	BasicAuth   *BasicAuthConfig
	BearerToken *BearerTokenConfig
}

type Filter

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

func GroupFilterByDisplayName

func GroupFilterByDisplayName(displayName string) Filter

func UserFilterByGroupDisplayName

func UserFilterByGroupDisplayName(displayName string) Filter

func (Filter) String

func (f Filter) String() string

type ISCIMClient

type ISCIMClient interface {
	GetUsers(ctx context.Context, options *QueryOptions) ([]Resource, error)
	GetGroups(ctx context.Context, options *QueryOptions) ([]Resource, error)
}

func NewSCIMClient

func NewSCIMClient(logger logr.Logger, config *Config) (ISCIMClient, error)

NewSCIMClient - creates a new SCIM client with an auth transport

type QueryOptions

type QueryOptions struct {
	Filter             Filter
	Attributes         string
	ExcludedAttributes string
	StartID            string
}

type Resource

type Resource struct {
	ID          string        `json:"id"`
	Meta        ResourceMeta  `json:"meta"`
	UserName    string        `json:"userName"`
	Name        UserNameField `json:"name"`
	DisplayName string        `json:"displayName"`
	Active      bool          `json:"active"`
	Emails      []UserEmails  `json:"emails"`
}

func (Resource) ActiveUser

func (r Resource) ActiveUser() bool

func (Resource) FirstName

func (r Resource) FirstName() string

func (Resource) LastName

func (r Resource) LastName() string

func (Resource) PrimaryEmail

func (r Resource) PrimaryEmail() string

type ResourceMeta

type ResourceMeta struct {
	Location     string `json:"location"`
	Version      string `json:"version"`
	ResourceType string `json:"resourceType"`
}

type ResponseBody

type ResponseBody struct {
	TotalResults int        `json:"totalResults"`
	ItemsPerPage int        `json:"itemsPerPage"`
	Resources    []Resource `json:"Resources"`
	StartID      string     `json:"startId"`
	NextID       string     `json:"nextId"`
}

type UserEmails

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

type UserNameField

type UserNameField struct {
	FamilyName string `json:"familyName"`
	GivenName  string `json:"givenName"`
}

Jump to

Keyboard shortcuts

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