Docker external uri for redirection
Setup: IS4 + ASPNET Identity + MVC Client
- https://mybestdomain.best.com - hosted docker container IS4 with IssuerUri = "https://mybestdomain.best.com" // hostname best.is4
- https://mysecondbestdomain.best.com - hosted docker container web mvc client // hostname best.mvc 2.1 If I set Authority = "https://mybestdomain.best.com" - I get error cant open discover doc 2.2 If I set Authority = "best.is4" ( my docker host name ) - I get redirect to best.is4/connect/*
How to change redirect from https://DOCKERHOSTNAME/connect/authorize to https://BESTDOMAIN/connect/authorize
I found answer SO
// It is important this matches the actual URL of your identity server, not the Docker internal URL
options.Authority = "http://localhost:5000";
if (Environment.IsDevelopment())
{
// This will allow the container to reach the discovery endpoint
options.MetadataAddress = "http://identityserverwithaspnetidentity/.well-known/openid-configuration";
options.RequireHttpsMetadata = false;
options.Events.OnRedirectToIdentityProvider = context =>
{
// Intercept the redirection so the browser navigates to the right URL in your host
context.ProtocolMessage.IssuerAddress = "http://localhost:5000/connect/authorize";
return Task.CompletedTask;
};
}
I changed MetadataAddress to docker-hostname and ProtocolMessage.IssuerAddress to public domain uri and it works! But its tweak not primary solution
SO
https://stackoverflow.com/questions/43911536/how-can-i-use-identityserver4-from-inside-and-outside-a-docker-machine https://stackoverflow.com/questions/59250716/identity-server-4-with-the-docker-compose-redirects-to-login-page-after-connect
Issues
is4 4592 I don't using reverse proxy or I have no idea how to do it.
Also I fixed some new problem with proxy My MVC have redirect mybest.domain.com:433 to mybest.domain.com:6666 in Docker `
options.Events.OnRedirectToIdentityProvider = context =>
{
// Intercept the redirection so the browser navigates to the right URL in your host
context.ProtocolMessage.IssuerAddress = "https://sso-mybest.domain.com/connect/authorize";
context.ProtocolMessage.RedirectUri = "https://mybest.domain.com/signin-oidc";
return Task.CompletedTask;
};
` Can I replace this code some primary solution?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Questions are community supported only and the authors/maintainers may or may not have time to reply. If you or your company would like commercial support, please see here for more information.
I have similar issue when using a JS client ( using angular-oauth2-oidc package) and IS4 hosted on external docker. My issue is when returning from IS4 authentication I got Cors blocked.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.