#### [Abblix\.Oidc\.Server\.AspNetCore](https://www.abblix.com/en/docs/api/abblix-oidc-server-aspnetcore 'index')
### [Abblix\.Oidc\.Server\.AspNetCore](https://www.abblix.com/en/docs/api/abblix-oidc-server-aspnetcore/Abblix.Oidc.Server.AspNetCore 'Abblix\.Oidc\.Server\.AspNetCore')

## CorsServiceCollectionExtensions Class

Shared CORS registration for the OIDC transport adapters\. Every OIDC endpoint is tagged with the policy
name [CorsPolicyName](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Constants.OidcConstants#Abblix.Oidc.Server.Common.Constants.OidcConstants.CorsPolicyName 'Abblix\.Oidc\.Server\.Common\.Constants\.OidcConstants\.CorsPolicyName') \(the MVC controllers through `[EnableCors]`, the
Minimal API endpoints through `RequireCors`\); this fills that policy so a browser client can read the
endpoints cross\-origin out of the box, and leaves the host in full control of it\.

```csharp
public static class CorsServiceCollectionExtensions
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → CorsServiceCollectionExtensions
### Methods

## CorsServiceCollectionExtensions\.AddOidcCors\(this IServiceCollection\) Method {#Abblix.Oidc.Server.AspNetCore.CorsServiceCollectionExtensions.AddOidcCors(thisMicrosoft.Extensions.DependencyInjection.IServiceCollection)}

Registers the CORS services the OIDC endpoints rely on and a default
[CorsPolicyName](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Constants.OidcConstants#Abblix.Oidc.Server.Common.Constants.OidcConstants.CorsPolicyName 'Abblix\.Oidc\.Server\.Common\.Constants\.OidcConstants\.CorsPolicyName') policy built from [OidcCorsOptions](https://www.abblix.com/en/docs/api/abblix-oidc-server-aspnetcore/Abblix.Oidc.Server.AspNetCore.OidcCorsOptions 'Abblix\.Oidc\.Server\.AspNetCore\.OidcCorsOptions') \- but only
when the host has not already defined a policy of that name\. Idempotent: calling it from more than one
adapter registers the post\-configure step once and applies the default a single time\.

```csharp
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddOidcCors(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
```
#### Parameters

###### `services` [Microsoft\.Extensions\.DependencyInjection\.IServiceCollection](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection 'Microsoft\.Extensions\.DependencyInjection\.IServiceCollection') {#Abblix.Oidc.Server.AspNetCore.CorsServiceCollectionExtensions.AddOidcCors(thisMicrosoft.Extensions.DependencyInjection.IServiceCollection).services}

The service collection to add the CORS registration to\.

#### Returns
[Microsoft\.Extensions\.DependencyInjection\.IServiceCollection](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection 'Microsoft\.Extensions\.DependencyInjection\.IServiceCollection')  
The same [services](https://www.abblix.com/en/docs/api/abblix-oidc-server-aspnetcore/Abblix.Oidc.Server.AspNetCore.CorsServiceCollectionExtensions#Abblix.Oidc.Server.AspNetCore.CorsServiceCollectionExtensions.AddOidcCors(thisMicrosoft.Extensions.DependencyInjection.IServiceCollection).services 'Abblix\.Oidc\.Server\.AspNetCore\.CorsServiceCollectionExtensions\.AddOidcCors\(this Microsoft\.Extensions\.DependencyInjection\.IServiceCollection\)\.services') instance so calls can be chained\.
