React to renames from Auth

This commit is contained in:
Ryan Nowak 2015-09-16 17:21:01 -07:00
parent 3382b82e5e
commit 47866ac5db
3 changed files with 21 additions and 21 deletions

View File

@ -20,19 +20,19 @@ namespace MusicStore.Mocks.OpenIdConnect
return Task.FromResult(0); return Task.FromResult(0);
} }
internal static Task SecurityTokenReceived(SecurityTokenReceivedContext context) internal static Task AuthenticationValidated(AuthenticationValidatedContext context)
{ {
eventsFired.Add(nameof(SecurityTokenReceived)); eventsFired.Add(nameof(AuthenticationValidated));
return Task.FromResult(0); return Task.FromResult(0);
} }
internal static Task SecurityTokenValidated(SecurityTokenValidatedContext context) internal static Task AuthorizationResponseRecieved(AuthorizationResponseReceivedContext context)
{ {
Helpers.ThrowIfConditionFailed(() => context.AuthenticationTicket != null, "context.AuthenticationTicket is null."); Helpers.ThrowIfConditionFailed(() => context.AuthenticationTicket != null, "context.AuthenticationTicket is null.");
Helpers.ThrowIfConditionFailed(() => context.AuthenticationTicket.Principal != null, "context.AuthenticationTicket.Principal is null."); Helpers.ThrowIfConditionFailed(() => context.AuthenticationTicket.Principal != null, "context.AuthenticationTicket.Principal is null.");
Helpers.ThrowIfConditionFailed(() => context.AuthenticationTicket.Principal.Identity != null, "context.AuthenticationTicket.Principal.Identity is null."); Helpers.ThrowIfConditionFailed(() => context.AuthenticationTicket.Principal.Identity != null, "context.AuthenticationTicket.Principal.Identity is null.");
Helpers.ThrowIfConditionFailed(() => !string.IsNullOrWhiteSpace(context.AuthenticationTicket.Principal.Identity.Name), "context.AuthenticationTicket.Principal.Identity.Name is null."); Helpers.ThrowIfConditionFailed(() => !string.IsNullOrWhiteSpace(context.AuthenticationTicket.Principal.Identity.Name), "context.AuthenticationTicket.Principal.Identity.Name is null.");
eventsFired.Add(nameof(SecurityTokenValidated)); eventsFired.Add(nameof(AuthorizationResponseRecieved));
return Task.FromResult(0); return Task.FromResult(0);
} }
@ -43,10 +43,10 @@ namespace MusicStore.Mocks.OpenIdConnect
eventsFired.Add(nameof(AuthorizationCodeReceived)); eventsFired.Add(nameof(AuthorizationCodeReceived));
// Verify all events are fired. // Verify all events are fired.
if (eventsFired.Contains(nameof(RedirectToIdentityProvider)) && if (eventsFired.Contains(nameof(RedirectToAuthenticationEndpoint)) &&
eventsFired.Contains(nameof(MessageReceived)) && eventsFired.Contains(nameof(MessageReceived)) &&
eventsFired.Contains(nameof(SecurityTokenReceived)) && eventsFired.Contains(nameof(AuthenticationValidated)) &&
eventsFired.Contains(nameof(SecurityTokenValidated)) && eventsFired.Contains(nameof(AuthorizationResponseRecieved)) &&
eventsFired.Contains(nameof(AuthorizationCodeReceived))) eventsFired.Contains(nameof(AuthorizationCodeReceived)))
{ {
((ClaimsIdentity)context.AuthenticationTicket.Principal.Identity).AddClaim(new Claim("ManageStore", "Allowed")); ((ClaimsIdentity)context.AuthenticationTicket.Principal.Identity).AddClaim(new Claim("ManageStore", "Allowed"));
@ -55,10 +55,9 @@ namespace MusicStore.Mocks.OpenIdConnect
return Task.FromResult(0); return Task.FromResult(0);
} }
internal static Task RedirectToIdentityProvider internal static Task RedirectToAuthenticationEndpoint(RedirectContext context)
(RedirectToIdentityProviderContext context)
{ {
eventsFired.Add(nameof(RedirectToIdentityProvider)); eventsFired.Add(nameof(RedirectToAuthenticationEndpoint));
if (context.ProtocolMessage.RequestType == OpenIdConnectRequestType.LogoutRequest) if (context.ProtocolMessage.RequestType == OpenIdConnectRequestType.LogoutRequest)
{ {

View File

@ -81,9 +81,9 @@ namespace MusicStore
{ {
OnMessageReceived = TestOpenIdConnectEvents.MessageReceived, OnMessageReceived = TestOpenIdConnectEvents.MessageReceived,
OnAuthorizationCodeReceived = TestOpenIdConnectEvents.AuthorizationCodeReceived, OnAuthorizationCodeReceived = TestOpenIdConnectEvents.AuthorizationCodeReceived,
OnRedirectToIdentityProvider = TestOpenIdConnectEvents.RedirectToIdentityProvider, OnRedirectToAuthenticationEndpoint = TestOpenIdConnectEvents.RedirectToAuthenticationEndpoint,
OnSecurityTokenReceived = TestOpenIdConnectEvents.SecurityTokenReceived, OnAuthenticationValidated = TestOpenIdConnectEvents.AuthenticationValidated,
OnSecurityTokenValidated = TestOpenIdConnectEvents.SecurityTokenValidated OnAuthorizationResponseReceived = TestOpenIdConnectEvents.AuthorizationResponseRecieved
}; };
}); });

View File

@ -5,14 +5,15 @@
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"dependencies": { "dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-*", "Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-*",
"Microsoft.AspNet.Server.Testing": "1.0.0-*", "Microsoft.AspNet.Server.IIS": "1.0.0-*",
"Microsoft.AspNet.WebUtilities": "1.0.0-*", "Microsoft.AspNet.Server.Testing": "1.0.0-*",
"Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*", "Microsoft.AspNet.WebUtilities": "1.0.0-*",
"Microsoft.Framework.Logging.Console": "1.0.0-*", "Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*" "Microsoft.Framework.Logging.Console": "1.0.0-*",
}, "xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"frameworks": { "frameworks": {
"dnx451": { "dnx451": {
"frameworkAssemblies": { "frameworkAssemblies": {