File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ export class AuthSSOServer {
107107 resolve ( )
108108 } )
109109
110- this . server . listen ( )
110+ this . server . listen ( 0 , '127.0.0.1' )
111111 } )
112112 }
113113
@@ -134,8 +134,12 @@ export class AuthSSOServer {
134134 return `${ this . baseUrl } :${ this . getPort ( ) } `
135135 }
136136
137+ public getAddress ( ) {
138+ return this . server . address ( )
139+ }
140+
137141 private getPort ( ) : number {
138- const addr = this . server . address ( )
142+ const addr = this . getAddress ( )
139143 if ( addr instanceof Object ) {
140144 return addr . port
141145 } else if ( typeof addr === 'string' ) {
Original file line number Diff line number Diff line change @@ -105,4 +105,13 @@ describe('AuthSSOServer', function () {
105105 const token = await server . waitForAuthorization ( )
106106 assert . deepStrictEqual ( code , token )
107107 } )
108+
109+ it ( 'address is bound to localhost' , function ( ) {
110+ const address = server . getAddress ( )
111+ if ( address instanceof Object ) {
112+ assert . deepStrictEqual ( address . address , '127.0.0.1' )
113+ return
114+ }
115+ assert . fail ( 'Expected address 127.0.0.1' )
116+ } )
108117} )
You can’t perform that action at this time.
0 commit comments