File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
packages/oidc-mock-provider Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const { OIDCMockProvider } = require('..');
6
6
7
7
const DEFAULT_PORT = 28200 ;
8
8
const DEFAULT_HOST = 'localhost' ;
9
+ const DEFAULT_BIND_IP_ALL = false ;
9
10
10
11
const argv = require ( 'yargs' )
11
12
. option ( 'port' , {
@@ -18,6 +19,10 @@ const argv = require('yargs')
18
19
type : 'string' ,
19
20
desc : 'Hostname for the server to listen upon. Defaults to localhost.' ,
20
21
} )
22
+ . option ( 'bind_ip_all' , {
23
+ type : 'boolean' ,
24
+ desc : 'Bind to all IPv4 and IPv6 addresses' ,
25
+ } )
21
26
. example (
22
27
'$0 -p 28200' ,
23
28
'Start the OIDC mock identity provider server on port 28200'
@@ -41,6 +46,7 @@ const DEFAULT_TOKEN_PAYLOAD = {
41
46
} ,
42
47
port : argv . port ?? DEFAULT_PORT ,
43
48
hostname : argv . host ?? DEFAULT_HOST ,
49
+ bindIpAll : argv . bind_ip_all ?? DEFAULT_BIND_IP_ALL ,
44
50
} ;
45
51
const mockIdentityProvider = await OIDCMockProvider . create (
46
52
oidcMockProviderConfig
Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ export interface OIDCMockProviderConfig {
60
60
*/
61
61
hostname ?: string ;
62
62
63
+ /**
64
+ * Optional bind to all IPv4 and IPv6 addresses.
65
+ */
66
+ bindIpAll ?: boolean ;
67
+
63
68
/**
64
69
* Optional additional fields to be returned when the OIDC configuration is accessed.
65
70
*/
@@ -102,7 +107,10 @@ export class OIDCMockProvider {
102
107
}
103
108
104
109
private async init ( ) : Promise < this> {
105
- this . httpServer . listen ( this . config . port ?? 0 , this . config . hostname ) ;
110
+ this . httpServer . listen (
111
+ this . config . port ?? 0 ,
112
+ this . config . bindIpAll ? '::,0.0.0.0' : this . config . hostname
113
+ ) ;
106
114
await once ( this . httpServer , 'listening' ) ;
107
115
const { port } = this . httpServer . address ( ) as AddressInfo ;
108
116
this . issuer = `${
You can’t perform that action at this time.
0 commit comments