Veracity.Authentication.OpenIDConnect.AspNet 1.1.0 Prefix Reserved

Suggested Alternatives


Install-Package Veracity.Authentication.OpenIDConnect.AspNet -Version 1.1.0
dotnet add package Veracity.Authentication.OpenIDConnect.AspNet --version 1.1.0
<PackageReference Include="Veracity.Authentication.OpenIDConnect.AspNet" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Veracity.Authentication.OpenIDConnect.AspNet --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Veracity.Authentication.OpenIDConnect.AspNet, 1.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Veracity.Authentication.OpenIDConnect.AspNet as a Cake Addin
#addin nuget:?package=Veracity.Authentication.OpenIDConnect.AspNet&version=1.1.0

// Install Veracity.Authentication.OpenIDConnect.AspNet as a Cake Tool
#tool nuget:?package=Veracity.Authentication.OpenIDConnect.AspNet&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Converting from Veracity.Authentication.OpenIDConnect.* to Veracity.Common.Authentication.*

As we have changed our strategy to provide a unified set of packages that build upon eachother with authientication as the foundation we have deprecated the Veracity.Authentication.OpenIDConnect.* packages. This guide will help in the process of upgrading to the new packages.

We now support different options with regards of token caching through the Microsoft.Extensions.Caching namespace. This provides an easy and standard way of setting up the caching strategy that is most siutable for your solution. Note that persistent token chacing like redis and sql require you to encrupt the tokens before storing them. We also provide options for doing this. For details on the new packages see

This package is implemented using extension methods and not a full owin startup so you are able to customize the behaviour as you like and add additional middlewares if needed. In the samples here we only show the basics.

  1. Remove the old package
  2. Remove the owin startup reference in web.config
  3. install the package: Install-Package Veracity.Common.Authentication.AspNet
  4. update web.config keys
    1. veracity:ClientId → veracity:ClientId
    2. veracity:ClientSecret → apiGW:clientSecret (should be secured in key vault or the like)
    3. veracity:RedirectUri → apiGW:redirectUrl
    4. veracity:APISubscriptionKey → subscriptionKey
  5. Add new keys to web.config
    1. apiGW:scope =
    2. apiGW:idp = a68572e3-63ce-4bc1-acdc-b64943502e9d
    3. apiGW:policy = B2C_1A_SignInWithADFSIdp
    4. myApiV3Url = (if calling the Services api using our packages)
  6. Add owin startup, see sample below

Sample Owin startup.cs install Microsoft.Extensions.Caching.Memory -Version 2.0.0 (or higher)

using System.Security.Claims;
using System.Web;
using Microsoft.Azure.KeyVault;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Owin;
using Veracity.Common.Authentication;

[assembly: OwinStartup(typeof(NetFrameworkIdentity.Startup))]

namespace NetFrameworkIdentity
    public class Startup
        public void Configuration(IAppBuilder app)
            //Example on how to get secrets from key vault
            var azureServiceTokenProvider = new AzureServiceTokenProvider();
            var keyVaultClient = new KeyVaultClient(async (authority, resource, scope) =>
                await azureServiceTokenProvider.GetAccessTokenAsync(resource));
            var secret = keyVaultClient.GetSecretAsync("",
            var subscriptionKey = keyVaultClient
                .GetSecretAsync("", "Veracity--SubscriptionKey").Result;
            app.UseCookieAuthentication(new CookieAuthenticationOptions { CookieName = "a.c" }); //set auth cookie
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); //set default auth type 
            //configure veracity auth
            app.UseVeracityAuthentication(new TokenProviderConfiguration
                    ClientSecret = secret.Value,
                    SubscriptionKey = subscriptionKey.Value
                }) //Add Azure Ad B2C authentication and access token cache
                .UseTokenCache(CacheFactoryFunc); //add access token cache and set cache strategy

        private static DistributedTokenCache CacheFactoryFunc()
            return new DistributedTokenCache(HttpContext.Current.User as ClaimsPrincipal, DistributedCache, null, null);

        private static MemoryDistributedCache DistributedCache { get; } =
            new MemoryDistributedCache(
                new OptionsWrapper<MemoryDistributedCacheOptions>(new MemoryDistributedCacheOptions()));

Modify global.asax.cs

protected void Application_Start()
    ConfigurationManagerHelper.SetManager(new ConfigManager()); //to hook up a config abstraction allowing the shared library work both for and aspnetcore
    this.AddDependencyInjection<AppServiceConfig>(); //Add Microsoft.Extensions.DependencyInjection support if you dont use DI already. If you are using autofac see the autofac IocIntegration for details

Sample web.config file

    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="webpages:Version" value="" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="apiGW:clientId" value="db4b6456-8873-4358-8c5d-96c39750ec28" />
    <add key="apiGW:policy" value="B2C_1A_SignInWithADFSIdp" />
    <add key="apiGW:scope" value="" />
    <add key="apiGW:redirectUrl" value="https://localhost:44330/" />
    <add key="apiGW:idp" value="ed815121-cdfa-4097-b524-e2b23cd36eb6" />
    <add key="myApiV3Url" value="" />

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 956 6/20/2019
1.0.0 531 12/29/2018
1.0.0-preview007 384 12/28/2018
1.0.0-preview006 383 12/28/2018
1.0.0-preview005 369 12/28/2018
1.0.0-preview004 433 12/28/2018
1.0.0-preview003 428 12/28/2018
1.0.0-preview002 444 12/28/2018
1.0.0-preview001 361 12/28/2018
1.0.0-beta1 396 12/28/2018
1.0.0-beta 410 12/28/2018

Updated dependencies