aspnet-contrib

Overriding TokenEndPoint in AspNet.Security.OpenIdConnect.Server

99封情书 提交于 2019-11-30 21:43: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 the current implementation of public override Task TokenEndpoint(TokenEndpointContext context){ }

Separating Auth and Resource Servers with AspNet.Security.OpenIdConnect - the Audience?

风流意气都作罢 提交于 2019-11-30 20:43:05
The example on the AspNet.Security.OpenIdConnect.Server looks to me like both an auth and resource server. I would like to separate those. I have done so. At the auth server's Startup.Config, I have the following settings: app.UseOpenIdConnectServer(options => { options.AllowInsecureHttp = true; options.ApplicationCanDisplayErrors = true; options.AuthenticationScheme = OpenIdConnectDefaults.AuthenticationScheme; options.Issuer = new System.Uri("http://localhost:61854"); // This auth server options.Provider = new AuthorizationProvider(); options.TokenEndpointPath = new PathString("/token");

AspNetCore.Authentication.JwtBearer fails with No SecurityTokenValidator available for token with .net core RC2

故事扮演 提交于 2019-11-30 17:30:47
I'm trying to get a simple endpoint working that issues and consumes JWT tokens using AspNew.Security.OpenIdConnect.Server to issue the token and validating using Microsoft.AspNetCore.Authentication.JwtBearer. I can generate the token fine but trying to authenticate the token fails with the error Bearer was not authenticated. Failure message: No SecurityTokenValidator available for token: {token} At this point I've stripped everything out and have the following: project.json { "dependencies": { "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0

AspNet.Security.OpenIdConnect.Server. Refresh tokens

穿精又带淫゛_ 提交于 2019-11-30 15:55:21
问题 As far as I know ASOS supports refresh tokens out of the box. To get refresh token I need to add offline_access scope to my token request. But where are they stored? How can I change expiration date of the token or delete it? How can I determine for which user refresh token is created? 回答1: But where are they stored? By default, they are stored nowhere: they are self-contained. As long as the encryption keys used to protect the refresh tokens are still in the ASP.NET Data Protection key ring,

AspNetCore.Authentication.JwtBearer fails with No SecurityTokenValidator available for token with .net core RC2

落爺英雄遲暮 提交于 2019-11-30 01:53:24
问题 I'm trying to get a simple endpoint working that issues and consumes JWT tokens using AspNew.Security.OpenIdConnect.Server to issue the token and validating using Microsoft.AspNetCore.Authentication.JwtBearer. I can generate the token fine but trying to authenticate the token fails with the error Bearer was not authenticated. Failure message: No SecurityTokenValidator available for token: {token} At this point I've stripped everything out and have the following: project.json { "dependencies":

Use OpenIdConnectServer and try to connect to Facebook through API service

一笑奈何 提交于 2019-11-29 14:43:25
问题 I'm trying to figure out a way of making my API being able to associate a user from Facebook to my Identity users. The application context I'm developing a mobile application (In Xamarin) that needs to make login with Username/Password and with Facebook. I have already set the app.UseOpenIdConnectServer configuration and created the custom Provider so my application is already working with Username/Password. Now I'm trying to make this integration with Facebook and not finding a way I can

How to specify the destination for an existing ClaimsIdentity?

此生再无相见时 提交于 2019-11-28 12:37:26
I'm using below code to create a ClaimIdentity in OpenIdConnectServerProvider.AuthorizationProvider. But the identity.Name is not searlized. How to allow the OpenIdConnectServer serarlize the name? Thanks. The previous question is here How to create a ClaimIdentity in asp.net 5 var user = await userManager.FindByNameAsync(context.UserName); var factory = context.HttpContext.RequestServices.GetRequiredService<IUserClaimsPrincipalFactory<ApplicationUser>>(); var identity = await factory.CreateAsync(user); context.Validated(new ClaimsPrincipal(identity)); To avoid leaking confidential data,

Authorize via JWT Token

为君一笑 提交于 2019-11-28 04:35:04
问题 ASP.NET Core 5 with ASP.NET Identity 3.0, I'm using both web pages and apis. I am using OpenIddict to issue a JWT token and to authenticate. My code looks as such: X509Certificate2 c = new X509Certificate2(@"tokensign.p12", "MyCertificatePassword"); services.AddOpenIddict<WebUser, IdentityRole<int>, WebDbContext, int>() .EnableTokenEndpoint("/api/customauth/login") .AllowPasswordFlow() .UseJsonWebTokens() .AddSigningCertificate(c); If I disable UseJsonWebTokens(), I can generate a token and

Validating Tokens Issued by AspNet.Security.OpenIdConnect.Server (ASP.NET vNext)

蹲街弑〆低调 提交于 2019-11-27 22:31:49
I am using Visual Studio 2015 Enterprise and ASP.NET vNext Beta8 to build an endpoint that both issues and consumes JWT tokens. I Originally approached this by generating the tokens myself, as described here . Later a helpful article by @Pinpoint revealed that AspNet.Security.OpenIdConnect.Server (a.k.a. OIDC) can be configured to issue and consume the tokens for me. So I followed those instructions, stood up an endpoint, and by submitting an x-www-form-urlencoded post from postman I receive back a legit token: { "token_type": "bearer", "access_token": "eyJ0eXAiO....", "expires_in": "3599" }

How to handle expired access token in asp.net core using refresh token with OpenId Connect

让人想犯罪 __ 提交于 2019-11-27 14:25:56
I have configured an ASOS OpenIdConnect Server using and an asp.net core mvc app that uses the "Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.0.0 and "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0". I have tested the "Authorization Code" workflow and everything works. The client web app processes the authentication as expected and creates a cookie storing the id_token, access_token, and refresh_token. How do I force Microsoft.AspNetCore.Authentication.OpenIdConnect to request a new access_token when it expires? The asp.net core mvc app ignores the expired access_token. I would