oauth 2.0 - Any way to customize token endpoint when using Microsoft.AspNetCore.Authentication.OpenIdConnect middleware in ASP.N

I'm trying to authenticate using an identity provider that has its token endpoint on profileoidc

I'm trying to authenticate using an identity provider that has its token endpoint on /profile/oidc/token instead of the usual /oauth/token endpoint. Is there any way to customize this? I'm always getting an error when exchanging the code for an access token.

I'm trying to authenticate using an identity provider that has its token endpoint on /profile/oidc/token instead of the usual /oauth/token endpoint. Is there any way to customize this? I'm always getting an error when exchanging the code for an access token.

Share Improve this question asked Mar 13 at 9:02 BG931cBG931c 1 1
  • Something like this? services.AddAuthentication(options => { options.DefaultChallengeScheme = "CustomProvider"; }).AddOAuth("CustomProvider", options => { options.ClientId = Configuration["ClientId"]; options.ClientSecret = Configuration["ClientSecret"]; options.AuthorizationEndpoint = "<your custom authorization endpoint>"; options.TokenEndpoint = "<your custom token endpoint>"; }); – SoftwareDveloper Commented Mar 13 at 14:08
Add a comment  | 

1 Answer 1

Reset to default 0

You can override some of the URL's in AddOpenIDConnect by adding your own custom event handlers.

For example:

AddOpenIdConnect(options =>
{
   ...
   options.Events.OnRedirectToIdentityProviderForSignOut = context =>
   {
       context.ProtocolMessage.IssuerAddress =
                                "https://localhost:7001/connect/endsession";
       return Task.CompletedTask;
   };
});

I did explain this in a bit more detail in a blog post about: IdentityServer In Docker Containers (part 4/4)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744712324a4589416.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信