Skip to content
This repository was archived by the owner on Oct 17, 2018. It is now read-only.

Update to AspNetCore 2.0.0 #19

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>chrisdrobison</Authors>
<Company />
<Description>A port of the Katana WsFederation middleware for ASP.NET Core.</Description>
Expand All @@ -14,14 +14,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.0.0" />
<PackageReference Include="Microsoft.IdentityModel.Protocol.Extensions" Version="1.0.4.403061554" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.IdentityModel" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.IdentityModel.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Net.Http.WebRequest.dll</HintPath>
</Reference>
</ItemGroup>

</Project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@

namespace AspNetCore.Authentication.WsFederation
{
public class BaseWsFederationContext : BaseControlContext
public class BaseWsFederationContext : HandleRequestContext<RemoteAuthenticationOptions>
{
public BaseWsFederationContext(HttpContext context, WsFederationAuthenticationOptions options) : base(context)
public BaseWsFederationContext(HttpContext context, WsFederationAuthenticationOptions options, AuthenticationScheme authenticationScheme) :
base(context, authenticationScheme, options)
{
Options = options ?? throw new ArgumentNullException(nameof(options));
}

public WsFederationAuthenticationOptions Options { get; }

public WsFederationMessage ProtocolMessage { get; set; }
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using AuthenticationProperties = Microsoft.AspNetCore.Http.Authentication.AuthenticationProperties;

namespace AspNetCore.Authentication.WsFederation
{
public class RedirectContext : BaseWsFederationContext
{
public RedirectContext(HttpContext context, WsFederationAuthenticationOptions options) : base(context, options)
public RedirectContext(HttpContext context, WsFederationAuthenticationOptions options, AuthenticationScheme authenticationScheme) : base(context, options, authenticationScheme)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;

namespace AspNetCore.Authentication.WsFederation.Events
{
public class SecurityTokenContext : BaseWsFederationContext
{
public SecurityTokenContext(HttpContext context, WsFederationAuthenticationOptions options)
: base(context, options)
public SecurityTokenContext(HttpContext context, WsFederationAuthenticationOptions options, AuthenticationScheme authenticationScheme) : base(context, options, authenticationScheme)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ namespace AspNetCore.Authentication.WsFederation.Events
{
public class SecurityTokenValidatedContext : BaseWsFederationContext
{
public SecurityTokenValidatedContext(HttpContext context, WsFederationAuthenticationOptions options)
: base(context, options)
public SecurityTokenValidatedContext(HttpContext context, WsFederationAuthenticationOptions options, AuthenticationScheme authenticationScheme) : base(context, options, authenticationScheme)
{
}

public AuthenticationTicket Ticket { get; set; }
}
}
47 changes: 23 additions & 24 deletions AspNetCore.Authentication.WsFederation/Events/WsFederationEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,46 @@ namespace AspNetCore.Authentication.WsFederation
/// <summary>
/// Specifies events which the <see cref="WsFederationAuthenticationMiddleware"></see> invokes to enable developer control over the authentication process. />
/// </summary>
public class WsFederationEvents : RemoteAuthenticationEvents, IWsFederationEvents
public class WsFederationEvents : RemoteAuthenticationEvents
{

/// <summary>
/// Invoked if exceptions are thrown during request processing. The exceptions will be re-thrown after this event unless suppressed.
/// Invoked to manipulate redirects to the identity provider for SignIn, SignOut, or Challenge.
/// </summary>
public Func<AuthenticationFailedContext, Task> OnAuthenticationFailed { get; set; } =
context => TaskCache.CompletedTask;
public Func<RedirectContext, Task> OnRedirectToIdentityProvider { get; set; } = context => TaskCache.CompletedTask;

/// <summary>
/// Invoked when a protocol message is first received.
/// Invoked with the security token that has been extracted from the protocol message.
/// </summary>
public Func<SecurityTokenContext, Task> OnSecurityTokenReceived { get; set; } = context => TaskCache.CompletedTask;

/// <summary>
/// Invoked after the security token has passed validation and a ClaimsIdentity has been generated.
/// </summary>
public Func<MessageReceivedContext, Task> OnMessageReceived { get; set; } =
context => TaskCache.CompletedTask;
public Func<SecurityTokenValidatedContext, Task> OnSecurityTokenValidated { get; set; } = context => TaskCache.CompletedTask;

/// <summary>
/// Invoked to manipulate redirects to the identity provider for SignIn, SignOut, or Challenge.
/// </summary>
public Func<RedirectContext, Task> OnRedirectToIdentityProvider { get; set; } =
context => TaskCache.CompletedTask;
public virtual Task RedirectToIdentityProvider(RedirectContext context)
{
return this.OnRedirectToIdentityProvider(context);
}

/// <summary>
/// Invoked with the security token that has been extracted from the protocol message.
/// </summary>
public Func<SecurityTokenContext, Task> OnSecurityTokenReceived { get; set; } =
context => TaskCache.CompletedTask;
public virtual Task SecurityTokenReceived(SecurityTokenContext context)
{
return this.OnSecurityTokenReceived(context);
}

/// <summary>
/// Invoked after the security token has passed validation and a ClaimsIdentity has been generated.
/// </summary>
public Func<SecurityTokenValidatedContext, Task> OnSecurityTokenValidated { get; set; } =
context => TaskCache.CompletedTask;


public virtual Task AuthenticationFailed(AuthenticationFailedContext context) => OnAuthenticationFailed(context);

public virtual Task MessageReceived(MessageReceivedContext context) => OnMessageReceived(context);

public Task RedirectToIdentityProvider(RedirectContext context) => OnRedirectToIdentityProvider(context);

public Task SecurityTokenReceived(SecurityTokenContext context) => OnSecurityTokenReceived(context);

public Task SecurityTokenValidated(SecurityTokenValidatedContext context) => OnSecurityTokenValidated(context);
public virtual Task SecurityTokenValidated(SecurityTokenValidatedContext context)
{
return this.OnSecurityTokenValidated(context);
}
}
}

This file was deleted.

Loading