Start using K Claims
Remove #if defs and reenable claims referencing aspnet/Claims version in k10
This commit is contained in:
parent
27027b917c
commit
afa12ea595
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
#if NET45
|
||||
using System.Security.Claims;
|
||||
#else
|
||||
using System.Security.ClaimsK;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -15,7 +17,6 @@ namespace Microsoft.AspNet.Identity
|
|||
where TUser : class, IUser<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
#if NET45
|
||||
/// <summary>
|
||||
/// Create a ClaimsIdentity from an user using a UserManager
|
||||
/// </summary>
|
||||
|
|
@ -24,6 +25,5 @@ namespace Microsoft.AspNet.Identity
|
|||
/// <param name="authenticationType"></param>
|
||||
/// <returns></returns>
|
||||
Task<ClaimsIdentity> Create(UserManager<TUser, TKey> manager, TUser user, string authenticationType);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
#if NET45
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
#if NET45
|
||||
using System.Security.Claims;
|
||||
#else
|
||||
using System.Security.ClaimsK;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNet.Identity
|
||||
|
|
@ -36,6 +38,4 @@ namespace Microsoft.AspNet.Identity
|
|||
/// <returns></returns>
|
||||
Task RemoveClaim(TUser user, Claim claim);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
@ -2,8 +2,11 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.DependencyInjection;
|
||||
#if NET45
|
||||
using System.Security.Claims;
|
||||
#else
|
||||
using System.Security.ClaimsK;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -29,6 +32,22 @@ namespace Microsoft.AspNet.Identity
|
|||
private IIdentityValidator<string> _passwordValidator;
|
||||
private IIdentityValidator<TUser> _userValidator;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor which takes a service provider to find the default interfaces to hook up
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public UserManager(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (serviceProvider == null)
|
||||
{
|
||||
throw new ArgumentNullException("serviceProvider");
|
||||
}
|
||||
Store = serviceProvider.GetService<IUserStore<TUser, TKey>>();
|
||||
ClaimsIdentityFactory = serviceProvider.GetService<IClaimsIdentityFactory<TUser, TKey>>();
|
||||
PasswordHasher = serviceProvider.GetService<IPasswordHasher>();
|
||||
// TODO: validator interfaces, and maybe each optional store as well? Email and SMS services?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
|
|
@ -324,7 +343,6 @@ namespace Microsoft.AspNet.Identity
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#if NET45
|
||||
/// <summary>
|
||||
/// Creates a ClaimsIdentity representing the user
|
||||
/// </summary>
|
||||
|
|
@ -340,7 +358,6 @@ namespace Microsoft.AspNet.Identity
|
|||
}
|
||||
return ClaimsIdentityFactory.Create(this, user, authenticationType);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Create a user with no password
|
||||
|
|
@ -816,7 +833,6 @@ namespace Microsoft.AspNet.Identity
|
|||
return await loginStore.GetLogins(user).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
#if NET45
|
||||
// IUserClaimStore methods
|
||||
private IUserClaimStore<TUser, TKey> GetClaimStore()
|
||||
{
|
||||
|
|
@ -889,7 +905,6 @@ namespace Microsoft.AspNet.Identity
|
|||
}
|
||||
return await claimStore.GetClaims(user).ConfigureAwait(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
private IUserRoleStore<TUser, TKey> GetUserRoleStore()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"version" : "0.1-alpha-*",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.DependencyInjection" : "0.1-alpha-*"
|
||||
"Microsoft.AspNet.DependencyInjection" : "0.1-alpha-*",
|
||||
"System.Security.Claims" : "0.1-alpha-*"
|
||||
},
|
||||
"configurations": {
|
||||
"net45": {},
|
||||
|
|
|
|||
Loading…
Reference in New Issue