aspnet-contrib

Hosting ASOS with TestServer

不想你离开。 提交于 2019-12-10 09:44:15
问题 I have an OpenIdDict authentication server which is based on AspNet.Security.OpenIdConnect.Server . The setup works as expected. Now to do some in process integration;system tests which span the whole backend architecture I use the TestServer class. Why I test like this is another question Most test code coverage with least amount of work It has been decided to not do unit tests... (too much work they say) Real integration tests which span much less code where also seen as to much work when I

Using Claims with OpenIdConnect.Server in ASP.NET 5

百般思念 提交于 2019-12-06 02:29:40
问题 In the past 7 days I've tried to setup an ASP.NET 5 WebApi using OpenIdConnect.Server with the resource owner flow. I was more or less successful in generating a token and accessing [Authorize] protected actions. However, when I try to access this.User.Identity.Claims , it's empty. I am using ASP.NET 5, beta6 for now (having troubles upgrading to most recent beta7 and waiting for it's official release) In the Startup.cs I got the following: public void ConfigureServices(IServiceCollection

Hosting ASOS with TestServer

一个人想着一个人 提交于 2019-12-05 21:40:49
I have an OpenIdDict authentication server which is based on AspNet.Security.OpenIdConnect.Server . The setup works as expected. Now to do some in process integration;system tests which span the whole backend architecture I use the TestServer class. Why I test like this is another question Most test code coverage with least amount of work It has been decided to not do unit tests... (too much work they say) Real integration tests which span much less code where also seen as to much work when I want to achieve a good coverage The test are based on an framework that is build using a domain

Why is my JWT bearer authentication recognizing tokens as expired 5 minutes after the token says?

点点圈 提交于 2019-12-05 18:07:46
问题 I'm using AspNet.Security.OpenIdConnect.Server to issue JWT tokens and have the AuthorizationCodeLifetime set to 30 seconds for testing. Here is the snippet of code I'm using to set the options options.TokenEndpointPath = "/api/token"; options.AllowInsecureHttp = true; options.AccessTokenHandler = new JwtSecurityTokenHandler(); options.SigningCredentials.Add(new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256)); options.AccessTokenLifetime = TimeSpan.FromSeconds(30); options

Why is my JWT bearer authentication recognizing tokens as expired 5 minutes after the token says?

懵懂的女人 提交于 2019-12-04 02:11:15
I'm using AspNet.Security.OpenIdConnect.Server to issue JWT tokens and have the AuthorizationCodeLifetime set to 30 seconds for testing. Here is the snippet of code I'm using to set the options options.TokenEndpointPath = "/api/token"; options.AllowInsecureHttp = true; options.AccessTokenHandler = new JwtSecurityTokenHandler(); options.SigningCredentials.Add(new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256)); options.AccessTokenLifetime = TimeSpan.FromSeconds(30); options.AuthorizationCodeLifetime = TimeSpan.FromSeconds(30); The returned token contains: "expires_in": 30, and

Logging Out With AspNet.Security.OpenIdConnect.Server (ASP.NET vNext)

◇◆丶佛笑我妖孽 提交于 2019-12-04 01:52:41
问题 I am using Visual Studio 2015 Enterprise and ASP.NET vNext Beta8 to issue and consume JWT tokens as described here. In our implementation we're storing some client details in Redis at token issuing time and we would like the flush this information when the user logs out. My question is what is the best practices for logging out with OIDC? While I could roll my own contoller for this purpose I couldn't help but notice Open ID Connect (OIDC) seems somewhat primed to handle this case. For

Overriding TokenEndPoint in AspNet.Security.OpenIdConnect.Server

a 夏天 提交于 2019-12-03 21:00:16
问题 question related to this post here: Configure the authorization server endpoint. Using the above example I am able to get token. previously it was possible to get additional information by over riding public override Task TokenEndpoint(OAuthTokenEndpointContext context) { foreach (KeyValuePair<string, string> property in context.Properties.Dictionary) { context.AdditionalResponseParameters.Add(property.Key, property.Value); } return Task.FromResult<object>(null); } how do you achieve that in

Custom Lifetime Validation With AspNet.Security.OpenIdConnect.Server (ASP.NET vNext)

依然范特西╮ 提交于 2019-12-02 11:25:55
问题 I am using Visual Studio 2015 Enterprise Update 1 and ASP.NET vNext rc1-update1 to issue and consume JWT tokens as described here. In our implementation we want to control token lifetime validation. We tried several approaches, all of which had undesirable side effects. For example in one attempt we took over the TokenValidationParameters.TokenValidationParameters.LifetimeValidator event in the Configure method: app.UseJwtBearerAuthentication ( options => { options.TokenValidationParameters =

Custom Lifetime Validation With AspNet.Security.OpenIdConnect.Server (ASP.NET vNext)

倾然丶 夕夏残阳落幕 提交于 2019-12-02 03:58:15
I am using Visual Studio 2015 Enterprise Update 1 and ASP.NET vNext rc1-update1 to issue and consume JWT tokens as described here . In our implementation we want to control token lifetime validation. We tried several approaches, all of which had undesirable side effects. For example in one attempt we took over the TokenValidationParameters.TokenValidationParameters.LifetimeValidator event in the Configure method: app.UseJwtBearerAuthentication ( options => { options.TokenValidationParameters = new TokenValidationParameters() { LifetimeValidator = (DateTime? notBefore, DateTime? expires,

Logging Out With AspNet.Security.OpenIdConnect.Server (ASP.NET vNext)

﹥>﹥吖頭↗ 提交于 2019-12-01 10:45:29
I am using Visual Studio 2015 Enterprise and ASP.NET vNext Beta8 to issue and consume JWT tokens as described here . In our implementation we're storing some client details in Redis at token issuing time and we would like the flush this information when the user logs out. My question is what is the best practices for logging out with OIDC? While I could roll my own contoller for this purpose I couldn't help but notice Open ID Connect (OIDC) seems somewhat primed to handle this case. For example OIDC has an OnLogoutEndpoint handler and LogoutEndpointPath settings. But when I call the OIDC