Skip to content

Commit cd1796f

Browse files
Ticket #470 : SCIM is secured with APIKEY
Can update the default SCIM Schema Name Update the documentation and README
1 parent 11957bf commit cd1796f

34 files changed

+686
-356
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ By default, there is one administrator account configured. It is possible to acc
9191

9292
The IdentityServer UI uses Bootstrap 5.
9393

94-
![IdentityServer](docs/documentation/gettingstarted/images/IdentityServer-1.png)
94+
![IdentityServer](images/docs/documentation/gettingstarted/images/IdentityServer-1.png)
9595

9696
## Create IdentityServer website project
9797

@@ -117,7 +117,17 @@ Using the website, you can perform configurations of users and clients.
117117

118118
The IdentityServer website UI uses Radzen.
119119

120-
![IdentityServerWebsite](docs/documentation/gettingstarted/images/IdentityServerWebsite-2.png)
120+
![IdentityServerWebsite](images/docs/documentation/gettingstarted/images/IdentityServerWebsite-2.png)
121+
122+
## SCIM Security
123+
124+
By default SCIM is configured to use API KEY authentication.
125+
Any clients who want to execute one operation must pass one of those keys into `HTTP HEADER Authorization Bearer`.
126+
127+
| Owner | Value |
128+
| -------- | ------------------------------------ |
129+
| IdServer | ba521b3b-02f7-4a37-b03c-58f713bf88e7 |
130+
| AzureAd | 1595a72a-2804-495d-8a8a-2c861e7a736a |
121131

122132
## Create SCIM project with EF support
123133

@@ -142,7 +152,7 @@ cd src/SCIMEF
142152
dotnet run --urls=http://localhost:5003
143153
```
144154

145-
Now the SCIM server is running, you can check its Schemas endpoint on [http://localhost:5003/Schemas][http://localhost:5003/Schemas].
155+
Now the SCIM server is running, you can check its Schemas endpoint on [http://localhost:5003/Schemas](http://localhost:5003/Schemas).
146156

147157
## Create SCIM project with MongoDB support
148158

@@ -167,7 +177,7 @@ cd src/ScimMongoDB
167177
dotnet run --urls=http://localhost:5003
168178
```
169179

170-
Now the SCIM server is running, you can check its Schemas endpoint on [http://localhost:5003/Schemas][http://localhost:5003/Schemas].
180+
Now the SCIM server is running, you can check its Schemas endpoint on [http://localhost:5003/Schemas](http://localhost:5003/Schemas).
171181

172182
# Running with docker
173183

docs/documentation/gettingstarted/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ The IdentityServer website UI uses Radzen.
9494

9595
![IdentityServerWebsite](images/IdentityServerWebsite-2.png)
9696

97+
## SCIM Security
98+
99+
By default SCIM is configured to use API KEY authentication.
100+
Any clients who want to execute one operation must pass one of those keys into `HTTP HEADER Authorization Bearer`.
101+
102+
| Owner | Value |
103+
| -------- | ------------------------------------ |
104+
| IdServer | ba521b3b-02f7-4a37-b03c-58f713bf88e7 |
105+
| AzureAd | 1595a72a-2804-495d-8a8a-2c861e7a736a |
106+
97107
## Create SCIM project with EF support
98108

99109
Create a web project named `ScimEF` with the `SimpleIdServer.Scim.Persistence.EF` package installed and Entity Framework (EF) configured to use SQLServer.

src/IdServer/SimpleIdServer.IdServer.Startup/Converters/FacebookOptionsLite.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace SimpleIdServer.IdServer.Startup.Converters
88
{
99
public class FacebookOptionsLite : IDynamicAuthenticationOptions<FacebookOptions>
1010
{
11-
[VisibleProperty("AppId")]
11+
[SimpleIdServer.IdServer.Serializer.VisibleProperty("AppId")]
1212
public string AppId { get; set; }
13-
[VisibleProperty("AppSecret")]
13+
[SimpleIdServer.IdServer.Serializer.VisibleProperty("AppSecret")]
1414
public string AppSecret { get; set; }
1515

1616
public FacebookOptions Convert() => new FacebookOptions

src/IdServer/SimpleIdServer.IdServer.Startup/Converters/OpenIdConnectLiteOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace SimpleIdServer.IdServer.Startup.Converters
88
{
99
public class OpenIdConnectLiteOptions : IDynamicAuthenticationOptions<OpenIdConnectOptions>
1010
{
11-
[VisibleProperty("ClientId")]
11+
[SimpleIdServer.IdServer.Serializer.VisibleProperty("ClientId")]
1212
public string ClientId { get; set; }
13-
[VisibleProperty("ClientSecret")]
13+
[SimpleIdServer.IdServer.Serializer.VisibleProperty("ClientSecret")]
1414
public string ClientSecret { get; set; }
1515

1616
public OpenIdConnectOptions Convert()

src/Scim/SimpleIdServer.Scim.Persistence.EF/SCIMDbContext.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
// Copyright (c) SimpleIdServer. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
33
using Microsoft.EntityFrameworkCore;
4+
using Microsoft.Extensions.Options;
45
using SimpleIdServer.Scim.Domains;
56
using SimpleIdServer.Scim.Persistence.EF.Configurations;
67

78
namespace SimpleIdServer.Scim.Persistence.EF
89
{
910
public class SCIMDbContext : DbContext
1011
{
11-
public SCIMDbContext(DbContextOptions<SCIMDbContext> dbContextOptions) : base(dbContextOptions)
12+
private readonly SCIMEFOptions _options;
13+
14+
public SCIMDbContext(DbContextOptions<SCIMDbContext> dbContextOptions, IOptions<SCIMEFOptions> options) : base(dbContextOptions)
1215
{
16+
_options = options.Value;
1317
}
1418

1519
public DbSet<SCIMAttributeMapping> SCIMAttributeMappingLst { get; set; }
@@ -22,6 +26,7 @@ public SCIMDbContext(DbContextOptions<SCIMDbContext> dbContextOptions) : base(db
2226
protected override void OnModelCreating(ModelBuilder modelBuilder)
2327
{
2428
base.OnModelCreating(modelBuilder);
29+
if (!string.IsNullOrWhiteSpace(_options.DefaultSchema)) modelBuilder.HasDefaultSchema(_options.DefaultSchema);
2530
modelBuilder.ApplyConfiguration(new ProvisioningConfConfiguration());
2631
modelBuilder.ApplyConfiguration(new ProvisioningConfigurationHistoryConfiguration());
2732
modelBuilder.ApplyConfiguration(new ProvisioningConfigurationRecordConfiguration());
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) SimpleIdServer. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
namespace SimpleIdServer.Scim.Persistence.EF
4+
{
5+
public class SCIMEFOptions
6+
{
7+
public string DefaultSchema { get; set; } = "dbo";
8+
}
9+
}

src/Scim/SimpleIdServer.Scim.Persistence.EF/ServiceCollectionExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ namespace Microsoft.Extensions.DependencyInjection
99
{
1010
public static class ServiceCollectionExtensions
1111
{
12-
public static IServiceCollection AddScimStoreEF(this IServiceCollection services, Action<DbContextOptionsBuilder> optionsAction = null)
12+
public static IServiceCollection AddScimStoreEF(this IServiceCollection services, Action<DbContextOptionsBuilder> dbContextOptsCallback = null, Action<SCIMEFOptions> optionsCallback = null)
1313
{
1414
services.AddTransient<ISCIMRepresentationCommandRepository, EFSCIMRepresentationCommandRepository>();
1515
services.AddTransient<ISCIMRepresentationQueryRepository, EFSCIMRepresentationQueryRepository>();
1616
services.AddTransient<ISCIMSchemaQueryRepository, EFSCIMSchemaQueryRepository>();
1717
services.AddTransient<ISCIMSchemaCommandRepository, EFSCIMSchemaCommandRepository>();
1818
services.AddTransient<ISCIMAttributeMappingQueryRepository, EFSCIMAttributeMappingQueryRepository>();
1919
services.AddTransient<IProvisioningConfigurationRepository, EFProvisioningConfigurationRepository>();
20-
services.AddDbContext<SCIMDbContext>(optionsAction);
20+
services.AddDbContext<SCIMDbContext>(dbContextOptsCallback);
21+
if (optionsCallback == null) services.Configure<SCIMEFOptions>(o => { });
22+
else services.Configure(optionsCallback);
2123
return services;
2224
}
2325
}

src/Scim/SimpleIdServer.Scim.Postgre.Startup/SCIMMigration.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Templates/templates/SimpleIdServer.Scim.SqlServer.Startup/Migrations/20230302153749_Init.Designer.cs renamed to src/Scim/SimpleIdServer.Scim.SqlServer.Startup/Migrations/20230411185444_Init.Designer.cs

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)