This quickstart will walk you through a basic implementation of a SCIM Service Provider using the default in-memory store from the NuGet package from Rock Solid Knowledge.
NuGet Installation
To start, you’ll need to install our SCIM component from NuGet:
install-package Rsk.AspNetCore.Scim
This component requires a license which you can get by signing up for a demo or purchasing via sales@identityserver.com.
Adding a SCIM Service Provider
To use the SCIM component as a service provider, you need to add the UseScim
registration in your IApplicationBuilder
, as well as the AddScimServiceProvider
registration in your IServiceCollection
. The AddScimServiceProvider
call will return an IScimServiceProviderBuilder
that exposes methods for registering new SCIM resources as well as custom stores and validators. Below we will cover how to quickly get started with the default SCIM resources: Users, Groups, and EnterpriseUsers.
Within the AddScimServiceProvider
call, you can register a base route for SCIM requests to be handled on. Within the example, that value is /SCIM
. The result is that requests for Users
will be handled on /SCIM/Users
, and requests for Groups
will be handled on /SCIM/Groups
.
Requests to service providers need an accept header with the value 'application/scim+json'
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddScimServiceProvider("/SCIM", new ScimLicensingOptions("Demo", "eyJTb2xkRm9yIjowLjAsI .... "));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseScim();
}
}
Getting Started
The easiest way to test the SCIM component as a service provider is to utilize the in-memory store. To add the in-memory SCIM store for the SCIM core schema resources, call AddScimDefaultResourcesForInMemoryStore
on the returned IScimServiceProviderBuilder
from the AddScimServiceProvider
call.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
services.AddScimServiceProvider("/SCIM", new ScimLicensingOptions("Demo", "eyJTb2xkRm9yIjowLjAsI .... "))
.AddScimDefaultResourcesForInMemoryStore();
}
To use your own models with the in-memory store, call the AddResoure<T>
method on the returned IScimServiceProviderBuilder
from the AddScimDefaultResourceForInMemoryStore
, where T
is a class derived from Resource
.
public class Organization : Resource
{
public Organization() : base("Organization")
{
}
public string Name { get; set; }
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
services.AddScimServiceProvider("/SCIM", new ScimLicensingOptions("Demo", "eyJTb2xkRm9yIjowLjAsI .... "))
.AddScimDefaultResourcesForInMemoryStore()
.AddResource<Organization>("urn:ietf:params:scim:schemas:RSK:2.0:Organization", "Organizations");
}