Move Context objects to OIDC and JwtBearer, remove generics.
This commit is contained in:
parent
e4f78176f9
commit
2aba485263
|
|
@ -5,9 +5,10 @@ using Microsoft.AspNet.Http;
|
|||
|
||||
namespace Microsoft.AspNet.Authentication.JwtBearer
|
||||
{
|
||||
public class AuthenticationChallengeContext<TOptions> : BaseControlContext<TOptions>
|
||||
public class AuthenticationChallengeContext : BaseControlContext<JwtBearerAuthenticationOptions>
|
||||
{
|
||||
public AuthenticationChallengeContext(HttpContext context, TOptions options) : base(context, options)
|
||||
public AuthenticationChallengeContext(HttpContext context, JwtBearerAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,15 @@
|
|||
using System;
|
||||
using Microsoft.AspNet.Http;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication
|
||||
namespace Microsoft.AspNet.Authentication.JwtBearer
|
||||
{
|
||||
public class AuthenticationFailedContext<TMessage, TOptions> : BaseControlContext<TOptions>
|
||||
public class AuthenticationFailedContext : BaseControlContext<JwtBearerAuthenticationOptions>
|
||||
{
|
||||
public AuthenticationFailedContext(HttpContext context, TOptions options) : base(context, options)
|
||||
public AuthenticationFailedContext(HttpContext context, JwtBearerAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
public Exception Exception { get; set; }
|
||||
|
||||
public TMessage ProtocolMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -30,26 +30,26 @@ namespace Microsoft.AspNet.Authentication.JwtBearer
|
|||
/// <summary>
|
||||
/// Invoked if exceptions are thrown during request processing. The exceptions will be re-thrown after this event unless suppressed.
|
||||
/// </summary>
|
||||
public Func<AuthenticationFailedContext<HttpContext, JwtBearerAuthenticationOptions>, Task> AuthenticationFailed { get; set; }
|
||||
public Func<AuthenticationFailedContext, Task> AuthenticationFailed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when a protocol message is first received.
|
||||
/// </summary>
|
||||
public Func<MessageReceivedContext<HttpContext, JwtBearerAuthenticationOptions>, Task> MessageReceived { get; set; }
|
||||
public Func<MessageReceivedContext, Task> MessageReceived { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked with the security token that has been extracted from the protocol message.
|
||||
/// </summary>
|
||||
public Func<SecurityTokenReceivedContext<HttpContext, JwtBearerAuthenticationOptions>, Task> SecurityTokenReceived { get; set; }
|
||||
public Func<SecurityTokenReceivedContext, Task> SecurityTokenReceived { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked after the security token has passed validation and a ClaimsIdentity has been generated.
|
||||
/// </summary>
|
||||
public Func<SecurityTokenValidatedContext<HttpContext, JwtBearerAuthenticationOptions>, Task> SecurityTokenValidated { get; set; }
|
||||
public Func<SecurityTokenValidatedContext, Task> SecurityTokenValidated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked to apply a challenge sent back to the caller.
|
||||
/// </summary>
|
||||
public Func<AuthenticationChallengeContext<JwtBearerAuthenticationOptions>, Task> ApplyChallenge { get; set; }
|
||||
public Func<AuthenticationChallengeContext, Task> ApplyChallenge { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,16 +3,15 @@
|
|||
|
||||
using Microsoft.AspNet.Http;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication
|
||||
namespace Microsoft.AspNet.Authentication.JwtBearer
|
||||
{
|
||||
public class MessageReceivedContext<TMessage, TOptions> : BaseControlContext<TOptions>
|
||||
public class MessageReceivedContext : BaseControlContext<JwtBearerAuthenticationOptions>
|
||||
{
|
||||
public MessageReceivedContext(HttpContext context, TOptions options) : base(context, options)
|
||||
public MessageReceivedContext(HttpContext context, JwtBearerAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
public TMessage ProtocolMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bearer Token. This will give application an opportunity to retrieve token from an alternation location.
|
||||
/// </summary>
|
||||
|
|
@ -3,16 +3,15 @@
|
|||
|
||||
using Microsoft.AspNet.Http;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication
|
||||
namespace Microsoft.AspNet.Authentication.JwtBearer
|
||||
{
|
||||
public class SecurityTokenReceivedContext<TMessage, TOptions> : BaseControlContext<TOptions>
|
||||
public class SecurityTokenReceivedContext : BaseControlContext<JwtBearerAuthenticationOptions>
|
||||
{
|
||||
public SecurityTokenReceivedContext(HttpContext context, TOptions options) : base(context, options)
|
||||
public SecurityTokenReceivedContext(HttpContext context, JwtBearerAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
public string SecurityToken { get; set; }
|
||||
|
||||
public TMessage ProtocolMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -3,14 +3,13 @@
|
|||
|
||||
using Microsoft.AspNet.Http;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication
|
||||
namespace Microsoft.AspNet.Authentication.JwtBearer
|
||||
{
|
||||
public class SecurityTokenValidatedContext<TMessage, TOptions> : BaseControlContext<TOptions>
|
||||
public class SecurityTokenValidatedContext : BaseControlContext<JwtBearerAuthenticationOptions>
|
||||
{
|
||||
public SecurityTokenValidatedContext(HttpContext context, TOptions options) : base(context, options)
|
||||
public SecurityTokenValidatedContext(HttpContext context, JwtBearerAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
public TMessage ProtocolMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -27,11 +27,7 @@ namespace Microsoft.AspNet.Authentication.JwtBearer
|
|||
try
|
||||
{
|
||||
// Give application opportunity to find from a different location, adjust, or reject token
|
||||
var messageReceivedContext =
|
||||
new MessageReceivedContext<HttpContext, JwtBearerAuthenticationOptions>(Context, Options)
|
||||
{
|
||||
ProtocolMessage = Context,
|
||||
};
|
||||
var messageReceivedContext = new MessageReceivedContext(Context, Options);
|
||||
|
||||
// event can set the token
|
||||
await Options.Events.MessageReceived(messageReceivedContext);
|
||||
|
|
@ -71,10 +67,8 @@ namespace Microsoft.AspNet.Authentication.JwtBearer
|
|||
}
|
||||
|
||||
// notify user token was received
|
||||
var securityTokenReceivedContext =
|
||||
new SecurityTokenReceivedContext<HttpContext, JwtBearerAuthenticationOptions>(Context, Options)
|
||||
var securityTokenReceivedContext = new SecurityTokenReceivedContext(Context, Options)
|
||||
{
|
||||
ProtocolMessage = Context,
|
||||
SecurityToken = token,
|
||||
};
|
||||
|
||||
|
|
@ -117,9 +111,8 @@ namespace Microsoft.AspNet.Authentication.JwtBearer
|
|||
{
|
||||
var principal = validator.ValidateToken(token, validationParameters, out validatedToken);
|
||||
var ticket = new AuthenticationTicket(principal, new AuthenticationProperties(), Options.AuthenticationScheme);
|
||||
var securityTokenValidatedContext = new SecurityTokenValidatedContext<HttpContext, JwtBearerAuthenticationOptions>(Context, Options)
|
||||
var securityTokenValidatedContext = new SecurityTokenValidatedContext(Context, Options)
|
||||
{
|
||||
ProtocolMessage = Context,
|
||||
AuthenticationTicket = ticket
|
||||
};
|
||||
|
||||
|
|
@ -150,12 +143,10 @@ namespace Microsoft.AspNet.Authentication.JwtBearer
|
|||
Options.ConfigurationManager.RequestRefresh();
|
||||
}
|
||||
|
||||
var authenticationFailedContext =
|
||||
new AuthenticationFailedContext<HttpContext, JwtBearerAuthenticationOptions>(Context, Options)
|
||||
{
|
||||
ProtocolMessage = Context,
|
||||
Exception = ex
|
||||
};
|
||||
var authenticationFailedContext = new AuthenticationFailedContext(Context, Options)
|
||||
{
|
||||
Exception = ex
|
||||
};
|
||||
|
||||
await Options.Events.AuthenticationFailed(authenticationFailedContext);
|
||||
if (authenticationFailedContext.HandledResponse)
|
||||
|
|
@ -175,7 +166,7 @@ namespace Microsoft.AspNet.Authentication.JwtBearer
|
|||
protected override async Task<bool> HandleUnauthorizedAsync(ChallengeContext context)
|
||||
{
|
||||
Response.StatusCode = 401;
|
||||
await Options.Events.ApplyChallenge(new AuthenticationChallengeContext<JwtBearerAuthenticationOptions>(Context, Options));
|
||||
await Options.Events.ApplyChallenge(new AuthenticationChallengeContext(Context, Options));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http.Authentication;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication.OAuth
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
||||
{
|
||||
public class AuthenticationFailedContext : BaseControlContext<OpenIdConnectAuthenticationOptions>
|
||||
{
|
||||
public AuthenticationFailedContext(HttpContext context, OpenIdConnectAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
public Exception Exception { get; set; }
|
||||
|
||||
public OpenIdConnectMessage ProtocolMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
||||
{
|
||||
|
|
@ -16,7 +16,8 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
/// <summary>
|
||||
/// Creates a <see cref="AuthorizationCodeReceivedContext"/>
|
||||
/// </summary>
|
||||
public AuthorizationCodeReceivedContext(HttpContext context, OpenIdConnectAuthenticationOptions options) : base(context, options)
|
||||
public AuthorizationCodeReceivedContext(HttpContext context, OpenIdConnectAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
/// <summary>
|
||||
/// Creates a <see cref="AuthorizationCodeRedeemedContext"/>
|
||||
/// </summary>
|
||||
public AuthorizationCodeRedeemedContext(HttpContext context, OpenIdConnectAuthenticationOptions options) : base(context, options)
|
||||
public AuthorizationCodeRedeemedContext(HttpContext context, OpenIdConnectAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
||||
{
|
||||
public class MessageReceivedContext : BaseControlContext<OpenIdConnectAuthenticationOptions>
|
||||
{
|
||||
public MessageReceivedContext(HttpContext context, OpenIdConnectAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
public OpenIdConnectMessage ProtocolMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bearer Token. This will give application an opportunity to retrieve token from an alternation location.
|
||||
/// </summary>
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
||||
{
|
||||
|
|
@ -21,15 +20,15 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
AuthorizationCodeReceived = context => Task.FromResult(0);
|
||||
AuthorizationCodeRedeemed = context => Task.FromResult(0);
|
||||
MessageReceived = context => Task.FromResult(0);
|
||||
RedirectToIdentityProvider = context => Task.FromResult(0);
|
||||
SecurityTokenReceived = context => Task.FromResult(0);
|
||||
SecurityTokenValidated = context => Task.FromResult(0);
|
||||
RedirectToIdentityProvider = context => Task.FromResult(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked if exceptions are thrown during request processing. The exceptions will be re-thrown after this event unless suppressed.
|
||||
/// </summary>
|
||||
public Func<AuthenticationFailedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>, Task> AuthenticationFailed { get; set; }
|
||||
public Func<AuthenticationFailedContext, Task> AuthenticationFailed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked after security token validation if an authorization code is present in the protocol message.
|
||||
|
|
@ -44,21 +43,21 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
/// <summary>
|
||||
/// Invoked when a protocol message is first received.
|
||||
/// </summary>
|
||||
public Func<MessageReceivedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>, Task> MessageReceived { get; set; }
|
||||
public Func<MessageReceivedContext, Task> MessageReceived { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked to manipulate redirects to the identity provider for SignIn, SignOut, or Challenge.
|
||||
/// </summary>
|
||||
public Func<RedirectToIdentityProviderContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>, Task> RedirectToIdentityProvider { get; set; }
|
||||
public Func<RedirectToIdentityProviderContext, Task> RedirectToIdentityProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked with the security token that has been extracted from the protocol message.
|
||||
/// </summary>
|
||||
public Func<SecurityTokenReceivedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>, Task> SecurityTokenReceived { get; set; }
|
||||
public Func<SecurityTokenReceivedContext, Task> SecurityTokenReceived { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked after the security token has passed validation and a ClaimsIdentity has been generated.
|
||||
/// </summary>
|
||||
public Func<SecurityTokenValidatedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>, Task> SecurityTokenValidated { get; set; }
|
||||
public Func<SecurityTokenValidatedContext, Task> SecurityTokenValidated { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -2,12 +2,13 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication
|
||||
namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
||||
{
|
||||
public class RedirectFromIdentityProviderContext<TMessage, TOptions> : BaseControlContext<TOptions>
|
||||
public class RedirectFromIdentityProviderContext : BaseControlContext<OpenIdConnectAuthenticationOptions>
|
||||
{
|
||||
public RedirectFromIdentityProviderContext(HttpContext context, TOptions options)
|
||||
public RedirectFromIdentityProviderContext(HttpContext context, OpenIdConnectAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
|
@ -16,6 +17,6 @@ namespace Microsoft.AspNet.Authentication
|
|||
|
||||
public bool IsRequestCompleted { get; set; }
|
||||
|
||||
public TMessage ProtocolMessage { get; set; }
|
||||
public OpenIdConnectMessage ProtocolMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -4,25 +4,27 @@
|
|||
using System;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication
|
||||
namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
||||
{
|
||||
/// <summary>
|
||||
/// When a user configures the <see cref="AuthenticationMiddleware{TOptions}"/> to be notified prior to redirecting to an IdentityProvider
|
||||
/// an instance of <see cref="RedirectFromIdentityProviderContext{TMessage, TOptions, TMessage}"/> is passed to the 'RedirectToIdentityProviderContext".
|
||||
/// an instance of <see cref="RedirectFromIdentityProviderContext"/> is passed to the 'RedirectToIdentityProviderContext".
|
||||
/// </summary>
|
||||
/// <typeparam name="TMessage">protocol specific message.</typeparam>
|
||||
/// <typeparam name="TOptions">protocol specific options.</typeparam>
|
||||
public class RedirectToIdentityProviderContext<TMessage, TOptions> : BaseControlContext<TOptions>
|
||||
public class RedirectToIdentityProviderContext : BaseControlContext<OpenIdConnectAuthenticationOptions>
|
||||
{
|
||||
public RedirectToIdentityProviderContext([NotNull] HttpContext context, [NotNull] TOptions options) : base(context, options)
|
||||
public RedirectToIdentityProviderContext([NotNull] HttpContext context, [NotNull] OpenIdConnectAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="{TMessage}"/>.
|
||||
/// Gets or sets the <see cref="OpenIdConnectMessage"/>.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentNullException">if 'value' is null.</exception>
|
||||
public TMessage ProtocolMessage { get; [param: NotNull] set; }
|
||||
public OpenIdConnectMessage ProtocolMessage { get; [param: NotNull] set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
||||
{
|
||||
public class SecurityTokenReceivedContext : BaseControlContext<OpenIdConnectAuthenticationOptions>
|
||||
{
|
||||
public SecurityTokenReceivedContext(HttpContext context, OpenIdConnectAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
public string SecurityToken { get; set; }
|
||||
|
||||
public OpenIdConnectMessage ProtocolMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||
|
||||
namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
||||
{
|
||||
public class SecurityTokenValidatedContext : BaseControlContext<OpenIdConnectAuthenticationOptions>
|
||||
{
|
||||
public SecurityTokenValidatedContext(HttpContext context, OpenIdConnectAuthenticationOptions options)
|
||||
: base(context, options)
|
||||
{
|
||||
}
|
||||
|
||||
public OpenIdConnectMessage ProtocolMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
message.PostLogoutRedirectUri = Options.PostLogoutRedirectUri;
|
||||
}
|
||||
|
||||
var redirectToIdentityProviderContext = new RedirectToIdentityProviderContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>(Context, Options)
|
||||
var redirectToIdentityProviderContext = new RedirectToIdentityProviderContext(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message
|
||||
};
|
||||
|
|
@ -220,11 +220,10 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
}
|
||||
}
|
||||
|
||||
var redirectToIdentityProviderContext =
|
||||
new RedirectToIdentityProviderContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message
|
||||
};
|
||||
var redirectToIdentityProviderContext = new RedirectToIdentityProviderContext(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message
|
||||
};
|
||||
|
||||
await Options.Events.RedirectToIdentityProvider(redirectToIdentityProviderContext);
|
||||
if (redirectToIdentityProviderContext.HandledResponse)
|
||||
|
|
@ -745,14 +744,13 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
}
|
||||
}
|
||||
|
||||
private async Task<MessageReceivedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>> RunMessageReceivedEventAsync(OpenIdConnectMessage message)
|
||||
private async Task<MessageReceivedContext> RunMessageReceivedEventAsync(OpenIdConnectMessage message)
|
||||
{
|
||||
Logger.LogDebug(Resources.OIDCH_0001_MessageReceived, message.BuildRedirectUrl());
|
||||
var messageReceivedContext =
|
||||
new MessageReceivedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message
|
||||
};
|
||||
var messageReceivedContext = new MessageReceivedContext(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message
|
||||
};
|
||||
|
||||
await Options.Events.MessageReceived(messageReceivedContext);
|
||||
if (messageReceivedContext.HandledResponse)
|
||||
|
|
@ -818,14 +816,13 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
return authorizationCodeRedeemedContext;
|
||||
}
|
||||
|
||||
private async Task<SecurityTokenReceivedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>> RunSecurityTokenReceivedEventAsync(OpenIdConnectMessage message)
|
||||
private async Task<SecurityTokenReceivedContext> RunSecurityTokenReceivedEventAsync(OpenIdConnectMessage message)
|
||||
{
|
||||
Logger.LogDebug(Resources.OIDCH_0020_IdTokenReceived, message.IdToken);
|
||||
var securityTokenReceivedContext =
|
||||
new SecurityTokenReceivedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message,
|
||||
};
|
||||
var securityTokenReceivedContext = new SecurityTokenReceivedContext(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message,
|
||||
};
|
||||
|
||||
await Options.Events.SecurityTokenReceived(securityTokenReceivedContext);
|
||||
if (securityTokenReceivedContext.HandledResponse)
|
||||
|
|
@ -840,14 +837,13 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
return securityTokenReceivedContext;
|
||||
}
|
||||
|
||||
private async Task<SecurityTokenValidatedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>> RunSecurityTokenValidatedEventAsync(OpenIdConnectMessage message, AuthenticationTicket ticket)
|
||||
private async Task<SecurityTokenValidatedContext> RunSecurityTokenValidatedEventAsync(OpenIdConnectMessage message, AuthenticationTicket ticket)
|
||||
{
|
||||
var securityTokenValidatedContext =
|
||||
new SecurityTokenValidatedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>(Context, Options)
|
||||
{
|
||||
AuthenticationTicket = ticket,
|
||||
ProtocolMessage = message
|
||||
};
|
||||
var securityTokenValidatedContext = new SecurityTokenValidatedContext(Context, Options)
|
||||
{
|
||||
AuthenticationTicket = ticket,
|
||||
ProtocolMessage = message
|
||||
};
|
||||
|
||||
await Options.Events.SecurityTokenValidated(securityTokenValidatedContext);
|
||||
if (securityTokenValidatedContext.HandledResponse)
|
||||
|
|
@ -862,14 +858,13 @@ namespace Microsoft.AspNet.Authentication.OpenIdConnect
|
|||
return securityTokenValidatedContext;
|
||||
}
|
||||
|
||||
private async Task<AuthenticationFailedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>> RunAuthenticationFailedEventAsync(OpenIdConnectMessage message, Exception exception)
|
||||
private async Task<AuthenticationFailedContext> RunAuthenticationFailedEventAsync(OpenIdConnectMessage message, Exception exception)
|
||||
{
|
||||
var authenticationFailedContext =
|
||||
new AuthenticationFailedContext<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message,
|
||||
Exception = exception
|
||||
};
|
||||
var authenticationFailedContext = new AuthenticationFailedContext(Context, Options)
|
||||
{
|
||||
ProtocolMessage = message,
|
||||
Exception = exception
|
||||
};
|
||||
|
||||
await Options.Events.AuthenticationFailed(authenticationFailedContext);
|
||||
if (authenticationFailedContext.HandledResponse)
|
||||
|
|
|
|||
Loading…
Reference in New Issue