Tag: 身份validation

Owin Bearer令牌认证+授权控制器

我正在尝试使用Bearer令牌和owin进行身份validation。 我可以使用授权类型password发布令牌,并覆盖AuthorizationServerProvider.cs中的 GrantResourceOwnerCredentials 。 但我无法使用Authorize属性访问控制器方法。 这是我的代码: Startup.cs public class Startup { public static OAuthAuthorizationServerOptions OAuthOptions { get; private set; } // normal public Startup() : this(false) { } // testing public Startup(bool isDev) { // add settings Settings.Configure(isDev); OAuthOptions = new OAuthAuthorizationServerOptions { AllowInsecureHttp = true, TokenEndpointPath = new PathString(“/Token”), AccessTokenExpireTimeSpan = TimeSpan.FromDays(1), Provider = […]

使用自定义ClientCredentials的WCF身份validation:要使用的clientCredentialType是什么?

我不得不放弃基本的WCF UserName / Pwd安全性并实现我自己的自定义客户端凭据,以保留超出默认提供的更多信息。 我参与了这篇MSDN文章 ,但我遗漏了一些东西,因为它不起作用。 首先,我有一些自定义ClientCredentials,它们提供自定义ClientCredentialsSecurityTokenManager: public class CentralAuthCredentials : ClientCredentials { public override System.IdentityModel.Selectors.SecurityTokenManager CreateSecurityTokenManager() { return new CentralAuthTokenManager(this); } } public class CentralAuthTokenManager : ClientCredentialsSecurityTokenManager { private CentralAuthCredentials credentials; public CentralAuthTokenManager(CentralAuthCredentials creds) : base(creds) { this.credentials = creds; } public override SecurityTokenProvider CreateSecurityTokenProvider(SecurityTokenRequirement tokenRequirement) { if (this.IsIssuedSecurityTokenRequirement(tokenRequirement) || tokenRequirement.TokenType == CentralAuthToken.TOKEN_TYPE) return […]

是否可以在一个ASP.NET MVC应用程序中同时具有Azure AD和个人帐户身份validation?

通过在Startup.Auth.cs文件中执行此操作,我有点成功 // Configure the db context and user manager to use a single instance per request app.CreatePerOwinContext(ApplicationDbContext.Create); app.CreatePerOwinContext(ApplicationUserManager.Create); app.Properties[“Microsoft.Owin.Security.Constants.DefaultSignInAsAuthenticationType”] = “ExternalCookie”; // Configure the sign in cookie app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, Provider = new CookieAuthenticationProvider { OnValidateIdentity = SecurityStampValidator.OnValidateIdentity( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) } }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); app.UseOpenIdConnectAuthentication( new OpenIdConnectAuthenticationOptions { […]

如何在ASP.NET MVC中关闭浏览器或选项卡时将用户注销?

我需要在用户关闭选项卡或浏览器时注销用户,我该如何在ASP.NET MVC中执行此操作?

不再支持使用旧密码进行身份validation,请使用4.1样式密码

我的网站有hostgator,我想用C#windows应用程序访问mysql数据库但是当我尝试连接时收到了这条消息: “不再支持使用旧密码进行身份validation,请使用4.1样式密码” 我试过给定解决方案: SET SESSION old_passwords=0; SET PASSWORD FOR user@host=PASSWORD(‘your pw here’); 第一个查询执行成功但我在第二个查询执行时收到错误“用户@主机拒绝访问”。 我无法理解为什么会出现这个问题。 我正在使用MySQL-connecter-net 6.6.5。 我成功地将我的数据库与MySql workbench 5.2.47连接起来。 任何人都可以帮助我,我可以做更多吗? 我已联系我的托管网站,他们对my.cnf文件进行了更改,以使用4.1样式密码。 我能够连接mysql mysql -u -p -h ; 但是当我尝试使用mySQL连接器网6.6.5连接C#时,我再次遇到此错误。 我在Windows 8 64位上使用Visual Studio 2012和MySQL连接器6.6.5。 这是我用来连接的代码 using MySQL.Data.MySQLClient; private void button1_Click(object sender, EventArgs e) { string connStr = String.Format(“server={0};port={1};uid={2};password={3};database={4}”, txtserver.Text, txtPort.Text, txtUser.Text, txtPassword.Text, txtDatabase.Text); conn = new […]