草庐IT

identity

全部标签

c# - 验证登录用户新输入的密码

用户已登录并想做一些重要的事情,我希望他们重新输入密码,这样我就可以确保他们是已登录的用户。如何确认此密码是帐户持有人的密码?很想知道如何通过ASP.NETIdentity或如何设置存储过程来对抗AspNetUsers表或如何通过EntityFramework来完成。 最佳答案 HowcanIconfirmthatthispasswordisfortheaccountholder?howtodoitviaASP.NETIdentity要重新验证当前登录用户的密码,提供用户VerifyView输入密码,并使用以下方法检查用户是否存在。

c# - HttpContext.GetOwinContext().GetUserManager<AppRoleManager>() 返回 null

我使用ASP.NETIdentity2创建角色,但HttpContext.GetOwinContext().GetUserManager()的结果为空。然后我无法创建角色。我该如何解决这个问题?publicclassMVCController:Controller{publicMVCController(){}publicAppRoleManagerRoleManager//returnsnull?!{get{returnHttpContext.GetOwinContext().GetUserManager();}}publicUserCurrentUser{get{stringcur

c# - HttpContext.GetOwinContext().GetUserManager<AppRoleManager>() 返回 null

我使用ASP.NETIdentity2创建角色,但HttpContext.GetOwinContext().GetUserManager()的结果为空。然后我无法创建角色。我该如何解决这个问题?publicclassMVCController:Controller{publicMVCController(){}publicAppRoleManagerRoleManager//returnsnull?!{get{returnHttpContext.GetOwinContext().GetUserManager();}}publicUserCurrentUser{get{stringcur

c# - 在 asp.net core 中使用 JavaScript Client 在 Identity Server 4 中获取范围验证错误

我在从我的Javascript客户端应用程序向我的IdentityServer应用程序发出请求时收到以下错误。失败:IdentityServer4.Validation.ScopeValidator[0]无效范围:openid我已确保在我的IdentityServer应用程序中添加范围。下面是我的代码。IdentityServer应用程序(主机)Config.cspublicclassConfig{publicstaticIEnumerableGetApiResources(){returnnewList{newApiResource("api1","MyAPI")};}publics

c# - 在 asp.net core 中使用 JavaScript Client 在 Identity Server 4 中获取范围验证错误

我在从我的Javascript客户端应用程序向我的IdentityServer应用程序发出请求时收到以下错误。失败:IdentityServer4.Validation.ScopeValidator[0]无效范围:openid我已确保在我的IdentityServer应用程序中添加范围。下面是我的代码。IdentityServer应用程序(主机)Config.cspublicclassConfig{publicstaticIEnumerableGetApiResources(){returnnewList{newApiResource("api1","MyAPI")};}publics

c# - Forms Authentication 理解 context.user.identity

由于有关此过程的文档非常模糊和令人困惑(或陈旧),我想验证我是否正确地执行了操作并且没有遗漏任何步骤。我正在尝试创建一个安全的登录系统,该系统在浏览器关闭时过期。--在我的web.config中我有以下内容--所以我有一个带有用户名/密码文本框和这个按钮的登录表单:在Login_Authenticate内部,我执行以下操作:protectedvoidLogin_Authenticate(objectsender,EventArgse){stringuserName=UserName.Text;stringpassword=Password.Text;boolAuthenticated=

c# - Forms Authentication 理解 context.user.identity

由于有关此过程的文档非常模糊和令人困惑(或陈旧),我想验证我是否正确地执行了操作并且没有遗漏任何步骤。我正在尝试创建一个安全的登录系统,该系统在浏览器关闭时过期。--在我的web.config中我有以下内容--所以我有一个带有用户名/密码文本框和这个按钮的登录表单:在Login_Authenticate内部,我执行以下操作:protectedvoidLogin_Authenticate(objectsender,EventArgse){stringuserName=UserName.Text;stringpassword=Password.Text;boolAuthenticated=

c# - 自定义 ASP.NET Identity 2.0 UserStore - 是否需要实现所有接口(interface)?

我创建了一个自定义IUserStore为我的申请。我已经实现了我需要的接口(interface),IUserStore,IUserRoleStore,IUserLockoutStore,IUserPasswordStore但是当我打电话的时候varresult=awaitSignInManager.PasswordSignInAsync(model.UserName,model.Password,model.RememberMe,shouldLockout:false);我得到一个异常(exception)说StoredoesnotimplementIUserTwoFactorStor

c# - 自定义 ASP.NET Identity 2.0 UserStore - 是否需要实现所有接口(interface)?

我创建了一个自定义IUserStore为我的申请。我已经实现了我需要的接口(interface),IUserStore,IUserRoleStore,IUserLockoutStore,IUserPasswordStore但是当我打电话的时候varresult=awaitSignInManager.PasswordSignInAsync(model.UserName,model.Password,model.RememberMe,shouldLockout:false);我得到一个异常(exception)说StoredoesnotimplementIUserTwoFactorStor

c# - JwtSecurityTokenHandler 和 TokenValidationParameters

我曾经引用过Microsoft.IdentityModel.Tokens.JWT并且一切正常。我更新为使用新的System.IdentityModel.Tokens.Jwt但现在似乎没有任何效果。它找不到JwtSecurityTokenHandler的ValidateToken方法,并且TokenValidationParameters没有AllowedAudience、SigningToken或ValidateExpiration属性。我在这里错过了什么?任何人都可以提供JWT验证的工作样本吗?我的“旧”代码:privatestaticvoidValidateJwt(stringjw