Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Migrate NancyBoostrapperBase.DiagnosticsConfiguration to unified configuration API #2002

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
68a9ffa
Updated projects to target .net 4.5
thecodejunkie Feb 18, 2015
26df368
Updated nuget dependencies to v4.5 target framework
thecodejunkie Feb 19, 2015
9abe722
Updated nuspec files to target 4.5
thecodejunkie Feb 19, 2015
b02afa0
Fix resharper ignore pattern.
damianh Feb 19, 2015
293ee2a
Tweaks to dotSettings: never show "this." as redundant and skip ".csh…
damianh Feb 19, 2015
1e505bf
Remove reduntant using directives.
damianh Feb 19, 2015
c3d6d67
Merge pull request #1819 from damianh/v2-some-cleanup
thecodejunkie Feb 19, 2015
8e052dd
Removed mono 2.x from travis file
grumpydev Feb 19, 2015
0acb4ea
Switched to using official mono packages
grumpydev Feb 19, 2015
72fe025
Attempted forced install
grumpydev Feb 19, 2015
047eb28
Added package upgrade
grumpydev Feb 19, 2015
28dce3d
Updated upgrade command
grumpydev Feb 19, 2015
dac7b8b
Stopped postgres to avoid the upgrade error
grumpydev Feb 19, 2015
c0dce62
Switched to using native mono support in travis
grumpydev Feb 19, 2015
7c64e98
Added flag to (hopefully) enable docker support
grumpydev Feb 19, 2015
dc3a9ff
Deleting IUserIdentity. This breaks all the things.
damianh Feb 19, 2015
8be6af0
Rename UserIdentityExtensions to ClaimsPrincipalExtension. Mapped IUs…
damianh Feb 19, 2015
ca5447a
ModuleSecurity and SecurityHooks fixed to use ClaimsPrincipal extensi…
damianh Feb 19, 2015
f7513e7
Basic Auth IUserValidator returns a ClaimsPrincipal.
damianh Feb 19, 2015
3f3639c
Froms Auth IUserMapper returns a ClaimsPrincipal
damianh Feb 19, 2015
9cafef2
Authentication.Stateless user lookup func returns a ClaimsPrincipal
damianh Feb 19, 2015
942f4fa
Fix, changes (and some deletions) to ModuleSecurity, SecurityHooks an…
damianh Feb 19, 2015
c99698b
Replace IUserIdentity with ClaimsPrincipal.
damianh Feb 19, 2015
eaf2412
Unused using
damianh Feb 19, 2015
688bfdf
Nancy.Tests.Function fixed to use ClaimsPrincipal.
damianh Feb 19, 2015
9f628ff
Removing RequiresValidatedClaims - doesn't make sense give we're usin…
damianh Feb 19, 2015
e75f8ee
Nancy.Demo.Authentication.Basic fixed to use ClaimsPrincipal
damianh Feb 19, 2015
462f8c1
Nancy.Demo.Authentication fixed to use ClaimsPrincipal
damianh Feb 19, 2015
54faddd
Fix Nancy.Damo.Authentication.Forms to support ClaimsPrincipal
damianh Feb 19, 2015
f9cf3f5
Nancy.Demo.Authentication.Stateless fixed to use ClaimsPrincipal.
damianh Feb 19, 2015
f4be219
Delete tests /requiresvalidatedclaims isn't a thing.
damianh Feb 19, 2015
6cd24e5
Fix typo
06b Feb 20, 2015
87a74ec
Fixed another typo
06b Feb 20, 2015
f9a48a5
Merge pull request #1825 from khellang/v2
horsdal Feb 22, 2015
4950480
Removing Nancy.Authentication.Token and all related projects. Token (…
damianh Mar 11, 2015
99b7989
Perhaps TargetFrameworkVersion should be 4.5?
damianh Mar 12, 2015
4160b7d
Because Nancy middleware is in own project, move middlware tests to N…
damianh Mar 12, 2015
9e5c6e9
Remove commented out code
damianh Mar 12, 2015
7e3bb35
Katana user and owin user flow through.
damianh Mar 12, 2015
e8ae7c4
Do NOT use static service location in NancyMiddleware. The will cause…
damianh Mar 12, 2015
0135cdd
Do NOT use static service location in NancyMiddleware. The will cause…
damianh Mar 20, 2015
1ebb69f
Fix test - explicitly set the NancyBootstrapperLocator.Bootstrapper
damianh Mar 20, 2015
65914a5
Merge pull request #1820 from damianh/v2-claims
grumpydev Mar 20, 2015
b4c6fe9
Added .vs-folder to .gitignore
thecodejunkie Aug 7, 2015
8775476
Implemented a new unified configuraton system
thecodejunkie Aug 7, 2015
a93cd26
Added XML comments to bootstrapper members
thecodejunkie Aug 8, 2015
122b3bd
Renamed GetValue methods, with default fallback, to GetValueWithDefault
thecodejunkie Aug 8, 2015
8f94312
Removed TODO comments
thecodejunkie Aug 8, 2015
eb74594
Added test for INancyEnvironmentExtensions
thecodejunkie Aug 8, 2015
85f7608
Fixed typo
thecodejunkie Aug 10, 2015
554692d
Added tests for DefaultNancyEnvironment
thecodejunkie Aug 10, 2015
bc9ec72
Added XML comment to NancyBootstrapperBase.Configure()
thecodejunkie Aug 10, 2015
ce2be86
Cleaned up code and typos
thecodejunkie Aug 10, 2015
05a18c9
First pass at removing NancyBootstrapperBase.DiagnosticsConfiguration
thecodejunkie Aug 11, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build/
[Dd]ebug/
[Oo]bj/
[Rr]elease/
_[Rr]e[Ss]harper.*/
_[Rr]e[Ss]harper*/
*.docstates
*.tss
*.ncrunchproject
Expand All @@ -25,3 +25,4 @@ _[Rr]e[Ss]harper.*/
src/_NCrunch_Nancy/
Thumbs.db
.idea
.vs
17 changes: 3 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
language: ruby
rvm:
- 1.9.3
language: csharp
solution: src/Nancy.sln
sudo: false
install:
- sudo bash -c "echo deb http://badgerports.org lucid main >> /etc/apt/sources.list"
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E1FAD0C
- sudo apt-get update
- sudo apt-get install mono-devel mono-gmcs mono-vbnc
- sudo apt-get install gettext
- sudo wget -q -P "/opt" "http://samples.nancyfx.org/content/mono-3.0.12-x64-bin.tar.bz2"
- gem install rake
- gem install albacore --version "1.0.0.rc2"
- echo \#\!/bin/bash >> ./travis.sh
- echo set -e >> ./travis.sh
- echo set -x >> ./travis.sh
- echo set -o pipefail >> ./travis.sh
- echo echo Running on Mono 2.x >> ./travis.sh
- echo rake mono >> ./travis.sh
- echo echo Running on Mono 3.x >> ./travis.sh
- echo sudo tar xkv -C "/opt" -f /opt/mono-3.0.12-x64-bin.tar.bz2 >> ./travis.sh
- echo export PATH="/opt/mono/bin:$PATH" >> ./travis.sh
- echo export LD_LIBRARY_PATH="/opt/mono/bin" >> ./travis.sh
- echo rake mono >> ./travis.sh
- chmod +x ./travis.sh
- cat travis.sh
Expand Down
2 changes: 1 addition & 1 deletion rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
desc "Compile solution file for Mono"
xbuild :compilemono => [:assembly_info] do |xb|
xb.solution = SOLUTION_FILE
xb.properties = { :configuration => CONFIGURATIONMONO, "TargetFrameworkProfile" => "", "TargetFrameworkVersion" => "v4.0" }
xb.properties = { :configuration => CONFIGURATIONMONO, "TargetFrameworkProfile" => "", "TargetFrameworkVersion" => "v4.5" }
end

desc "Gathers output files and copies them to the output folder"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System;
using FakeItEasy;
using Nancy.Tests;
using Xunit;

namespace Nancy.Authentication.Basic.Tests
namespace Nancy.Authentication.Basic.Tests
{
public class BasicAuthenticationConfigurationFixture
using System;

using FakeItEasy;

using Nancy.Tests;

using Xunit;

public class BasicAuthenticationConfigurationFixture
{
[Fact]
public void Should_throw_with_null_user_validator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
{
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Text;
using System.Threading;

using FakeItEasy;
using Nancy.Security;
using Nancy.Tests;
using Xunit;

using Nancy.Bootstrapper;
using Nancy.Tests;
using Nancy.Tests.Fakes;

using Xunit;

public class BasicAuthenticationFixture
{
private readonly BasicAuthenticationConfiguration config;
Expand Down Expand Up @@ -249,7 +252,7 @@ public void Should_set_user_in_context_with_valid_username_in_auth_header()
var fakePipelines = new Pipelines();

var validator = A.Fake<IUserValidator>();
var fakeUser = A.Fake<IUserIdentity>();
var fakeUser = A.Fake<ClaimsPrincipal>();
A.CallTo(() => validator.Validate("foo", "bar")).Returns(fakeUser);

var cfg = new BasicAuthenticationConfiguration(validator, "realm");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Nancy.Authentication.Basic.Tests</RootNamespace>
<AssemblyName>Nancy.Authentication.Basic.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
Expand All @@ -27,6 +27,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -37,6 +38,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -46,6 +48,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'MonoDebug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -64,6 +67,7 @@
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'MonoRelease|AnyCPU'">
<OutputPath>bin\MonoRelease\</OutputPath>
Expand All @@ -79,9 +83,11 @@
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="FakeItEasy">
<Reference Include="FakeItEasy, Version=1.19.0.0, Culture=neutral, PublicKeyToken=eff28e2146d5fd2c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FakeItEasy.1.19.0\lib\net40\FakeItEasy.dll</HintPath>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -123,11 +129,6 @@
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
Expand All @@ -150,6 +151,9 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
6 changes: 3 additions & 3 deletions src/Nancy.Authentication.Basic.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FakeItEasy" version="1.19.0" targetFramework="net40" />
<package id="xunit" version="1.9.1" targetFramework="net40" />
<package id="xunit.extensions" version="1.9.1" targetFramework="net40" />
<package id="FakeItEasy" version="1.19.0" targetFramework="net45" />
<package id="xunit" version="1.9.1" targetFramework="net45" />
<package id="xunit.extensions" version="1.9.1" targetFramework="net45" />
</packages>
1 change: 1 addition & 0 deletions src/Nancy.Authentication.Basic/BasicAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
using System;
using System.Text;

using Nancy.Bootstrapper;
using Nancy.Extensions;
using Nancy.Security;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Nancy.Authentication.Basic
{
using System;

/// <summary>
/// Configuration options for forms authentication
/// </summary>
Expand All @@ -13,7 +13,7 @@ public class BasicAuthenticationConfiguration
/// <param name="userValidator">A valid instance of <see cref="IUserValidator"/> class</param>
/// <param name="realm">Basic authentication realm</param>
/// <param name="userPromptBehaviour">Control when the browser should be instructed to prompt for credentials</param>
public BasicAuthenticationConfiguration(IUserValidator userValidator, string realm, UserPromptBehaviour userPromptBehaviour = Basic.UserPromptBehaviour.NonAjax)
public BasicAuthenticationConfiguration(IUserValidator userValidator, string realm, UserPromptBehaviour userPromptBehaviour = UserPromptBehaviour.NonAjax)
{
if (userValidator == null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nancy.Authentication.Basic/BasicHttpExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Nancy.Authentication.Basic
{
using Nancy.Bootstrapper;

/// <summary>
/// Some simple helpers give some nice authentication syntax in the modules.
/// </summary>
Expand Down
35 changes: 16 additions & 19 deletions src/Nancy.Authentication.Basic/IUserValidator.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Nancy.Authentication.Basic
namespace Nancy.Authentication.Basic
{
using Nancy.Security;
using System.Security.Claims;

/// <summary>
/// Provides a way to validate the username and password
/// </summary>
public interface IUserValidator
{
/// <summary>
/// Validates the username and password
/// </summary>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <returns>A value representing the authenticated user, null if the user was not authenticated.</returns>
IUserIdentity Validate(string username, string password);
}
}
/// <summary>
/// Provides a way to validate the username and password
/// </summary>
public interface IUserValidator
{
/// <summary>
/// Validates the username and password
/// </summary>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <returns>A value representing the authenticated user, null if the user was not authenticated.</returns>
ClaimsPrincipal Validate(string username, string password);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Nancy.Authentication.Basic</RootNamespace>
<AssemblyName>Nancy.Authentication.Basic</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
Expand All @@ -27,6 +27,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -38,6 +39,7 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\Debug\Nancy.Authentication.Basic.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -48,6 +50,7 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\Release\Nancy.Authentication.Basic.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'MonoDebug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -67,6 +70,7 @@
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
<DocumentationFile>bin\MonoDebug\Nancy.Authentication.Basic.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'MonoRelease|AnyCPU'">
<OutputPath>bin\MonoRelease\</OutputPath>
Expand All @@ -85,6 +89,7 @@
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\MonoRelease\Nancy.Authentication.Basic.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<tags>Nancy Authentication</tags>
</metadata>
<files>
<file src="build\binaries\Nancy.Authentication.Basic.dll" target="lib\net40" />
<file src="build\binaries\Nancy.Authentication.Basic.pdb" target="lib\net40" />
<file src="build\binaries\Nancy.Authentication.Basic.XML" target="lib\net40" />
<file src="build\binaries\Nancy.Authentication.Basic.dll" target="lib\net45" />
<file src="build\binaries\Nancy.Authentication.Basic.pdb" target="lib\net45" />
<file src="build\binaries\Nancy.Authentication.Basic.XML" target="lib\net45" />
<file src="src\Nancy.Authentication.Basic\**\*.cs" target="src" />
</files>
</package>
12 changes: 0 additions & 12 deletions src/Nancy.Authentication.Forms.Tests/Fakes/FakeUserIdentity.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Nancy.Authentication.Forms.Tests

using Nancy.Cryptography;
using Nancy.Tests;

using Xunit;

public class FormsAuthenticationConfigurationFixture
Expand Down
Loading