Rename Auth Context API Ack to Accept
This commit is contained in:
parent
dfc0c5d323
commit
ee37c75544
|
|
@ -4,6 +4,6 @@ namespace Microsoft.AspNet.HttpFeature.Security
|
||||||
{
|
{
|
||||||
public interface IAuthTypeContext
|
public interface IAuthTypeContext
|
||||||
{
|
{
|
||||||
void Ack(IDictionary<string,object> description);
|
void Accept(IDictionary<string,object> description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,6 +7,6 @@ namespace Microsoft.AspNet.HttpFeature.Security
|
||||||
IList<string> AuthenticationTypes {get;}
|
IList<string> AuthenticationTypes {get;}
|
||||||
IDictionary<string,string> Properties {get;}
|
IDictionary<string,string> Properties {get;}
|
||||||
|
|
||||||
void Ack(string authenticationType, IDictionary<string,object> description);
|
void Accept(string authenticationType, IDictionary<string,object> description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,6 @@ namespace Microsoft.AspNet.HttpFeature.Security
|
||||||
IList<ClaimsIdentity> Identities { get; }
|
IList<ClaimsIdentity> Identities { get; }
|
||||||
IDictionary<string, string> Properties { get; }
|
IDictionary<string, string> Properties { get; }
|
||||||
|
|
||||||
void Ack(string authenticationType, IDictionary<string, object> description);
|
void Accept(string authenticationType, IDictionary<string, object> description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,6 +6,6 @@ namespace Microsoft.AspNet.HttpFeature.Security
|
||||||
{
|
{
|
||||||
IList<string> AuthenticationTypes { get; }
|
IList<string> AuthenticationTypes { get; }
|
||||||
|
|
||||||
void Ack(string authenticationType, IDictionary<string, object> description);
|
void Accept(string authenticationType, IDictionary<string, object> description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -123,10 +123,10 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
handler.Authenticate(authenticateContext);
|
handler.Authenticate(authenticateContext);
|
||||||
|
|
||||||
// Verify all types ack'd
|
// Verify all types ack'd
|
||||||
IEnumerable<string> leftovers = authenticationTypes.Except(authenticateContext.Acked);
|
IEnumerable<string> leftovers = authenticationTypes.Except(authenticateContext.Accepted);
|
||||||
if (leftovers.Any())
|
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;
|
return authenticateContext.Results;
|
||||||
|
|
@ -148,10 +148,10 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
await handler.AuthenticateAsync(authenticateContext);
|
await handler.AuthenticateAsync(authenticateContext);
|
||||||
|
|
||||||
// Verify all types ack'd
|
// Verify all types ack'd
|
||||||
IEnumerable<string> leftovers = authenticationTypes.Except(authenticateContext.Acked);
|
IEnumerable<string> leftovers = authenticationTypes.Except(authenticateContext.Accepted);
|
||||||
if (leftovers.Any())
|
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;
|
return authenticateContext.Results;
|
||||||
|
|
|
||||||
|
|
@ -136,10 +136,10 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
handler.Challenge(challengeContext);
|
handler.Challenge(challengeContext);
|
||||||
|
|
||||||
// Verify all types ack'd
|
// Verify all types ack'd
|
||||||
IEnumerable<string> leftovers = authenticationTypes.Except(challengeContext.Acked);
|
IEnumerable<string> leftovers = authenticationTypes.Except(challengeContext.Accepted);
|
||||||
if (leftovers.Any())
|
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);
|
handler.SignIn(signInContext);
|
||||||
|
|
||||||
// Verify all types ack'd
|
// 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())
|
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);
|
handler.SignOut(signOutContext);
|
||||||
|
|
||||||
// Verify all types ack'd
|
// Verify all types ack'd
|
||||||
IEnumerable<string> leftovers = authenticationTypes.Except(signOutContext.Acked);
|
IEnumerable<string> leftovers = authenticationTypes.Except(signOutContext.Accepted);
|
||||||
if (leftovers.Any())
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.PipelineCore.Security
|
||||||
|
|
||||||
public IList<AuthenticationDescription> Results { get; private set; }
|
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));
|
Results.Add(new AuthenticationDescription(description));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,25 +19,25 @@ namespace Microsoft.AspNet.PipelineCore.Security
|
||||||
}
|
}
|
||||||
AuthenticationTypes = authenticationTypes;
|
AuthenticationTypes = authenticationTypes;
|
||||||
Results = new List<AuthenticationResult>();
|
Results = new List<AuthenticationResult>();
|
||||||
Acked = new List<string>();
|
Accepted = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<string> AuthenticationTypes { get; private set; }
|
public IList<string> AuthenticationTypes { get; private set; }
|
||||||
|
|
||||||
public IList<AuthenticationResult> Results { 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)
|
public void Authenticated(ClaimsIdentity identity, IDictionary<string, string> properties, IDictionary<string, object> description)
|
||||||
{
|
{
|
||||||
var descrip = new AuthenticationDescription(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));
|
Results.Add(new AuthenticationResult(identity, new AuthenticationProperties(properties), descrip));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotAuthenticated(string authenticationType, IDictionary<string, string> properties, IDictionary<string, object> description)
|
public void NotAuthenticated(string authenticationType, IDictionary<string, string> properties, IDictionary<string, object> description)
|
||||||
{
|
{
|
||||||
Acked.Add(authenticationType);
|
Accepted.Add(authenticationType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,18 @@ namespace Microsoft.AspNet.PipelineCore.Security
|
||||||
}
|
}
|
||||||
AuthenticationTypes = authenticationTypes;
|
AuthenticationTypes = authenticationTypes;
|
||||||
Properties = properties ?? new Dictionary<string, string>(StringComparer.Ordinal);
|
Properties = properties ?? new Dictionary<string, string>(StringComparer.Ordinal);
|
||||||
Acked = new List<string>();
|
Accepted = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<string> AuthenticationTypes { get; private set; }
|
public IList<string> AuthenticationTypes { get; private set; }
|
||||||
|
|
||||||
public IDictionary<string, string> Properties { 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,18 @@ namespace Microsoft.AspNet.PipelineCore.Security
|
||||||
}
|
}
|
||||||
Identities = identities;
|
Identities = identities;
|
||||||
Properties = dictionary ?? new Dictionary<string, string>(StringComparer.Ordinal);
|
Properties = dictionary ?? new Dictionary<string, string>(StringComparer.Ordinal);
|
||||||
Acked = new List<string>();
|
Accepted = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<ClaimsIdentity> Identities { get; private set; }
|
public IList<ClaimsIdentity> Identities { get; private set; }
|
||||||
|
|
||||||
public IDictionary<string, string> Properties { 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,16 @@ namespace Microsoft.AspNet.PipelineCore.Security
|
||||||
throw new ArgumentNullException("authenticationTypes");
|
throw new ArgumentNullException("authenticationTypes");
|
||||||
}
|
}
|
||||||
AuthenticationTypes = authenticationTypes;
|
AuthenticationTypes = authenticationTypes;
|
||||||
Acked = new List<string>();
|
Accepted = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<string> AuthenticationTypes { get; private set; }
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue