Veracity.Authentication.OpenIDConnect.Core
1.1.0
Prefix Reserved
Veracity.Common.Authentication.AspNetCore
Additional DetailsSe https://github.com/veracity/Veracity-Identity-and-Services-Api/blob/main/ConvertFromOldPackages.md for upgrade instructions
dotnet add package Veracity.Authentication.OpenIDConnect.Core --version 1.1.0
NuGet\Install-Package Veracity.Authentication.OpenIDConnect.Core -Version 1.1.0
<PackageReference Include="Veracity.Authentication.OpenIDConnect.Core" Version="1.1.0" />
paket add Veracity.Authentication.OpenIDConnect.Core --version 1.1.0
#r "nuget: Veracity.Authentication.OpenIDConnect.Core, 1.1.0"
// Install Veracity.Authentication.OpenIDConnect.Core as a Cake Addin #addin nuget:?package=Veracity.Authentication.OpenIDConnect.Core&version=1.1.0 // Install Veracity.Authentication.OpenIDConnect.Core as a Cake Tool #tool nuget:?package=Veracity.Authentication.OpenIDConnect.Core&version=1.1.0
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.
ASPNETCORE
- Remove the old package
- install the package: Install-Package Veracity.Common.Authentication.AspNetCore
- Remove ConfigureServices(s=>s.AddSingleton<IVeracityIntegrationConfigService, VeracityIntegrationConfigService>()) from program.cs
- Remove ConfigureServices(s=>s.AddSingleton<IVeracityOpenIdManager, VeracityOpenIdManager>()) from program.cs
- Change Constructor, se sample below
- Replace services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>() with services.AddVeracity(Configuration)
- Remove: services.AddHttpClient<VeracityPlatformService>();
- Remove: services.AddSession()
- Replace AddOpenIdConnect with AddVeracityAuthentication(Configuration)
- Add token cache, see sample
- Add DataProtection, see sample
Startup.cs constructor, uses key vault for secrets
public Startup(IHostingEnvironment env)
{
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true)
.AddAzureKeyVault("https://veracitydevdaydemo.vault.azure.net/", new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback)), new DefaultKeyVaultSecretManager())
.AddEnvironmentVariables();
Configuration = builder.Build();
}
Startup.cs ConfigureServices
public void ConfigureServices(IServiceCollection services)
{
services.AddVeracity(Configuration)
.AddSingleton(ConstructDataProtector)
.AddSingleton(ConstructDistributedCache).Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
}).AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddVeracityAuthentication(Configuration)
.AddCookie();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
Create token cache
private IDistributedCache ConstructDistributedCache(IServiceProvider s)
{
return new MemoryDistributedCache(new OptionsWrapper<MemoryDistributedCacheOptions>(new MemoryDistributedCacheOptions()));
}
Create dataprotector
private IDataProtector ConstructDataProtector(IServiceProvider s)
{
return new DataProtector<IDataProtectionProvider>(s.GetDataProtectionProvider(), (p, data) => p.CreateProtector("token").Protect(data), (p, data) => p.CreateProtector("token").Unprotect(data));
}
Product | Versions 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. |
.NET Core | netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.1
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 2.1.2)
- Microsoft.AspNetCore.Http (>= 2.1.1)
- Microsoft.Extensions.Configuration (>= 2.1.1)
- Microsoft.Extensions.Configuration.Binder (>= 2.1.1)
- Microsoft.Identity.Client (>= 1.1.4-preview0002)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release