Stardust.Aadb2c.AuthenticationFilter 2.0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Stardust.Aadb2c.AuthenticationFilter --version 2.0.1.1
                    
NuGet\Install-Package Stardust.Aadb2c.AuthenticationFilter -Version 2.0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Stardust.Aadb2c.AuthenticationFilter" Version="2.0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Stardust.Aadb2c.AuthenticationFilter" Version="2.0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Stardust.Aadb2c.AuthenticationFilter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Stardust.Aadb2c.AuthenticationFilter --version 2.0.1.1
                    
#r "nuget: Stardust.Aadb2c.AuthenticationFilter, 2.0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Stardust.Aadb2c.AuthenticationFilter@2.0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Stardust.Aadb2c.AuthenticationFilter&version=2.0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Stardust.Aadb2c.AuthenticationFilter&version=2.0.1.1
                    
Install as a Cake Tool

.net Framework

add filter

In WebApiConfig.cs add

public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            //   config.SuppressDefaultHostAuthentication();
            // Web API routes
            config.MapHttpAttributeRoutes();
            config.Filters.Add(new OAuthAuthenticationFilter());// turns on aad b2c token validation
            config.Filters.Add(new ErrorFilter());

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }
Configure filter
In config
<appSettings>
    
    <add key ="aadTenant" value="tenantName.onmicrosoft.com" />
    <add key="audience" value="you appid" />
    <add key="issuerHostName" value="https://login.microsoftonline.com/{your tenant id}/v2.0/" />
    
    <add key ="aadPolicy" value="B2C_1A_SignIn" />
</appSettings>
In code
    protected void Application_Start()
    {
        //Mandatory
        B2CGlobalConfiguration.AadTenant="tenantName.onmicrosoft.com";
        B2CGlobalConfiguration.Audience="you appid";
        B2CGlobalConfiguration.ValidIssuer="https://login.microsoftonline.com/{your tenant id}/v2.0/";
        //Optional
        B2CGlobalConfiguration.AadPolicy="B2C_1A_SignIn"

        //Regular app start stuff
        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(WebApiConfig.Register);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
    }

asp.net core

add filter
public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
                .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
                .AddB2CAuthentication("OAuth2", "Azure B2C authentication");//Add the B2C authentication scheme
        }

         public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

            }
            app.AddConfigurationManager(new ConfigManager());// Add the configuration binding. Implement your own manager to fit with your configuration scheme.
            //the netcore version uses the same config keys as the .net framework version.
            app.UseMvc();            
        }
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Framework net471 is compatible.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Stardust.Aadb2c.AuthenticationFilter:

Package Downloads
Stardust.Aadb2c.Swagger

Helper extensions to configure Swashbuckle Swagger and Swagger UI to use OAuth implicit grant with Azure AD b2c

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.5.1 1,964 4/9/2024
2.5.0 5,047 3/5/2023
2.4.0 3,609 1/4/2023 2.4.0 is deprecated because it has critical bugs.
2.3.3 3,118 7/8/2022 2.3.3 is deprecated because it has critical bugs.
2.3.2 938 7/8/2022 2.3.2 is deprecated because it has critical bugs.
2.2.3 10,292 10/7/2019 2.2.3 is deprecated because it has critical bugs.
2.2.2 2,577 7/3/2019 2.2.2 is deprecated because it has critical bugs.
2.2.0-rc1 977 5/21/2019
2.0.5 2,847 11/6/2018
2.0.4 2,604 10/2/2018
2.0.3 2,007 6/26/2018
2.0.2 1,731 5/29/2018
2.0.1.2 1,652 4/4/2018
2.0.1.1 1,674 4/4/2018
2.0.0 1,732 3/6/2018
2.0.0-pre0004 1,435 2/26/2018
2.0.0-pre0003 1,359 2/26/2018
2.0.0-pre0002 1,625 2/23/2018
2.0.0-pre0001 1,536 2/23/2018
1.2.1.5 1,527 10/23/2017
1.2.1.3 1,394 10/23/2017
1.2.1.2 1,463 10/23/2017
1.2.1.1 1,359 10/19/2017
1.2.1 1,386 10/19/2017
1.2.0 1,429 10/17/2017
1.1.5.8 1,477 10/17/2017
1.1.5.7 1,620 10/4/2017
1.1.5.6 1,477 10/4/2017
1.1.5.5 1,430 10/2/2017
1.1.5.2 1,494 8/15/2017
1.1.5.1 1,484 8/15/2017
1.1.5 1,400 8/15/2017
1.1.4 1,405 8/15/2017
1.1.3 1,446 8/15/2017
1.1.2 1,460 8/15/2017
1.1.1 1,317 8/7/2017
1.1.0 1,499 7/11/2017
1.0.0 4,821 7/5/2017
1.0.0-pre2 1,492 7/5/2017
1.0.0-pre1 1,533 7/4/2017

Updated to support .netcore