Dealing with auth and package versions issues between 1.1 and 2.0

This commit is contained in:
Eduard Tomas 2017-06-23 18:45:20 +02:00
parent c28b693db9
commit 65bcf48246
3 changed files with 12 additions and 5 deletions

View File

@ -3,11 +3,16 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard1.5</TargetFramework> <TargetFramework>netstandard1.5</TargetFramework>
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks</RootNamespace> <RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks</RootNamespace>
<!--
<NetStandardImplicitPackageVersion>2.0.0-preview1-25301-01</NetStandardImplicitPackageVersion> <NetStandardImplicitPackageVersion>2.0.0-preview1-25301-01</NetStandardImplicitPackageVersion>
-->
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="1.1.2" />
<!--
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="2.0.0-preview1-final" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="2.0.0-preview1-final" />
-->
<PackageReference Include="StackExchange.Redis" Version="1.2.3" /> <PackageReference Include="StackExchange.Redis" Version="1.2.3" />
</ItemGroup> </ItemGroup>

View File

@ -3,7 +3,6 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework> <TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion> <RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
<OutputType>Exe</OutputType>
<UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId> <UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback> <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath> <DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>

View File

@ -83,7 +83,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
var callBackUrl = Configuration.GetValue<string>("CallBackUrl"); var callBackUrl = Configuration.GetValue<string>("CallBackUrl");
// Add Authentication services // Add Authentication services
services.AddCookieAuthentication(CookieAuthenticationDefaults.AuthenticationScheme); services.AddCookieAuthentication(CookieAuthenticationDefaults.AuthenticationScheme);
services.AddOpenIdConnectAuthentication("Oidc", options => services.AddOpenIdConnectAuthentication(OpenIdConnectDefaults.AuthenticationScheme, options =>
{ {
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.Authority = identityUrl.ToString(); options.Authority = identityUrl.ToString();
@ -101,8 +101,11 @@ namespace Microsoft.eShopOnContainers.WebMVC
options.Scope.Add("marketing"); options.Scope.Add("marketing");
}); });
services.AddAuthentication(sharedOptions => sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme); services.AddAuthentication(options => {
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
});
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@ -125,7 +128,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
app.UseStaticFiles(); app.UseStaticFiles();
app.UseAuthentication();
var log = loggerFactory.CreateLogger("identity"); var log = loggerFactory.CreateLogger("identity");