// 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.Collections.Generic; using System.Security.Claims; using Microsoft.AspNet.Http.Authentication; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Http.Core.Authentication { public class AuthenticateContext : IAuthenticateContext { private List _results; private List _accepted; public AuthenticateContext([NotNull] IEnumerable authenticationSchemes) { AuthenticationSchemes = authenticationSchemes; _results = new List(); _accepted = new List(); } public IEnumerable AuthenticationSchemes { get; private set; } public IEnumerable Results { get { return _results; } } public IEnumerable Accepted { get { return _accepted; } } public void Authenticated(ClaimsPrincipal principal, IDictionary properties, IDictionary description) { var descrip = new AuthenticationDescription(description); _accepted.Add(descrip.AuthenticationScheme); // may not match identity.AuthType _results.Add(new AuthenticationResult(principal, new AuthenticationProperties(properties), descrip)); } public void NotAuthenticated(string authenticationScheme, IDictionary properties, IDictionary description) { _accepted.Add(authenticationScheme); } } }