The SCIM standard was created to simplify user management in the cloud by defining a schema for representing users and groups and a REST API for all the necessary CRUD operations.
It is intended to replace the older SPML protocol.
Are there any "mature" C# libraries out there?
Most of the stuff I've googled is for Java or else doesn't seem very active.
Update:
In response to the comment:
These libraries are usually of the form:
User = new User;
User.name = "name";
... etc ...
User.Create;
In other words, it hides the underlying implementation by using a model user. That way you don't have to worry about the details of the actual protocol.
The SCIM standard is growing in popularity and has been adopted by numerous identity providers (e.g. Azure Active Directory) as well as applications (e.g. Dynamic Signal, Zscaler, Dropbox, and Perimeter81). As adoption of the standard grows, so do the number of tools available.
What is SCIM for? SCIM, or the System for Cross-domain Identity Management specification, is an open standard designed to manage user identity information. SCIM provides a defined schema for representing users and groups, and a RESTful API to run CRUD operations on those user and group resources.
What is the difference between SCIM and SSO? SSO is a way to authenticate, and SCIM is a way to provision. SAML SSO allows members to use a single sign-on (SSO) identity provider service to log in to MURAL instead of using the default email and password.
IAM Identity Center provides support for the System for Cross-domain Identity Management (SCIM) v2. 0 standard. SCIM keeps your IAM Identity Center identities in sync with identities from your IdP. This includes any provisioning, updates, and deprovisioning of users between your IdP and IAM Identity Center.
I've updated my original answer to hopefully provide some better information.
A) This library should (hopefully) be what you're looking for:
Microsoft.SystemForCrossDomainIdentityManagement
https://www.nuget.org/packages/Microsoft.SystemForCrossDomainIdentityManagement/
One of the authors of the project recently updated it to include v1 and v2 SCIM object support and you were absolutely correct with your links to the blog posts which explains the library's purpose.
http://blogs.technet.com/b/ad/archive/2015/11/23/azure-ad-helping-you-adding-scim-support-to-your-applications.aspx
(The author has now added this to the summary on nuget so people who find the nuget library before reading the blog post won't be as confused as I was).
Here's an example of deserialzing a user based on a GET request (to Facebook), you can easily create a new user object and set its properties etc. before POST or PUT'ing it into the system.
public static async Task GetUser()
{
var oauthToken = "123456789foo";
var baseUrl = "https://www.facebook.com/company/1234567890/scim/";
var userName = "[email protected]";
using (var client = new HttpClient())
{
// Set up client and configure for things like oauthToken which need to go on each request
client.BaseAddress = new Uri(baseUrl);
// Spoof User-Agent to keep Facebook happy
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oauthToken);
try
{
var response = await client.GetAsync($"Users?filter=userName%20eq%20%22{userName}%22");
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
// This is the part which is using the nuget library I referenced
var jsonDictionary = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(json);
var queryResponse = new QueryResponseJsonDeserializingFactory<Core1EnterpriseUser>().Create(jsonDictionary);
var user = queryResponse.Resources.First();
}
catch (Exception ex)
{
// TODO: handle exception
}
}
}
I initially ran into an issue using the Newtonsoft deserialzier rather than the MS one:
var jsonDictionary = await Task.Factory.StartNew(() => { return JsonConvert.DeserializeObject<Dictionary<string, object>>(json); });
Returned a Dictionary<string, object>
but the factory couldn't make proper use of it.
You can use the Core2User
or Core2EnterpriseUser
classes if you're using v2 of the SCIM spec.
Furthermore the library, I believe can handle the creation of requests if you want (rather than crafting them yourself which does seem to be pretty straightforward anyway), here's another snippet from the author of the project (Craig McMurtry)
/*
* SampleProvider() is included in the Service library.
* Its SampleResource property provides a 2.0 enterprise user with values
* set according to the samples in the 2.0 schema specification.
*/
var resource = new SampleProvider().SampleResource;
// ComposePostRequest() is an extension method on the Resource class provided by the Protocols library.
request = resource.ComposePostRequest("http://localhost:9000");
I hope this all helps, a massive amount of thanks are due to Craig McMurtry at Microsoft who has been very helpful in trying to get me up and running with the library - so I don't have to hand craft all my own model classes.
Please evaluate the open source project, https://github.com/PowerDMS/Owin.Scim. I've been leading this development effort. While it's missing a few features that Microsoft has implemented quite well, it is far more complete in most other areas of scim. See if it fits your needs and we welcome all feedback to help shape the future of owin.scim.
I recommend SimpleIdServer.Scim
https://github.com/simpleidserver/SimpleIdServer as an alternative. I did not end up using web api but it still worked for my needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With