@emilgroup/tenant-sdk 1.42.1-beta.104 → 1.42.1-beta.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
17
17
  Navigate to the folder of your consuming project and run one of the following commands:
18
18
 
19
19
  ```
20
- npm install @emilgroup/tenant-sdk@1.42.1-beta.104 --save
20
+ npm install @emilgroup/tenant-sdk@1.42.1-beta.106 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/tenant-sdk@1.42.1-beta.104
24
+ yarn add @emilgroup/tenant-sdk@1.42.1-beta.106
25
25
  ```
26
26
 
27
27
  And then you can import `UsersApi`.
@@ -566,7 +566,7 @@ export const UserControllerRestApiAxiosParamCreator = function (configuration?:
566
566
  };
567
567
  },
568
568
  /**
569
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
569
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
570
570
  * @summary List users
571
571
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
572
572
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -776,7 +776,7 @@ export const UserControllerRestApiFp = function(configuration?: Configuration) {
776
776
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
777
777
  },
778
778
  /**
779
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
779
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
780
780
  * @summary List users
781
781
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
782
782
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -918,7 +918,7 @@ export const UserControllerRestApiFactory = function (configuration?: Configurat
918
918
  return localVarFp.listInvites(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then((request) => request(axios, basePath));
919
919
  },
920
920
  /**
921
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
921
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
922
922
  * @summary List users
923
923
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
924
924
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -1396,7 +1396,7 @@ export class UserControllerRestApi extends BaseAPI {
1396
1396
  }
1397
1397
 
1398
1398
  /**
1399
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
1399
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
1400
1400
  * @summary List users
1401
1401
  * @param {UserControllerRestApiListUsersRequest} requestParameters Request parameters.
1402
1402
  * @param {*} [options] Override http request option.
package/api/users-api.ts CHANGED
@@ -339,7 +339,7 @@ export const UsersApiAxiosParamCreator = function (configuration?: Configuration
339
339
  };
340
340
  },
341
341
  /**
342
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
342
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
343
343
  * @summary List users
344
344
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
345
345
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -495,7 +495,7 @@ export const UsersApiFp = function(configuration?: Configuration) {
495
495
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
496
496
  },
497
497
  /**
498
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
498
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
499
499
  * @summary List users
500
500
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
501
501
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -587,7 +587,7 @@ export const UsersApiFactory = function (configuration?: Configuration, basePath
587
587
  return localVarFp.linkUserWithPartner(code, linkUserWithPartnerRequestDtoRest, authorization, options).then((request) => request(axios, basePath));
588
588
  },
589
589
  /**
590
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
590
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
591
591
  * @summary List users
592
592
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
593
593
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -891,7 +891,7 @@ export class UsersApi extends BaseAPI {
891
891
  }
892
892
 
893
893
  /**
894
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
894
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
895
895
  * @summary List users
896
896
  * @param {UsersApiListUsersRequest} requestParameters Request parameters.
897
897
  * @param {*} [options] Override http request option.
package/base.ts CHANGED
@@ -102,10 +102,14 @@ export class BaseAPI {
102
102
  this.configuration = configuration;
103
103
  this.basePath = configuration.basePath || this.basePath;
104
104
 
105
- // Use config token if provided, otherwise use tokenData token
106
- const configToken = this.configuration.accessToken;
107
- const storedToken = accessToken ? `Bearer ${accessToken}` : '';
108
- this.configuration.accessToken = configToken || storedToken;
105
+ if (configuration.cookieAuth) {
106
+ this.useCookieAuth();
107
+ } else {
108
+ // Use config token if provided, otherwise use tokenData token
109
+ const configToken = this.configuration.accessToken;
110
+ const storedToken = accessToken ? `Bearer ${accessToken}` : '';
111
+ this.configuration.accessToken = configToken || storedToken;
112
+ }
109
113
  } else {
110
114
  const { accessToken, username } = this.tokenData;
111
115
 
@@ -119,6 +123,12 @@ export class BaseAPI {
119
123
  this.attachInterceptor(axios);
120
124
  }
121
125
 
126
+ // Cookie mode: the browser sends the HttpOnly access cookie, so no token is read from storage.
127
+ private useCookieAuth() {
128
+ this.configuration.username = this.configuration.username || this.tokenData.username;
129
+ this.configuration.baseOptions = { ...this.configuration.baseOptions, withCredentials: true };
130
+ }
131
+
122
132
  selectEnvironment(env: Environment) {
123
133
  this.selectBasePath(env);
124
134
  }
@@ -152,10 +162,12 @@ export class BaseAPI {
152
162
  const { data: { accessToken, permissions } } = response;
153
163
 
154
164
  this.configuration.username = username;
155
- this.configuration.accessToken = `Bearer ${accessToken}`;
156
165
  this.tokenData.username = username;
157
- this.tokenData.accessToken = accessToken;
158
166
  this.tokenData.permissions = permissions;
167
+ if (!this.configuration.cookieAuth) {
168
+ this.configuration.accessToken = `Bearer ${accessToken}`;
169
+ this.tokenData.accessToken = accessToken;
170
+ }
159
171
 
160
172
  // Switch workspace if provided
161
173
  if (targetWorkspace) {
@@ -178,7 +190,7 @@ export class BaseAPI {
178
190
  url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
179
191
  headers: {
180
192
  'Content-Type': 'application/json',
181
- 'Authorization': `Bearer ${this.configuration.accessToken}`,
193
+ ...(this.configuration.cookieAuth ? {} : { 'Authorization': `Bearer ${this.configuration.accessToken}` }),
182
194
  },
183
195
  data: {
184
196
  username: this.configuration.username,
@@ -190,10 +202,12 @@ export class BaseAPI {
190
202
  const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
191
203
 
192
204
  const { data: { accessToken, permissions } } = response;
193
-
194
- this.configuration.accessToken = `Bearer ${accessToken}`;
195
- this.tokenData.accessToken = accessToken;
205
+
196
206
  this.tokenData.permissions = permissions;
207
+ if (!this.configuration.cookieAuth) {
208
+ this.configuration.accessToken = `Bearer ${accessToken}`;
209
+ this.tokenData.accessToken = accessToken;
210
+ }
197
211
 
198
212
  this.storeTokenData({
199
213
  ...this.tokenData
@@ -233,6 +247,11 @@ export class BaseAPI {
233
247
 
234
248
  private storeTokenData(tokenData?: TokenData) {
235
249
  if (typeof window !== 'undefined') {
250
+ if (tokenData && this.configuration?.cookieAuth) {
251
+ // Cookie mode saves who is logged in, never the token; a token saved by apps not yet migrated stays.
252
+ const { username, permissions } = tokenData;
253
+ tokenData = { ...(defaultStorage().get<TokenData>(TOKEN_DATA) || {}), username, permissions };
254
+ }
236
255
  defaultStorage().set<TokenData>(TOKEN_DATA, tokenData);
237
256
  }
238
257
  }
@@ -263,15 +282,17 @@ export class BaseAPI {
263
282
  originalConfig._retry = true;
264
283
  try {
265
284
  const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
266
- const accessToken = `Bearer ${tokenString}`;
267
285
  this.tokenData.permissions = permissions;
268
286
 
269
287
  delete originalConfig.headers['Authorization']
270
288
 
271
- originalConfig.headers['Authorization'] = accessToken;
272
-
273
- this.configuration.accessToken = accessToken;
274
- this.tokenData.accessToken = tokenString;
289
+ // In cookie mode the refresh reply renewed the access cookie, so retry without a header.
290
+ if (!this.configuration.cookieAuth) {
291
+ const accessToken = `Bearer ${tokenString}`;
292
+ originalConfig.headers['Authorization'] = accessToken;
293
+ this.configuration.accessToken = accessToken;
294
+ this.tokenData.accessToken = tokenString;
295
+ }
275
296
 
276
297
  this.storeTokenData(this.tokenData);
277
298
 
package/configuration.ts CHANGED
@@ -21,6 +21,7 @@ export interface ConfigurationParameters {
21
21
  basePath?: string;
22
22
  baseOptions?: any;
23
23
  formDataCtor?: new () => any;
24
+ cookieAuth?: boolean;
24
25
  }
25
26
 
26
27
  export class Configuration {
@@ -74,6 +75,15 @@ export class Configuration {
74
75
  */
75
76
  formDataCtor?: new () => any;
76
77
 
78
+ /**
79
+ * Authenticate with the HttpOnly access cookie instead of a stored token: every call sends credentials.
80
+ * The browser holds one cookie, so use it with one logged-in account; log out through the auth service.
81
+ *
82
+ * @type {boolean}
83
+ * @memberof Configuration
84
+ */
85
+ cookieAuth?: boolean;
86
+
77
87
  constructor(param: ConfigurationParameters = {}) {
78
88
  this.apiKey = param.apiKey;
79
89
  this.username = param.username;
@@ -82,6 +92,7 @@ export class Configuration {
82
92
  this.basePath = param.basePath;
83
93
  this.baseOptions = param.baseOptions;
84
94
  this.formDataCtor = param.formDataCtor;
95
+ this.cookieAuth = param.cookieAuth;
85
96
  }
86
97
 
87
98
  /**
@@ -129,7 +129,7 @@ export declare const UserControllerRestApiAxiosParamCreator: (configuration?: Co
129
129
  */
130
130
  listInvites: (authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
131
131
  /**
132
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
132
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
133
133
  * @summary List users
134
134
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
135
135
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -244,7 +244,7 @@ export declare const UserControllerRestApiFp: (configuration?: Configuration) =>
244
244
  */
245
245
  listInvites(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListInvitesResponseClass>>;
246
246
  /**
247
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
247
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
248
248
  * @summary List users
249
249
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
250
250
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -359,7 +359,7 @@ export declare const UserControllerRestApiFactory: (configuration?: Configuratio
359
359
  */
360
360
  listInvites(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListInvitesResponseClass>;
361
361
  /**
362
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
362
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
363
363
  * @summary List users
364
364
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
365
365
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -766,7 +766,7 @@ export declare class UserControllerRestApi extends BaseAPI {
766
766
  */
767
767
  listInvites(requestParameters?: UserControllerRestApiListInvitesRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListInvitesResponseClass, any, {}>>;
768
768
  /**
769
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
769
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
770
770
  * @summary List users
771
771
  * @param {UserControllerRestApiListUsersRequest} requestParameters Request parameters.
772
772
  * @param {*} [options] Override http request option.
@@ -612,7 +612,7 @@ var UserControllerRestApiAxiosParamCreator = function (configuration) {
612
612
  });
613
613
  },
614
614
  /**
615
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
615
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
616
616
  * @summary List users
617
617
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
618
618
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -908,7 +908,7 @@ var UserControllerRestApiFp = function (configuration) {
908
908
  });
909
909
  },
910
910
  /**
911
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
911
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
912
912
  * @summary List users
913
913
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
914
914
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -1059,7 +1059,7 @@ var UserControllerRestApiFactory = function (configuration, basePath, axios) {
1059
1059
  return localVarFp.listInvites(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then(function (request) { return request(axios, basePath); });
1060
1060
  },
1061
1061
  /**
1062
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
1062
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
1063
1063
  * @summary List users
1064
1064
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1065
1065
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -1206,7 +1206,7 @@ var UserControllerRestApi = /** @class */ (function (_super) {
1206
1206
  return (0, exports.UserControllerRestApiFp)(this.configuration).listInvites(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then(function (request) { return request(_this.axios, _this.basePath); });
1207
1207
  };
1208
1208
  /**
1209
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
1209
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
1210
1210
  * @summary List users
1211
1211
  * @param {UserControllerRestApiListUsersRequest} requestParameters Request parameters.
1212
1212
  * @param {*} [options] Override http request option.
@@ -82,7 +82,7 @@ export declare const UsersApiAxiosParamCreator: (configuration?: Configuration)
82
82
  */
83
83
  linkUserWithPartner: (code: string, linkUserWithPartnerRequestDtoRest: LinkUserWithPartnerRequestDtoRest, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
84
84
  /**
85
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
85
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
86
86
  * @summary List users
87
87
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
88
88
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -155,7 +155,7 @@ export declare const UsersApiFp: (configuration?: Configuration) => {
155
155
  */
156
156
  linkUserWithPartner(code: string, linkUserWithPartnerRequestDtoRest: LinkUserWithPartnerRequestDtoRest, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<LinkUserWithPartnerResponseClass>>;
157
157
  /**
158
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
158
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
159
159
  * @summary List users
160
160
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
161
161
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -228,7 +228,7 @@ export declare const UsersApiFactory: (configuration?: Configuration, basePath?:
228
228
  */
229
229
  linkUserWithPartner(code: string, linkUserWithPartnerRequestDtoRest: LinkUserWithPartnerRequestDtoRest, authorization?: string, options?: any): AxiosPromise<LinkUserWithPartnerResponseClass>;
230
230
  /**
231
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
231
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
232
232
  * @summary List users
233
233
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
234
234
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -487,7 +487,7 @@ export declare class UsersApi extends BaseAPI {
487
487
  */
488
488
  linkUserWithPartner(requestParameters: UsersApiLinkUserWithPartnerRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<LinkUserWithPartnerResponseClass, any, {}>>;
489
489
  /**
490
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
490
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
491
491
  * @summary List users
492
492
  * @param {UsersApiListUsersRequest} requestParameters Request parameters.
493
493
  * @param {*} [options] Override http request option.
@@ -393,7 +393,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
393
393
  });
394
394
  },
395
395
  /**
396
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
396
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
397
397
  * @summary List users
398
398
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
399
399
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -599,7 +599,7 @@ var UsersApiFp = function (configuration) {
599
599
  });
600
600
  },
601
601
  /**
602
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
602
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
603
603
  * @summary List users
604
604
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
605
605
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -700,7 +700,7 @@ var UsersApiFactory = function (configuration, basePath, axios) {
700
700
  return localVarFp.linkUserWithPartner(code, linkUserWithPartnerRequestDtoRest, authorization, options).then(function (request) { return request(axios, basePath); });
701
701
  },
702
702
  /**
703
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
703
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
704
704
  * @summary List users
705
705
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
706
706
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
@@ -798,7 +798,7 @@ var UsersApi = /** @class */ (function (_super) {
798
798
  return (0, exports.UsersApiFp)(this.configuration).linkUserWithPartner(requestParameters.code, requestParameters.linkUserWithPartnerRequestDtoRest, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
799
799
  };
800
800
  /**
801
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.view\"
801
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"tenant-management.users.list\"
802
802
  * @summary List users
803
803
  * @param {UsersApiListUsersRequest} requestParameters Request parameters.
804
804
  * @param {*} [options] Override http request option.
package/dist/base.d.ts CHANGED
@@ -63,6 +63,7 @@ export declare class BaseAPI {
63
63
  protected configuration: Configuration | undefined;
64
64
  private tokenData?;
65
65
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
66
+ private useCookieAuth;
66
67
  selectEnvironment(env: Environment): void;
67
68
  selectBasePath(path: string): void;
68
69
  getPermissions(): Array<string>;
package/dist/base.js CHANGED
@@ -128,10 +128,15 @@ var BaseAPI = /** @class */ (function () {
128
128
  var accessToken = this.tokenData.accessToken;
129
129
  this.configuration = configuration;
130
130
  this.basePath = configuration.basePath || this.basePath;
131
- // Use config token if provided, otherwise use tokenData token
132
- var configToken = this.configuration.accessToken;
133
- var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
134
- this.configuration.accessToken = configToken || storedToken;
131
+ if (configuration.cookieAuth) {
132
+ this.useCookieAuth();
133
+ }
134
+ else {
135
+ // Use config token if provided, otherwise use tokenData token
136
+ var configToken = this.configuration.accessToken;
137
+ var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
138
+ this.configuration.accessToken = configToken || storedToken;
139
+ }
135
140
  }
136
141
  else {
137
142
  var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
@@ -143,6 +148,11 @@ var BaseAPI = /** @class */ (function () {
143
148
  }
144
149
  this.attachInterceptor(axios);
145
150
  }
151
+ // Cookie mode: the browser sends the HttpOnly access cookie, so no token is read from storage.
152
+ BaseAPI.prototype.useCookieAuth = function () {
153
+ this.configuration.username = this.configuration.username || this.tokenData.username;
154
+ this.configuration.baseOptions = __assign(__assign({}, this.configuration.baseOptions), { withCredentials: true });
155
+ };
146
156
  BaseAPI.prototype.selectEnvironment = function (env) {
147
157
  this.selectBasePath(env);
148
158
  };
@@ -177,10 +187,12 @@ var BaseAPI = /** @class */ (function () {
177
187
  response = _b.sent();
178
188
  _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
179
189
  this.configuration.username = username;
180
- this.configuration.accessToken = "Bearer ".concat(accessToken);
181
190
  this.tokenData.username = username;
182
- this.tokenData.accessToken = accessToken;
183
191
  this.tokenData.permissions = permissions;
192
+ if (!this.configuration.cookieAuth) {
193
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
194
+ this.tokenData.accessToken = accessToken;
195
+ }
184
196
  if (!targetWorkspace) return [3 /*break*/, 3];
185
197
  return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
186
198
  case 2:
@@ -206,10 +218,7 @@ var BaseAPI = /** @class */ (function () {
206
218
  options = {
207
219
  method: 'POST',
208
220
  url: "".concat(this.configuration.basePath, "/authservice/v1/workspaces/switch"),
209
- headers: {
210
- 'Content-Type': 'application/json',
211
- 'Authorization': "Bearer ".concat(this.configuration.accessToken),
212
- },
221
+ headers: __assign({ 'Content-Type': 'application/json' }, (this.configuration.cookieAuth ? {} : { 'Authorization': "Bearer ".concat(this.configuration.accessToken) })),
213
222
  data: {
214
223
  username: this.configuration.username,
215
224
  targetWorkspace: targetWorkspace,
@@ -220,9 +229,11 @@ var BaseAPI = /** @class */ (function () {
220
229
  case 1:
221
230
  response = _b.sent();
222
231
  _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
223
- this.configuration.accessToken = "Bearer ".concat(accessToken);
224
- this.tokenData.accessToken = accessToken;
225
232
  this.tokenData.permissions = permissions;
233
+ if (!this.configuration.cookieAuth) {
234
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
235
+ this.tokenData.accessToken = accessToken;
236
+ }
226
237
  this.storeTokenData(__assign({}, this.tokenData));
227
238
  return [2 /*return*/];
228
239
  }
@@ -265,7 +276,13 @@ var BaseAPI = /** @class */ (function () {
265
276
  });
266
277
  };
267
278
  BaseAPI.prototype.storeTokenData = function (tokenData) {
279
+ var _a;
268
280
  if (typeof window !== 'undefined') {
281
+ if (tokenData && ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.cookieAuth)) {
282
+ // Cookie mode saves who is logged in, never the token; a token saved by apps not yet migrated stays.
283
+ var username = tokenData.username, permissions = tokenData.permissions;
284
+ tokenData = __assign(__assign({}, ((0, common_1.defaultStorage)().get(TOKEN_DATA) || {})), { username: username, permissions: permissions });
285
+ }
269
286
  (0, common_1.defaultStorage)().set(TOKEN_DATA, tokenData);
270
287
  }
271
288
  };
@@ -300,12 +317,15 @@ var BaseAPI = /** @class */ (function () {
300
317
  return [4 /*yield*/, this.refreshTokenInternal()];
301
318
  case 2:
302
319
  _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
303
- accessToken = "Bearer ".concat(tokenString);
304
320
  this.tokenData.permissions = permissions;
305
321
  delete originalConfig.headers['Authorization'];
306
- originalConfig.headers['Authorization'] = accessToken;
307
- this.configuration.accessToken = accessToken;
308
- this.tokenData.accessToken = tokenString;
322
+ // In cookie mode the refresh reply renewed the access cookie, so retry without a header.
323
+ if (!this.configuration.cookieAuth) {
324
+ accessToken = "Bearer ".concat(tokenString);
325
+ originalConfig.headers['Authorization'] = accessToken;
326
+ this.configuration.accessToken = accessToken;
327
+ this.tokenData.accessToken = tokenString;
328
+ }
309
329
  this.storeTokenData(this.tokenData);
310
330
  return [2 /*return*/, axios(originalConfig)];
311
331
  case 3:
@@ -17,6 +17,7 @@ export interface ConfigurationParameters {
17
17
  basePath?: string;
18
18
  baseOptions?: any;
19
19
  formDataCtor?: new () => any;
20
+ cookieAuth?: boolean;
20
21
  }
21
22
  export declare class Configuration {
22
23
  /**
@@ -68,6 +69,14 @@ export declare class Configuration {
68
69
  * @type {new () => FormData}
69
70
  */
70
71
  formDataCtor?: new () => any;
72
+ /**
73
+ * Authenticate with the HttpOnly access cookie instead of a stored token: every call sends credentials.
74
+ * The browser holds one cookie, so use it with one logged-in account; log out through the auth service.
75
+ *
76
+ * @type {boolean}
77
+ * @memberof Configuration
78
+ */
79
+ cookieAuth?: boolean;
71
80
  constructor(param?: ConfigurationParameters);
72
81
  /**
73
82
  * Check if the given MIME is a JSON MIME.
@@ -24,6 +24,7 @@ var Configuration = /** @class */ (function () {
24
24
  this.basePath = param.basePath;
25
25
  this.baseOptions = param.baseOptions;
26
26
  this.formDataCtor = param.formDataCtor;
27
+ this.cookieAuth = param.cookieAuth;
27
28
  }
28
29
  /**
29
30
  * Check if the given MIME is a JSON MIME.
@@ -33,4 +33,10 @@ export interface OidcSsoDetailsInputDto {
33
33
  * @memberof OidcSsoDetailsInputDto
34
34
  */
35
35
  'clientSecret': string;
36
+ /**
37
+ * OAuth scopes the user pool asks the identity provider for, `openid`, `email` and `profile` among them. Leave empty for `openid`, `email` and `profile`.
38
+ * @type {Array<string>}
39
+ * @memberof OidcSsoDetailsInputDto
40
+ */
41
+ 'authorizeScopes'?: Array<string>;
36
42
  }
@@ -33,4 +33,10 @@ export interface OidcSsoDetailsUpdateDto {
33
33
  * @memberof OidcSsoDetailsUpdateDto
34
34
  */
35
35
  'clientSecret'?: string;
36
+ /**
37
+ * OAuth scopes the user pool asks the identity provider for, `openid`, `email` and `profile` among them. Leave empty to keep the current ones.
38
+ * @type {Array<string>}
39
+ * @memberof OidcSsoDetailsUpdateDto
40
+ */
41
+ 'authorizeScopes'?: Array<string>;
36
42
  }
@@ -28,4 +28,10 @@ export interface OidcSsoSetupClass {
28
28
  * @memberof OidcSsoSetupClass
29
29
  */
30
30
  'attributeMapping': Array<SsoAttributeMappingTemplateClass>;
31
+ /**
32
+ * OAuth scopes a new connection asks the identity provider for.
33
+ * @type {Array<string>}
34
+ * @memberof OidcSsoSetupClass
35
+ */
36
+ 'authorizeScopes': Array<string>;
31
37
  }
@@ -33,4 +33,10 @@ export interface SharedOidcSsoDetailsClass {
33
33
  * @memberof SharedOidcSsoDetailsClass
34
34
  */
35
35
  'hasClientSecret': boolean;
36
+ /**
37
+ * OAuth scopes the user pool asks the identity provider for.
38
+ * @type {Array<string>}
39
+ * @memberof SharedOidcSsoDetailsClass
40
+ */
41
+ 'authorizeScopes': Array<string>;
36
42
  }
@@ -38,5 +38,11 @@ export interface OidcSsoDetailsInputDto {
38
38
  * @memberof OidcSsoDetailsInputDto
39
39
  */
40
40
  'clientSecret': string;
41
+ /**
42
+ * OAuth scopes the user pool asks the identity provider for, `openid`, `email` and `profile` among them. Leave empty for `openid`, `email` and `profile`.
43
+ * @type {Array<string>}
44
+ * @memberof OidcSsoDetailsInputDto
45
+ */
46
+ 'authorizeScopes'?: Array<string>;
41
47
  }
42
48
 
@@ -38,5 +38,11 @@ export interface OidcSsoDetailsUpdateDto {
38
38
  * @memberof OidcSsoDetailsUpdateDto
39
39
  */
40
40
  'clientSecret'?: string;
41
+ /**
42
+ * OAuth scopes the user pool asks the identity provider for, `openid`, `email` and `profile` among them. Leave empty to keep the current ones.
43
+ * @type {Array<string>}
44
+ * @memberof OidcSsoDetailsUpdateDto
45
+ */
46
+ 'authorizeScopes'?: Array<string>;
41
47
  }
42
48
 
@@ -33,5 +33,11 @@ export interface OidcSsoSetupClass {
33
33
  * @memberof OidcSsoSetupClass
34
34
  */
35
35
  'attributeMapping': Array<SsoAttributeMappingTemplateClass>;
36
+ /**
37
+ * OAuth scopes a new connection asks the identity provider for.
38
+ * @type {Array<string>}
39
+ * @memberof OidcSsoSetupClass
40
+ */
41
+ 'authorizeScopes': Array<string>;
36
42
  }
37
43
 
@@ -38,5 +38,11 @@ export interface SharedOidcSsoDetailsClass {
38
38
  * @memberof SharedOidcSsoDetailsClass
39
39
  */
40
40
  'hasClientSecret': boolean;
41
+ /**
42
+ * OAuth scopes the user pool asks the identity provider for.
43
+ * @type {Array<string>}
44
+ * @memberof SharedOidcSsoDetailsClass
45
+ */
46
+ 'authorizeScopes': Array<string>;
41
47
  }
42
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/tenant-sdk",
3
- "version": "1.42.1-beta.104",
3
+ "version": "1.42.1-beta.106",
4
4
  "description": "OpenAPI client for @emilgroup/tenant-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [