Skip to content

Commit 145e96b

Browse files
Update README.md
1 parent 9f0c56a commit 145e96b

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,29 +163,26 @@ After pulling in a reference to the Stott.Security.Optimizely project, you only
163163
```C#
164164
public void ConfigureServices(IServiceCollection services)
165165
{
166-
services.AddRazorPages();
167-
services.AddCspManager();
166+
services.AddStottSecurity();
168167
}
169168

170169
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
171170
{
172171
app.UseAuthentication();
173172
app.UseAuthorization();
174-
app.UseCspManager();
173+
app.UseStottSecurity();
175174

176175
app.UseEndpoints(endpoints =>
177176
{
178177
endpoints.MapContent();
179-
endpoints.MapRazorPages();
178+
endpoints.MapControllers();
180179
});
181180
}
182181
```
183182

184-
The call to ```services.AddRazorPages()``` is a standard .NET 6.0 call to ensure razor pages are included in your solution.
183+
The call to ```services.AddStottSecurity()``` in the ```ConfigureServices(IServiceCollection services)``` sets up the dependency injection requirements for the security module and is required to ensure the solution works as intended. This works by following the Services Extensions pattern defined by microsoft.
185184

186-
The call to ```services.AddCspManager()``` in the ```ConfigureServices(IServiceCollection services)``` sets up the dependency injection requirements for the CSP solution and is required to ensure the solution works as intended. This works by following the Services Extensions pattern defined by microsoft.
187-
188-
The call to ```app.UseCspManager()``` in the ```Configure(IApplicationBuilder app, IWebHostEnvironment env)``` method sets up the CSP middleware. This should be declared immediately before the ```app.UseEndpoints(...)``` method to ensure that the headers are added to content pages.
185+
The call to ```app.UseStottSecurity()``` in the ```Configure(IApplicationBuilder app, IWebHostEnvironment env)``` method sets up the CSP middleware. This should be declared immediately before the ```app.UseEndpoints(...)``` method to ensure that the headers are added to content pages.
189186

190187
This solution also includes an implementation of ```IMenuProvider``` which ensures that the CSP administration pages are included in the CMS Admin menu under the title of "CSP". You do not have to do anything to make this work as Optimizely CMS will scan and action all implementations of ```IMenuProvider```.
191188

@@ -220,7 +217,7 @@ The configuration of the module has some scope for modification by providing con
220217

221218
Example:
222219
```C#
223-
services.AddCspManager(cspSetupOptions =>
220+
services.AddStottSecurity(cspSetupOptions =>
224221
{
225222
cspSetupOptions.ConnectionStringName = "EPiServerDB";
226223
},
@@ -238,7 +235,7 @@ authorizationOptions =>
238235
If you are using the new Optimizely Opti ID package for authentication into Optimizely CMS and the rest of the Optimizely One suite, then you will need to define the `authorizationOptions` for this module as part of your application start up. This should be a simple case of adding `policy.AddAuthenticationSchemes(OptimizelyIdentityDefaults.SchemeName);` to the `authorizationOptions` as per the example below.
239236

240237
```C#
241-
serviceCollection.AddCspManager(cspSetupOptions =>
238+
serviceCollection.AddStottSecurity(cspSetupOptions =>
242239
{
243240
cspSetupOptions.ConnectionStringName = "EPiServerDB";
244241
},
@@ -431,7 +428,7 @@ SAMEORIGIN
431428

432429
### My static files like server-error.html do not have the CSP applied
433430

434-
Make sure that the call to `app.UseStaticFiles()` is made after the call to `app.UseCspManager()` to ensure that the CSP middleware is applied to the static file request.
431+
Make sure that the call to `app.UseStaticFiles()` is made after the call to `app.UseStottSecurity()` to ensure that the CSP middleware is applied to the static file request.
435432

436433
### My Page which implements `IContentSecurityPolicyPage` is not updating with the global content security policy changes.
437434

0 commit comments

Comments
 (0)