legacyscim

package
v2.36.10 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: AGPL-3.0 Imports: 24 Imported by: 1 module, 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

Overview

Package legacyscim preserves the old imulab/go-scim based SCIM handler. It was added in May 2026 to keep an opt-out path available during the rollout of the new SCIM 2.0 implementation in enterprise/coderd/scim. Once that implementation has run in production for a while and the CODER_SCIM_USE_LEGACY default is flipped, remove this package in its entirety.

Enabled via the UseLegacySCIM option.

Deprecated: Use the enterprise/coderd/scim package instead.

Index

Constants

This section is empty.

Variables

View Source
var SCIMAuditAdditionalFields = map[string]string{
	"automatic_actor":     "coder",
	"automatic_subsystem": "scim",
}

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"`
	DocURI      string `json:"documentationUri"`
}

type BulkSupported

type BulkSupported struct {
	Supported  bool `json:"supported"`
	MaxOp      int  `json:"maxOperations"`
	MaxPayload int  `json:"maxPayloadSize"`
}

type FilterSupported

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

type HTTPError

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

HTTPError wraps a *spec.Error for correct usage with 'handlerutil.WriteError'. This error type is cursed to be absolutely strange and specific to the SCIM library we use.

The library expects *spec.Error to be returned on unwrap, and the internal error description to be returned by a json.Marshal of the top level error.

func NewHTTPError

func NewHTTPError(status int, eType string, err error) *HTTPError

func (HTTPError) Error

func (e HTTPError) Error() string

func (HTTPError) MarshalJSON

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

func (HTTPError) Unwrap

func (e HTTPError) Unwrap() error

type LegacyServer

type LegacyServer struct {
	Logger     slog.Logger
	Database   database.Store
	IDPSync    idpsync.IDPSync
	AGPL       *agpl.API
	AccessURL  *url.URL
	SCIMAPIKey []byte
	Auditor    *atomic.Pointer[audit.Auditor]
}

LegacyServer is the old SCIM handler implementation, kept for backward compatibility. It uses the imulab/go-scim library and custom JSON handling.

func (*LegacyServer) AuthMiddleware

func (s *LegacyServer) AuthMiddleware(next http.Handler) http.Handler

AuthMiddleware verifies the SCIM Bearer token.

func (*LegacyServer) Handler

func (s *LegacyServer) Handler() http.Handler

Handler returns an http.Handler that serves the legacy SCIM endpoints. It should be mounted at /scim/v2.

type SCIMUser

type SCIMUser struct {
	Schemas  []string `json:"schemas"`
	ID       string   `json:"id"`
	UserName string   `json:"userName"`
	Name     struct {
		GivenName  string `json:"givenName"`
		FamilyName string `json:"familyName"`
	} `json:"name"`
	Emails []struct {
		Primary bool   `json:"primary"`
		Value   string `json:"value" format:"email"`
		Type    string `json:"type"`
		Display string `json:"display"`
	} `json:"emails"`
	// Active is a ptr to prevent the empty value from being interpreted as false.
	Active *bool         `json:"active"`
	Groups []interface{} `json:"groups"`
	Meta   struct {
		ResourceType string `json:"resourceType"`
	} `json:"meta"`
}

We currently use our own struct instead of using the SCIM package. This was done mostly because the SCIM package was almost impossible to use. We only need these fields, so it was much simpler to use our own struct. This was tested only with Okta.

type ServiceProviderConfig

type ServiceProviderConfig struct {
	Schemas        []string               `json:"schemas"`
	DocURI         string                 `json:"documentationUri"`
	Patch          Supported              `json:"patch"`
	Bulk           BulkSupported          `json:"bulk"`
	Filter         FilterSupported        `json:"filter"`
	ChangePassword Supported              `json:"changePassword"`
	Sort           Supported              `json:"sort"`
	ETag           Supported              `json:"etag"`
	AuthSchemes    []AuthenticationScheme `json:"authenticationSchemes"`
	Meta           ServiceProviderMeta    `json:"meta"`
}

type ServiceProviderMeta

type ServiceProviderMeta struct {
	Created      time.Time `json:"created"`
	LastModified time.Time `json:"lastModified"`
	Location     string    `json:"location"`
	ResourceType string    `json:"resourceType"`
}

type Supported

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

Jump to

Keyboard shortcuts

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