DuendeSoftware / Support

Support for Duende Software products
20 stars 0 forks source link

Unable to customise the endpoint URIs #1272

Closed eugene-rebedailo closed 2 months ago

eugene-rebedailo commented 2 months ago

Which version of Duende IdentityServer are you using? 7.0.4

Which version of .NET are you using? .NET8

Describe the question I am trying to implement multitenant sign-on on top of the IdentityServer and for this I need to prefix the endpoint URIs with a tenant identifier, but I am struggling to make the identityserver recognise the change in my base path:

I am trying to make it possible to resolve the IdentityServer's endpoints by a URI in the following format: {origin}/{tenant-id}/{endpoint}, for example: https://login.test.com/abbaabba/connect/authorize, but the built-in router does exact URI matching against endpoints and routing logic doesn't respect values present in IServerUrls.

Expected behavior

I would expect the IServerUrls.BasePath value to affect the endpoint routing.

Additional context I am not completely decided on the solution just yet, so if there is an alternate approach you could propose for this kind of functionality, it would be welcome as well.

I have tried implementing my own IEndpointRouter, but even after resolving the endpoints correctly, but for example, the .well-known/openid-configuration was not respecting my changes to BasePath since it is reset in the identityserver's middleware pipeline

eugene-rebedailo commented 2 months ago

I have managed to achieve the behaviour by using the UsePathBase() middleware.