File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
msal4j-sdk/src/main/java/com/microsoft/aad/msal4j Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11
11
import org .slf4j .Logger ;
12
12
import org .slf4j .LoggerFactory ;
13
13
14
+ import java .net .InetAddress ;
14
15
import java .net .InetSocketAddress ;
15
16
16
17
@ Accessors (fluent = true )
@@ -25,7 +26,13 @@ class HttpListener {
25
26
26
27
void startListener (int port , HttpHandler httpHandler ) {
27
28
try {
28
- server = HttpServer .create (new InetSocketAddress (port ), 0 );
29
+ // since we only allow loopback address, we can use InetAddress.getLoopbackAddress() directly
30
+ // why? because currently we are creating Socket using InetSocketAddress(port)
31
+ // which is using wildcard address, so it will attempt to bind to all available network interfaces
32
+ // that includes private IP like 192.168.x.x, 10.x.x.x, etc.
33
+ // which in turns, will trigger the firewall prompt
34
+ // https://github.com/AzureAD/microsoft-authentication-library-for-java/issues/796
35
+ server = HttpServer .create (new InetSocketAddress (InetAddress .getLoopbackAddress (), port ), 0 );
29
36
server .createContext ("/" , httpHandler );
30
37
this .port = server .getAddress ().getPort ();
31
38
server .start ();
You can’t perform that action at this time.
0 commit comments