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

Commit 725088a

Browse files
committed
Rename IdTokenValidated to AuthenticationValidated.
1 parent acc3f6c commit 725088a

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

src/Microsoft.AspNet.Authentication.OpenIdConnect/Events/IdTokenValidatedContext.cs renamed to src/Microsoft.AspNet.Authentication.OpenIdConnect/Events/AuthenticationValidatedContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace Microsoft.AspNet.Authentication.OpenIdConnect
88
{
9-
public class IdTokenValidatedContext : BaseControlContext<OpenIdConnectOptions>
9+
public class AuthenticationValidatedContext : BaseControlContext<OpenIdConnectOptions>
1010
{
11-
public IdTokenValidatedContext(HttpContext context, OpenIdConnectOptions options)
11+
public AuthenticationValidatedContext(HttpContext context, OpenIdConnectOptions options)
1212
: base(context, options)
1313
{
1414
}

src/Microsoft.AspNet.Authentication.OpenIdConnect/Events/IOpenIdConnectEvents.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public interface IOpenIdConnectEvents
2020
/// </summary>
2121
Task AuthenticationFailed(AuthenticationFailedContext context);
2222

23+
/// <summary>
24+
/// Invoked after the id token has passed validation and a ClaimsIdentity has been generated.
25+
/// </summary>
26+
Task AuthenticationValidated(AuthenticationValidatedContext context);
27+
2328
/// <summary>
2429
/// Invoked after security token validation if an authorization code is present in the protocol message.
2530
/// </summary>
@@ -30,11 +35,6 @@ public interface IOpenIdConnectEvents
3035
/// </summary>
3136
Task AuthorizationResponseReceived(AuthorizationResponseReceivedContext context);
3237

33-
/// <summary>
34-
/// Invoked after the id token has passed validation and a ClaimsIdentity has been generated.
35-
/// </summary>
36-
Task IdTokenValidated(IdTokenValidatedContext context);
37-
3838
/// <summary>
3939
/// Invoked when a protocol message is first received.
4040
/// </summary>

src/Microsoft.AspNet.Authentication.OpenIdConnect/Events/OpenIdConnectEvents.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public class OpenIdConnectEvents : IOpenIdConnectEvents
2121
/// </summary>
2222
public Func<AuthenticationFailedContext, Task> OnAuthenticationFailed { get; set; } = context => Task.FromResult(0);
2323

24+
/// <summary>
25+
/// Invoked after the id token has passed validation and a ClaimsIdentity has been generated.
26+
/// </summary>
27+
public Func<AuthenticationValidatedContext, Task> OnAuthenticationValidated { get; set; } = context => Task.FromResult(0);
28+
2429
/// <summary>
2530
/// Invoked after security token validation if an authorization code is present in the protocol message.
2631
/// </summary>
@@ -31,11 +36,6 @@ public class OpenIdConnectEvents : IOpenIdConnectEvents
3136
/// </summary>
3237
public Func<AuthorizationResponseReceivedContext, Task> OnAuthorizationResponseReceived { get; set; } = context => Task.FromResult(0);
3338

34-
/// <summary>
35-
/// Invoked after the id token has passed validation and a ClaimsIdentity has been generated.
36-
/// </summary>
37-
public Func<IdTokenValidatedContext, Task> OnIdTokenValidated { get; set; } = context => Task.FromResult(0);
38-
3939
/// <summary>
4040
/// Invoked when a protocol message is first received.
4141
/// </summary>
@@ -65,12 +65,12 @@ public class OpenIdConnectEvents : IOpenIdConnectEvents
6565

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

68+
public virtual Task AuthenticationValidated(AuthenticationValidatedContext context) => OnAuthenticationValidated(context);
69+
6870
public virtual Task AuthorizationCodeReceived(AuthorizationCodeReceivedContext context) => OnAuthorizationCodeReceived(context);
6971

7072
public virtual Task AuthorizationResponseReceived(AuthorizationResponseReceivedContext context) => OnAuthorizationResponseReceived(context);
7173

72-
public virtual Task IdTokenValidated(IdTokenValidatedContext context) => OnIdTokenValidated(context);
73-
7474
public virtual Task MessageReceived(MessageReceivedContext context) => OnMessageReceived(context);
7575

7676
public virtual Task RedirectToAuthenticationEndpoint(RedirectContext context) => OnRedirectToAuthenticationEndpoint(context);

src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectHandler.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -493,16 +493,16 @@ private async Task<AuthenticationTicket> HandleCodeOnlyFlow(OpenIdConnectMessage
493493

494494
await ValidateOpenIdConnectProtocolAsync(null, message);
495495

496-
var securityTokenValidatedContext = await RunIdTokenValidatedEventAsync(message, ticket, tokenEndpointResponse);
497-
if (securityTokenValidatedContext.HandledResponse)
496+
var authenticationValidatedContext = await RunAuthenticationValidatedEventAsync(message, ticket, tokenEndpointResponse);
497+
if (authenticationValidatedContext.HandledResponse)
498498
{
499-
return securityTokenValidatedContext.AuthenticationTicket;
499+
return authenticationValidatedContext.AuthenticationTicket;
500500
}
501-
else if (securityTokenValidatedContext.Skipped)
501+
else if (authenticationValidatedContext.Skipped)
502502
{
503503
return null;
504504
}
505-
ticket = securityTokenValidatedContext.AuthenticationTicket;
505+
ticket = authenticationValidatedContext.AuthenticationTicket;
506506

507507
if (Options.GetClaimsFromUserInfoEndpoint)
508508
{
@@ -524,17 +524,17 @@ private async Task<AuthenticationTicket> HandleIdTokenFlows(OpenIdConnectMessage
524524

525525
await ValidateOpenIdConnectProtocolAsync(jwt, message);
526526

527-
var idTokenValidatedContext = await RunIdTokenValidatedEventAsync(message, ticket, tokenEndpointResponse: null);
528-
if (idTokenValidatedContext.HandledResponse)
527+
var authenticationValidatedContext = await RunAuthenticationValidatedEventAsync(message, ticket, tokenEndpointResponse: null);
528+
if (authenticationValidatedContext.HandledResponse)
529529
{
530-
return idTokenValidatedContext.AuthenticationTicket;
530+
return authenticationValidatedContext.AuthenticationTicket;
531531
}
532-
else if (idTokenValidatedContext.Skipped)
532+
else if (authenticationValidatedContext.Skipped)
533533
{
534534
return null;
535535
}
536-
message = idTokenValidatedContext.ProtocolMessage;
537-
ticket = idTokenValidatedContext.AuthenticationTicket;
536+
message = authenticationValidatedContext.ProtocolMessage;
537+
ticket = authenticationValidatedContext.AuthenticationTicket;
538538

539539
// Hybrid Flow
540540
if (message.Code != null)
@@ -889,26 +889,26 @@ private async Task<TokenResponseReceivedContext> RunTokenResponseReceivedEventAs
889889
return tokenResponseReceivedContext;
890890
}
891891

892-
private async Task<IdTokenValidatedContext> RunIdTokenValidatedEventAsync(OpenIdConnectMessage message, AuthenticationTicket ticket, OpenIdConnectTokenEndpointResponse tokenEndpointResponse)
892+
private async Task<AuthenticationValidatedContext> RunAuthenticationValidatedEventAsync(OpenIdConnectMessage message, AuthenticationTicket ticket, OpenIdConnectTokenEndpointResponse tokenEndpointResponse)
893893
{
894-
var idTokenValidatedContext = new IdTokenValidatedContext(Context, Options)
894+
var authenticationValidatedContext = new AuthenticationValidatedContext(Context, Options)
895895
{
896896
AuthenticationTicket = ticket,
897897
ProtocolMessage = message,
898898
TokenEndpointResponse = tokenEndpointResponse,
899899
};
900900

901-
await Options.Events.IdTokenValidated(idTokenValidatedContext);
902-
if (idTokenValidatedContext.HandledResponse)
901+
await Options.Events.AuthenticationValidated(authenticationValidatedContext);
902+
if (authenticationValidatedContext.HandledResponse)
903903
{
904-
Logger.LogVerbose("The IdTokenValidated event returned Handled.");
904+
Logger.LogVerbose("AuthenticationValidated.HandledResponse");
905905
}
906-
else if (idTokenValidatedContext.Skipped)
906+
else if (authenticationValidatedContext.Skipped)
907907
{
908-
Logger.LogVerbose("The IdTokenValidated event returned Skipped.");
908+
Logger.LogVerbose("AuthenticationValidated.Skipped");
909909
}
910910

911-
return idTokenValidatedContext;
911+
return authenticationValidatedContext;
912912
}
913913

914914
private async Task<UserInformationReceivedContext> RunUserInformationReceivedEventAsync(AuthenticationTicket ticket, OpenIdConnectMessage message, JObject user)

0 commit comments

Comments
 (0)