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;
|
using System;
|
||||||
#if NET45
|
#if NET45
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
#else
|
||||||
|
using System.Security.ClaimsK;
|
||||||
#endif
|
#endif
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
@ -15,7 +17,6 @@ namespace Microsoft.AspNet.Identity
|
||||||
where TUser : class, IUser<TKey>
|
where TUser : class, IUser<TKey>
|
||||||
where TKey : IEquatable<TKey>
|
where TKey : IEquatable<TKey>
|
||||||
{
|
{
|
||||||
#if NET45
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a ClaimsIdentity from an user using a UserManager
|
/// Create a ClaimsIdentity from an user using a UserManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -24,6 +25,5 @@ namespace Microsoft.AspNet.Identity
|
||||||
/// <param name="authenticationType"></param>
|
/// <param name="authenticationType"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ClaimsIdentity> Create(UserManager<TUser, TKey> manager, TUser user, string authenticationType);
|
Task<ClaimsIdentity> Create(UserManager<TUser, TKey> manager, TUser user, string authenticationType);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#if NET45
|
using System.Collections.Generic;
|
||||||
|
#if NET45
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
#else
|
||||||
|
using System.Security.ClaimsK;
|
||||||
|
#endif
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Identity
|
namespace Microsoft.AspNet.Identity
|
||||||
|
|
@ -36,6 +38,4 @@ namespace Microsoft.AspNet.Identity
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task RemoveClaim(TUser user, Claim claim);
|
Task RemoveClaim(TUser user, Claim claim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -2,8 +2,11 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Microsoft.AspNet.DependencyInjection;
|
||||||
#if NET45
|
#if NET45
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
#else
|
||||||
|
using System.Security.ClaimsK;
|
||||||
#endif
|
#endif
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -29,6 +32,22 @@ namespace Microsoft.AspNet.Identity
|
||||||
private IIdentityValidator<string> _passwordValidator;
|
private IIdentityValidator<string> _passwordValidator;
|
||||||
private IIdentityValidator<TUser> _userValidator;
|
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>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -324,7 +343,6 @@ namespace Microsoft.AspNet.Identity
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET45
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a ClaimsIdentity representing the user
|
/// Creates a ClaimsIdentity representing the user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -340,7 +358,6 @@ namespace Microsoft.AspNet.Identity
|
||||||
}
|
}
|
||||||
return ClaimsIdentityFactory.Create(this, user, authenticationType);
|
return ClaimsIdentityFactory.Create(this, user, authenticationType);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a user with no password
|
/// Create a user with no password
|
||||||
|
|
@ -816,7 +833,6 @@ namespace Microsoft.AspNet.Identity
|
||||||
return await loginStore.GetLogins(user).ConfigureAwait(false);
|
return await loginStore.GetLogins(user).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET45
|
|
||||||
// IUserClaimStore methods
|
// IUserClaimStore methods
|
||||||
private IUserClaimStore<TUser, TKey> GetClaimStore()
|
private IUserClaimStore<TUser, TKey> GetClaimStore()
|
||||||
{
|
{
|
||||||
|
|
@ -889,7 +905,6 @@ namespace Microsoft.AspNet.Identity
|
||||||
}
|
}
|
||||||
return await claimStore.GetClaims(user).ConfigureAwait(false);
|
return await claimStore.GetClaims(user).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
private IUserRoleStore<TUser, TKey> GetUserRoleStore()
|
private IUserRoleStore<TUser, TKey> GetUserRoleStore()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"version" : "0.1-alpha-*",
|
"version" : "0.1-alpha-*",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.DependencyInjection" : "0.1-alpha-*"
|
"Microsoft.AspNet.DependencyInjection" : "0.1-alpha-*",
|
||||||
|
"System.Security.Claims" : "0.1-alpha-*"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"net45": {},
|
"net45": {},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue