// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Text; using System.Threading.Tasks; using Microsoft.AspNet.Http.Security; using Microsoft.AspNet.Http.Interfaces.Security; namespace Microsoft.AspNet.Http.Core.Security { public class AuthenticateContext : IAuthenticateContext { private List _results; private List _accepted; public AuthenticateContext([NotNull] IEnumerable authenticationTypes) { AuthenticationTypes = authenticationTypes; _results = new List(); _accepted = new List(); } public IEnumerable AuthenticationTypes { get; private set; } public IEnumerable Results { get { return _results; } } public IEnumerable Accepted { get { return _accepted; } } public void Authenticated(ClaimsIdentity identity, IDictionary properties, IDictionary description) { var descrip = new AuthenticationDescription(description); _accepted.Add(descrip.AuthenticationType); // may not match identity.AuthType _results.Add(new AuthenticationResult(identity, new AuthenticationProperties(properties), descrip)); } public void NotAuthenticated(string authenticationType, IDictionary properties, IDictionary description) { _accepted.Add(authenticationType); } } }