Closed 4censord closed 1 year ago
Thanks for bringing this to my attention.
The redirect that is used after login has to be configured with Microsoft beforehand. The Problem being Microsoft not currently supporting [::1]
as a redirect target.
It should be possible to redirect to http://localhost:52371
instead whenever IPv6 is used, would that resolve your problem?
You should be able to use the "Any Device" Option on the right for logging in until this gets fixed.
The redirect that is used after login has to be configured with Microsoft beforehand. The Problem being Microsoft not currently supporting [::1] as a redirect target.
Okay, surprising.
It should be possible to redirect to http://localhost:52371 instead whenever IPv6 is used, would that resolve your problem?
I assume that might make it worse in a fails intermittendly
kind of way
The local DNS resolver might round-robin answer with ipv4 and ipv6, leading it to only fail sometimes
The Problem being Microsoft not currently supporting [::1] as a redirect target.
I would just bind explicitly to the ipv4 localhost, maybe with
InetSocketAddress localAddress = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), port);
Then redirecting to http://127.0.0.1:52371 should work even if ipv6 is preferred
It may be good to log the case that no ipv4 is available, and direct to this issue.
You should be able to use the "Any Device" Option on the right for logging in until this gets fixed.
Thank you, I will try that.
Should be fixed for Version 4.0.6.
To reproduce
-Djava.net.preferIPv6Addresses=true
as additional launch optionThis Device
http://127.0.0.1:52371/
Unable to connect
The problem seems to bee that the java process is opening a socket for
localhost
(InetAddress.getLoopbackAddress()
), and that gets resolved to[::1]
(IPv6 localhost). But the redirect either gets resolved differently, or is simply hard-coded to 127.0.0.1.This can be seen by using ss on Linux:
I have tested this on Linux and macOS, versions:
With Firefox and safari, respectively
As far as I understand this happens here: https://github.com/TechnicianLP/ReAuth/blob/3ee5617be511eccb890998d1daeb7dfba5ca94b8/src/common/java/technicianlp/reauth/authentication/http/server/AuthenticationCodeServer.java#L32
I would say to solve this we should:
127.0.0.1
or[::1]