Updated packages and fixed build errors and tests..now need to update nuspec

This commit is contained in:
tom.pallister 2017-01-11 17:23:34 +00:00
parent 536db48049
commit b2d33f0ec5
12 changed files with 271 additions and 242 deletions

View File

@ -19,11 +19,11 @@ namespace Ocelot.Authentication.Handler.Creator
builder.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = authOptions.ProviderRootUrl,
ScopeName = authOptions.ScopeName,
ApiName = authOptions.ScopeName,
RequireHttpsMetadata = authOptions.RequireHttps,
AdditionalScopes = authOptions.AdditionalScopes,
AllowedScopes = authOptions.AdditionalScopes,
SupportedTokens = SupportedTokens.Both,
ScopeSecret = authOptions.ScopeSecret
ApiSecret = authOptions.ScopeSecret
});
var authenticationNext = builder.Build();

View File

@ -2,37 +2,36 @@
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.AspNetCore.Http": "1.0.0",
"System.Text.RegularExpressions": "4.1.0",
"Microsoft.AspNetCore.Authentication.OAuth": "1.0.0",
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0",
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authentication.Google": "1.0.0",
"Microsoft.AspNetCore.Authentication.Facebook": "1.0.0",
"Microsoft.AspNetCore.Authentication.Twitter": "1.0.0",
"Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.0.0",
"Microsoft.AspNetCore.Authentication": "1.0.0",
"IdentityServer4.AccessTokenValidation": "1.0.1-rc2",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.AspNetCore.Http": "1.1.0",
"System.Text.RegularExpressions": "4.3.0",
"Microsoft.AspNetCore.Authentication.OAuth": "1.1.0",
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
"Microsoft.AspNetCore.Authentication.Google": "1.1.0",
"Microsoft.AspNetCore.Authentication.Facebook": "1.1.0",
"Microsoft.AspNetCore.Authentication.Twitter": "1.1.0",
"Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.1.0",
"Microsoft.AspNetCore.Authentication": "1.1.0",
"IdentityServer4.AccessTokenValidation": "1.0.2",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.NETCore.App": "1.1.0",
"CacheManager.Core": "0.9.2",
"CacheManager.Microsoft.Extensions.Configuration": "0.9.2",
"CacheManager.Microsoft.Extensions.Logging": "0.9.2"
},
"CacheManager.Core": "0.9.1",
"CacheManager.Microsoft.Extensions.Configuration": "0.9.1",
"CacheManager.Microsoft.Extensions.Logging": "0.9.1"
"runtimes": {
"win10-x64": {}
},
"frameworks": {
"netcoreapp1.4": {
"imports": [

View File

@ -4,7 +4,6 @@ using System.IO;
using System.Net;
using System.Security.Claims;
using IdentityServer4.Models;
using IdentityServer4.Services.InMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -15,6 +14,9 @@ using Xunit;
namespace Ocelot.AcceptanceTests
{
using IdentityServer4;
using IdentityServer4.Test;
public class AuthenticationTests : IDisposable
{
private IWebHost _servicebuilder;
@ -241,26 +243,34 @@ namespace Ocelot.AcceptanceTests
.ConfigureServices(services =>
{
services.AddLogging();
services.AddDeveloperIdentityServer()
.AddInMemoryScopes(new List<Scope>
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddInMemoryApiResources(new List<ApiResource>
{
new Scope
new ApiResource
{
Name = scopeName,
Description = "My API",
Enabled = true,
AllowUnrestrictedIntrospection = true,
ScopeSecrets = new List<Secret>()
DisplayName = "test",
Scopes = new List<Scope>()
{
new Scope("api"),
new Scope("openid"),
new Scope("offline_access")
},
ApiSecrets = new List<Secret>()
{
new Secret
{
Value = "secret".Sha256()
}
},
UserClaims = new List<string>()
{
"CustomerId", "LocationId"
}
},
StandardScopes.OpenId,
StandardScopes.OfflineAccess
})
.AddInMemoryClients(new List<Client>
{
@ -275,14 +285,13 @@ namespace Ocelot.AcceptanceTests
RequireClientSecret = false
}
})
.AddInMemoryUsers(new List<InMemoryUser>
.AddTestUsers(new List<TestUser>
{
new InMemoryUser
new TestUser
{
Username = "test",
Password = "test",
Enabled = true,
Subject = "registered|1231231",
SubjectId = "registered|1231231",
Claims = new List<Claim>
{
new Claim("CustomerId", "123"),

View File

@ -4,7 +4,6 @@ using System.IO;
using System.Net;
using System.Security.Claims;
using IdentityServer4.Models;
using IdentityServer4.Services.InMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -15,6 +14,9 @@ using Xunit;
namespace Ocelot.AcceptanceTests
{
using IdentityServer4;
using IdentityServer4.Test;
public class AuthorisationTests : IDisposable
{
private IWebHost _servicebuilder;
@ -164,27 +166,35 @@ namespace Ocelot.AcceptanceTests
.ConfigureServices(services =>
{
services.AddLogging();
services.AddDeveloperIdentityServer()
.AddInMemoryScopes(new List<Scope>
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddInMemoryApiResources(new List<ApiResource>
{
new Scope
new ApiResource
{
Name = scopeName,
Description = "My API",
Enabled = true,
AllowUnrestrictedIntrospection = true,
ScopeSecrets = new List<Secret>()
DisplayName = "test",
Scopes = new List<Scope>()
{
new Scope("api"),
new Scope("openid"),
new Scope("offline_access")
},
ApiSecrets = new List<Secret>()
{
new Secret
{
Value = "secret".Sha256()
}
},
IncludeAllClaimsForUser = true
UserClaims = new List<string>()
{
"CustomerId", "LocationId", "UserType", "UserId"
}
},
StandardScopes.OpenId,
StandardScopes.OfflineAccess
})
.AddInMemoryClients(new List<Client>
{
@ -199,14 +209,13 @@ namespace Ocelot.AcceptanceTests
RequireClientSecret = false
}
})
.AddInMemoryUsers(new List<InMemoryUser>
.AddTestUsers(new List<TestUser>
{
new InMemoryUser
new TestUser
{
Username = "test",
Password = "test",
Enabled = true,
Subject = "registered|1231231",
SubjectId = "registered|1231231",
Claims = new List<Claim>
{
new Claim("CustomerId", "123"),

View File

@ -5,7 +5,6 @@ using System.Linq;
using System.Net;
using System.Security.Claims;
using IdentityServer4.Models;
using IdentityServer4.Services.InMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -17,6 +16,9 @@ using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true)]
namespace Ocelot.AcceptanceTests
{
using IdentityServer4;
using IdentityServer4.Test;
public class ClaimsToHeadersForwardingTests : IDisposable
{
private IWebHost _servicebuilder;
@ -31,12 +33,11 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_200_and_foward_claim_as_header()
{
var user = new InMemoryUser
var user = new TestUser()
{
Username = "test",
Password = "test",
Enabled = true,
Subject = "registered|1231231",
SubjectId = "registered|1231231",
Claims = new List<Claim>
{
new Claim("CustomerId", "123"),
@ -115,7 +116,7 @@ namespace Ocelot.AcceptanceTests
_servicebuilder.Start();
}
private void GivenThereIsAnIdentityServerOn(string url, string scopeName, AccessTokenType tokenType, InMemoryUser user)
private void GivenThereIsAnIdentityServerOn(string url, string scopeName, AccessTokenType tokenType, TestUser user)
{
_identityServerBuilder = new WebHostBuilder()
.UseUrls(url)
@ -126,27 +127,34 @@ namespace Ocelot.AcceptanceTests
.ConfigureServices(services =>
{
services.AddLogging();
services.AddDeveloperIdentityServer()
.AddInMemoryScopes(new List<Scope>
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddInMemoryApiResources(new List<ApiResource>
{
new Scope
new ApiResource
{
Name = scopeName,
Description = "My API",
Enabled = true,
AllowUnrestrictedIntrospection = true,
ScopeSecrets = new List<Secret>()
DisplayName = "test",
Scopes = new List<Scope>()
{
new Scope("api"),
new Scope("openid"),
new Scope("offline_access")
},
ApiSecrets = new List<Secret>()
{
new Secret
{
Value = "secret".Sha256()
}
},
IncludeAllClaimsForUser = true
},
StandardScopes.OpenId,
StandardScopes.OfflineAccess
UserClaims = new List<string>()
{
"CustomerId", "LocationId", "UserType", "UserId"
}
}
})
.AddInMemoryClients(new List<Client>
{
@ -161,7 +169,7 @@ namespace Ocelot.AcceptanceTests
RequireClientSecret = false
}
})
.AddInMemoryUsers(new List<InMemoryUser>
.AddTestUsers(new List<TestUser>
{
user
});

View File

@ -5,7 +5,6 @@ using System.Linq;
using System.Net;
using System.Security.Claims;
using IdentityServer4.Models;
using IdentityServer4.Services.InMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -17,6 +16,9 @@ using Xunit;
namespace Ocelot.AcceptanceTests
{
using IdentityServer4;
using IdentityServer4.Test;
public class ClaimsToQueryStringForwardingTests : IDisposable
{
private IWebHost _servicebuilder;
@ -31,12 +33,11 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_200_and_foward_claim_as_query_string()
{
var user = new InMemoryUser
var user = new TestUser()
{
Username = "test",
Password = "test",
Enabled = true,
Subject = "registered|1231231",
SubjectId = "registered|1231231",
Claims = new List<Claim>
{
new Claim("CustomerId", "123"),
@ -122,7 +123,7 @@ namespace Ocelot.AcceptanceTests
_servicebuilder.Start();
}
private void GivenThereIsAnIdentityServerOn(string url, string scopeName, AccessTokenType tokenType, InMemoryUser user)
private void GivenThereIsAnIdentityServerOn(string url, string scopeName, AccessTokenType tokenType, TestUser user)
{
_identityServerBuilder = new WebHostBuilder()
.UseUrls(url)
@ -133,27 +134,34 @@ namespace Ocelot.AcceptanceTests
.ConfigureServices(services =>
{
services.AddLogging();
services.AddDeveloperIdentityServer()
.AddInMemoryScopes(new List<Scope>
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddInMemoryApiResources(new List<ApiResource>
{
new Scope
new ApiResource
{
Name = scopeName,
Description = "My API",
Enabled = true,
AllowUnrestrictedIntrospection = true,
ScopeSecrets = new List<Secret>()
DisplayName = "test",
Scopes = new List<Scope>()
{
new Scope("api"),
new Scope("openid"),
new Scope("offline_access")
},
ApiSecrets = new List<Secret>()
{
new Secret
{
Value = "secret".Sha256()
}
},
IncludeAllClaimsForUser = true
},
StandardScopes.OpenId,
StandardScopes.OfflineAccess
UserClaims = new List<string>()
{
"CustomerId", "LocationId", "UserType", "UserId"
}
}
})
.AddInMemoryClients(new List<Client>
{
@ -168,7 +176,7 @@ namespace Ocelot.AcceptanceTests
RequireClientSecret = false
}
})
.AddInMemoryUsers(new List<InMemoryUser>
.AddTestUsers(new List<TestUser>
{
user
});

View File

@ -132,8 +132,8 @@ namespace Ocelot.AcceptanceTests
using (var httpClient = new HttpClient())
{
var response = httpClient.PostAsync(tokenUrl, content).Result;
response.EnsureSuccessStatusCode();
var responseContent = response.Content.ReadAsStringAsync().Result;
response.EnsureSuccessStatusCode();
_token = JsonConvert.DeserializeObject<BearerToken>(responseContent);
}
}

View File

@ -3,6 +3,6 @@
public static class TestConfiguration
{
public static double Version => 1.4;
public static string ConfigurationPath => $"./bin/Debug/netcoreapp{Version}/configuration.json";
public static string ConfigurationPath => $"./bin/Debug/netcoreapp{Version}/win10-x64/configuration.json";
}
}

View File

@ -12,31 +12,31 @@
"testRunner": "xunit",
"dependencies": {
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.AspNetCore.Http": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.AspNetCore.Http": "1.1.0",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Ocelot": "1.0.0-*",
"xunit": "2.2.0-beta2-build3300",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"Ocelot.ManualTest": "1.0.0-*",
"Microsoft.AspNetCore.TestHost": "1.0.0",
"IdentityServer4": "1.0.0-rc2",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.TestHost": "1.1.0",
"IdentityServer4": "1.0.1",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.NETCore.App": "1.1.0",
"Shouldly": "2.8.2",
"TestStack.BDDfy": "4.3.2"
},
"runtimes": {
"win10-x64": {}
},
"frameworks": {
"netcoreapp1.4": {
"imports": [

View File

@ -1,18 +1,16 @@
{
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
},
"Ocelot": "1.0.0-*",
"BenchmarkDotNet": "0.9.9"
"BenchmarkDotNet": "0.10.1"
},
"runtimes": {
"win10-x64": {}
},
"frameworks": {
"netcoreapp1.4": {
"imports": [

View File

@ -2,28 +2,25 @@
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNetCore.Http": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.AspNetCore.Http": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Ocelot": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
}
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.NETCore.App": "1.1.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"runtimes": {
"win10-x64": {}
},
"frameworks": {
"netcoreapp1.4": {
"imports": [
@ -61,4 +58,4 @@
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
}

View File

@ -4,30 +4,31 @@
"testRunner": "xunit",
"dependencies": {
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.AspNetCore.Http": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.AspNetCore.Http": "1.1.0",
"Ocelot": "1.0.0-*",
"xunit": "2.2.0-beta2-build3300",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"Moq": "4.6.38-alpha",
"Microsoft.AspNetCore.TestHost": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.TestHost": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.NETCore.App": "1.1.0",
"Shouldly": "2.8.2",
"TestStack.BDDfy": "4.3.2"
"TestStack.BDDfy": "4.3.2",
"Microsoft.AspNetCore.Authentication.OAuth": "1.1.0",
"Microsoft.DotNet.InternalAbstractions": "1.0.0"
},
"runtimes": {
"win10-x64": {}
},
"frameworks": {
"netcoreapp1.4": {
"imports": [