Crate scim_server

Crate scim_server 

Source
Expand description

SCIM 2.0 server library for Rust.

A modern, type-safe implementation of the SCIM 2.0 protocol with clean architecture, multi-tenant support, and pluggable storage backends.

§Core Architecture

This library follows a clean, layered architecture:

  • SCIM Protocol Layer: ScimServer handles SCIM HTTP operations
  • Resource Layer: Resource provides type-safe resource representation
  • Storage Layer: ResourceProvider trait for pluggable backends
  • Schema Layer: Schema definitions with validation
  • Multi-tenancy: Built-in support via TenantContext

§Quick Start

use scim_server::ScimServer;
use scim_server::providers::StandardResourceProvider;
use scim_server::storage::InMemoryStorage;
use std::sync::Arc;

// 1. Set up storage and provider
let storage = InMemoryStorage::new();
let provider = StandardResourceProvider::new(storage);

// 2. Create SCIM server
let server = ScimServer::new(provider)?;

// 3. Server is ready for HTTP integration

§Key Features

  • Type Safety: Value objects with compile-time validation
  • Multi-tenant: Full tenant isolation with configurable strategies
  • Async First: Built on async/await for high performance
  • Pluggable Storage: Bring your own database via ResourceProvider
  • Schema Validation: Automatic validation against SCIM schemas
  • Version Control: ETag-based optimistic concurrency control
  • Extensible: Support for custom schemas and value objects

§Architecture Overview

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   HTTP Layer    │───▶│   ScimServer     │───▶│ Operation       │
│   (Axum/etc)    │    │   (Protocol)     │    │ Handler         │
└─────────────────┘    └──────────────────┘    └─────────────────┘
                                │                        │
                                ▼                        ▼
┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│     Schema      │    │    Resource      │    │ ResourceProvider│
│   Validation    │    │  (Value Objects) │    │   (Storage)     │
└─────────────────┘    └──────────────────┘    └─────────────────┘

Re-exports§

pub use error::ScimError;
pub use error::ScimResult;
pub use providers::ResourceProvider;
pub use resource::IsolationLevel;
pub use resource::TenantPermissions;
pub use resource::ListQuery;
pub use resource::RequestContext;
pub use resource::Resource;
pub use resource::ScimOperation;
pub use resource::TenantContext;
pub use schema::Schema;
pub use schema::SchemaRegistry;
pub use schema_discovery::SchemaDiscovery;
pub use scim_server::ScimServer;
pub use scim_server::ScimServerBuilder;
pub use scim_server::ScimServerConfig;
pub use scim_server::TenantStrategy;
pub use operation_handler::OperationMetadata;
pub use operation_handler::ScimOperationHandler;
pub use operation_handler::ScimOperationRequest;
pub use operation_handler::ScimOperationResponse;
pub use provider_capabilities::AuthenticationCapabilities;
pub use provider_capabilities::BulkCapabilities;
pub use provider_capabilities::CapabilityIntrospectable;
pub use provider_capabilities::ExtendedCapabilities;
pub use provider_capabilities::FilterOperator;
pub use provider_capabilities::PaginationCapabilities;
pub use provider_capabilities::ProviderCapabilities;
pub use resource_handlers::create_group_resource_handler;
pub use resource_handlers::create_user_resource_handler;
pub use schema_discovery::AuthenticationScheme;
pub use multi_tenant::ScimTenantConfiguration;
pub use multi_tenant::StaticTenantResolver;
pub use multi_tenant::TenantResolver;
pub use mcp_integration::McpServerInfo;
pub use mcp_integration::ScimMcpServer;
pub use mcp_integration::ScimToolResult;

Modules§

auth
Compile-time authentication system with type-level proofs.
error
Error types for SCIM server operations.
mcp_integration
Model Context Protocol integration for AI agents.
multi_tenant
Multi-tenant SCIM server capabilities.
operation_handler
Framework-agnostic SCIM operation handler.
provider_capabilities
Automated Provider Capability Discovery System
providers
Standard resource provider implementations.
resource
SCIM resource model with type-safe value objects and clean architecture.
resource_handlers
Resource handler implementations using the dynamic schema approach.
schema
Schema definitions and validation for SCIM resources.
schema_discovery
Schema discovery implementation with state machine design.
scim_server
Dynamic SCIM server implementation with runtime resource type registration.
storage
Storage abstraction layer for SCIM resources.

Macros§

impl_value_object
Helper macro for implementing ValueObject trait for existing value objects