-
-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathkeycloak-connect-options.interface.ts
175 lines (154 loc) · 3.7 KB
/
keycloak-connect-options.interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// The typings are a bit of a mess, I'm sure there's a better way to do this.
import { LogLevel } from '@nestjs/common';
import { PolicyEnforcementMode, TokenValidation } from '../constants';
export type KeycloakConnectOptions = string | KeycloakConnectConfig;
/**
* Multi tenant configuration.
*/
export interface MultiTenantOptions {
realmResolver: (request: any) => string;
realmSecretResolver?: (realm: string) => string;
}
/**
* Library only configuration.
*/
export interface NestKeycloakConfig {
/**
* Cookie key.
*/
cookieKey?: string;
/**
* Log level.
*/
logLevels?: LogLevel[];
/**
* Use the nest logger.
*/
useNestLogger?: boolean;
/**
* Sets the policy enforcement mode for this adapter, defaults to {@link PolicyEnforcementMode.PERMISSIVE}.
*/
policyEnforcement?: PolicyEnforcementMode;
/**
* Sets the token validation method, defaults to {@link TokenValidation.ONLINE}.
*/
tokenValidation?: TokenValidation;
/**
* Multi tenant options.
*/
multiTenant?: MultiTenantOptions;
}
/**
* Keycloak Connect options.
* @see {@link https://github.com/keycloak/keycloak-nodejs-connect/blob/f8e011aea5/middleware/auth-utils/config.js}
*/
export interface KeycloakConnectConfig extends NestKeycloakConfig {
/**
* Realm ID.
*/
realm?: string;
/**
* Client/Application ID.
*/
resource?: string;
/**
* Client/Application ID.
* @see {KeycloakConnectOptions#resource}
*/
'client-id'?: string;
/**
* Client/Application ID.
* @see {KeycloakConnectOptions#resource}
*/
clientId?: string;
/**
* Client/Application secret.
*/
credentials?: KeycloakCredentials;
/**
* Client/Application secret.
* @see {KeycloakCredentials#secret}
*/
secret: string;
/**
* If this is a public application or confidential.
* @see {KeycloakConnectOptions#public}
*/
'public-client'?: boolean;
/**
* If this is a public application or confidential.
*/
public?: boolean;
/**
* Authentication server URL.
* @see {KeycloakConnectOptions#authServerUrl}
*/
'auth-server-url'?: string;
/**
* Authentication server URL.
* @see {KeycloakConnectOptions#authServerUrl}
*/
'server-url'?: string;
/**
* Authentication server URL.
* @see {KeycloakConnectOptions#authServerUrl}
*/
serverUrl?: string;
/**
* Authentication server URL.
*/
authServerUrl?: string;
/**
* How many minutes before retrying getting the keys.
* @see {KeycloakConnectOptions#minTimeBetweenJwksRequests}
*/
'min-time-between-jwks-requests'?: number;
/**
* How many minutes before retrying getting the keys.
*/
minTimeBetweenJwksRequests?: number;
/**
* If this is a Bearer Only application.
* @see {KeycloakConnectOptions#bearerOnly}
*/
'bearer-only'?: boolean;
/**
* If this is a Bearer Only application.
*/
bearerOnly?: boolean;
/**
* Formatted public-key.
* @see {KeycloakConnectOptions#realmPublicKey}
*/
'realm-public-key'?: string;
/**
* Formatted public-key.
*/
realmPublicKey?: string;
/**
* Verify token audience.
* @see {KeycloakConnectOptions#verifyTokenAudience}
*/
'verify-token-audience'?: boolean;
/**
* Verify token audience.
*/
verifyTokenAudience?: boolean;
/**
* Confidential port.
*/
'confidential-port'?: string | number;
/**
* Require SSL.
*/
'ssl-required'?: string;
}
/**
* Represents Keycloak credentials.
*/
export interface KeycloakCredentials {
/**
* Client/Application secret.
*/
secret: string;
}