Rename Auth Context API Ack to Accept

This commit is contained in:
Chris Ross 2014-04-01 17:08:09 -07:00
parent dfc0c5d323
commit ee37c75544
11 changed files with 31 additions and 31 deletions

View File

@ -4,6 +4,6 @@ namespace Microsoft.AspNet.HttpFeature.Security
{
public interface IAuthTypeContext
{
void Ack(IDictionary<string,object> description);
void Accept(IDictionary<string,object> description);
}
}

View File

@ -7,6 +7,6 @@ namespace Microsoft.AspNet.HttpFeature.Security
IList<string> AuthenticationTypes {get;}
IDictionary<string,string> Properties {get;}
void Ack(string authenticationType, IDictionary<string,object> description);
void Accept(string authenticationType, IDictionary<string,object> description);
}
}

View File

@ -8,6 +8,6 @@ namespace Microsoft.AspNet.HttpFeature.Security
IList<ClaimsIdentity> Identities { get; }
IDictionary<string, string> Properties { get; }
void Ack(string authenticationType, IDictionary<string, object> description);
void Accept(string authenticationType, IDictionary<string, object> description);
}
}

View File

@ -6,6 +6,6 @@ namespace Microsoft.AspNet.HttpFeature.Security
{
IList<string> AuthenticationTypes { get; }
void Ack(string authenticationType, IDictionary<string, object> description);
void Accept(string authenticationType, IDictionary<string, object> description);
}
}

View File

@ -123,10 +123,10 @@ namespace Microsoft.AspNet.PipelineCore
handler.Authenticate(authenticateContext);
// Verify all types ack'd
IEnumerable<string> leftovers = authenticationTypes.Except(authenticateContext.Acked);
IEnumerable<string> leftovers = authenticationTypes.Except(authenticateContext.Accepted);
if (leftovers.Any())
{
throw new InvalidOperationException("The following authentication types did not ack: " + string.Join(", ", leftovers));
throw new InvalidOperationException("The following authentication types were not accepted: " + string.Join(", ", leftovers));
}
return authenticateContext.Results;
@ -148,10 +148,10 @@ namespace Microsoft.AspNet.PipelineCore
await handler.AuthenticateAsync(authenticateContext);
// Verify all types ack'd
IEnumerable<string> leftovers = authenticationTypes.Except(authenticateContext.Acked);
IEnumerable<string> leftovers = authenticationTypes.Except(authenticateContext.Accepted);
if (leftovers.Any())
{
throw new InvalidOperationException("The following authentication types did not ack: " + string.Join(", ", leftovers));
throw new InvalidOperationException("The following authentication types were not accepted: " + string.Join(", ", leftovers));
}
return authenticateContext.Results;

View File

@ -136,10 +136,10 @@ namespace Microsoft.AspNet.PipelineCore
handler.Challenge(challengeContext);
// Verify all types ack'd
IEnumerable<string> leftovers = authenticationTypes.Except(challengeContext.Acked);
IEnumerable<string> leftovers = authenticationTypes.Except(challengeContext.Accepted);
if (leftovers.Any())
{
throw new InvalidOperationException("The following authentication types did not ack: " + string.Join(", ", leftovers));
throw new InvalidOperationException("The following authentication types were not accepted: " + string.Join(", ", leftovers));
}
}
@ -159,10 +159,10 @@ namespace Microsoft.AspNet.PipelineCore
handler.SignIn(signInContext);
// Verify all types ack'd
IEnumerable<string> leftovers = identities.Select(identity => identity.AuthenticationType).Except(signInContext.Acked);
IEnumerable<string> leftovers = identities.Select(identity => identity.AuthenticationType).Except(signInContext.Accepted);
if (leftovers.Any())
{
throw new InvalidOperationException("The following authentication types did not ack: " + string.Join(", ", leftovers));
throw new InvalidOperationException("The following authentication types were not accepted: " + string.Join(", ", leftovers));
}
}
@ -182,10 +182,10 @@ namespace Microsoft.AspNet.PipelineCore
handler.SignOut(signOutContext);
// Verify all types ack'd
IEnumerable<string> leftovers = authenticationTypes.Except(signOutContext.Acked);
IEnumerable<string> leftovers = authenticationTypes.Except(signOutContext.Accepted);
if (leftovers.Any())
{
throw new InvalidOperationException("The following authentication types did not ack: " + string.Join(", ", leftovers));
throw new InvalidOperationException("The following authentication types were not accepted: " + string.Join(", ", leftovers));
}
}
}

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNet.PipelineCore.Security
public IList<AuthenticationDescription> Results { get; private set; }
public void Ack(IDictionary<string, object> description)
public void Accept(IDictionary<string, object> description)
{
Results.Add(new AuthenticationDescription(description));
}

View File

@ -19,25 +19,25 @@ namespace Microsoft.AspNet.PipelineCore.Security
}
AuthenticationTypes = authenticationTypes;
Results = new List<AuthenticationResult>();
Acked = new List<string>();
Accepted = new List<string>();
}
public IList<string> AuthenticationTypes { get; private set; }
public IList<AuthenticationResult> Results { get; private set; }
public IList<string> Acked { get; private set; }
public IList<string> Accepted { get; private set; }
public void Authenticated(ClaimsIdentity identity, IDictionary<string, string> properties, IDictionary<string, object> description)
{
var descrip = new AuthenticationDescription(description);
Acked.Add(descrip.AuthenticationType);
Accepted.Add(descrip.AuthenticationType); // may not match identity.AuthType
Results.Add(new AuthenticationResult(identity, new AuthenticationProperties(properties), descrip));
}
public void NotAuthenticated(string authenticationType, IDictionary<string, string> properties, IDictionary<string, object> description)
{
Acked.Add(authenticationType);
Accepted.Add(authenticationType);
}
}
}

View File

@ -17,18 +17,18 @@ namespace Microsoft.AspNet.PipelineCore.Security
}
AuthenticationTypes = authenticationTypes;
Properties = properties ?? new Dictionary<string, string>(StringComparer.Ordinal);
Acked = new List<string>();
Accepted = new List<string>();
}
public IList<string> AuthenticationTypes { get; private set; }
public IDictionary<string, string> Properties { get; private set; }
public IList<string> Acked { get; private set; }
public IList<string> Accepted { get; private set; }
public void Ack(string authenticationType, IDictionary<string, object> description)
public void Accept(string authenticationType, IDictionary<string, object> description)
{
Acked.Add(authenticationType);
Accepted.Add(authenticationType);
}
}
}

View File

@ -15,18 +15,18 @@ namespace Microsoft.AspNet.PipelineCore.Security
}
Identities = identities;
Properties = dictionary ?? new Dictionary<string, string>(StringComparer.Ordinal);
Acked = new List<string>();
Accepted = new List<string>();
}
public IList<ClaimsIdentity> Identities { get; private set; }
public IDictionary<string, string> Properties { get; private set; }
public IList<string> Acked { get; private set; }
public IList<string> Accepted { get; private set; }
public void Ack(string authenticationType, IDictionary<string, object> description)
public void Accept(string authenticationType, IDictionary<string, object> description)
{
Acked.Add(authenticationType);
Accepted.Add(authenticationType);
}
}
}

View File

@ -13,16 +13,16 @@ namespace Microsoft.AspNet.PipelineCore.Security
throw new ArgumentNullException("authenticationTypes");
}
AuthenticationTypes = authenticationTypes;
Acked = new List<string>();
Accepted = new List<string>();
}
public IList<string> AuthenticationTypes { get; private set; }
public IList<string> Acked { get; private set; }
public IList<string> Accepted { get; private set; }
public void Ack(string authenticationType, IDictionary<string, object> description)
public void Accept(string authenticationType, IDictionary<string, object> description)
{
Acked.Add(authenticationType);
Accepted.Add(authenticationType);
}
}
}