@mindline/sync 1.0.53 → 1.0.55

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.
@@ -2,6 +2,6 @@
2
2
  "ExpandedNodes": [
3
3
  ""
4
4
  ],
5
- "SelectedNode": "\\package.json",
5
+ "SelectedNode": "\\index.ts",
6
6
  "PreviewInSolutionExplorer": false
7
7
  }
package/.vs/slnx.sqlite CHANGED
Binary file
Binary file
package/index.ts CHANGED
@@ -1226,19 +1226,42 @@ export async function groupsGet(instance: IPublicClientApplication, user: User |
1226
1226
  return { groups: [], error: `Exception: ${error}` };
1227
1227
  }
1228
1228
  }
1229
- export function signIn(user: User, tasks: TaskArray): void {
1230
- // SignIn by an admin consents the full set of permissions, unlike Challenge which requires a consented app
1231
- let tenantURL: string = window.location.href;
1232
- tenantURL += "MicrosoftIdentity/Account/SignIn";
1233
- let url: URL = new URL(tenantURL);
1234
- url.searchParams.append("redirectUri", window.location.origin);
1235
- url.searchParams.append("domainHint", "organizations");
1236
- if (user.oid !== "1") {
1237
- url.searchParams.append("loginHint", user.mail);
1229
+ export async function signIn(user: User, tasks: TaskArray): void {
1230
+ switch (user.authority) {
1231
+ case graphConfig.authorityWW:
1232
+ // SignIn by an admin consents more permissions than Challenge which requires a consented app
1233
+ let tenantURL: string = window.location.href;
1234
+ tenantURL += "MicrosoftIdentity/Account/SignIn";
1235
+ let url: URL = new URL(tenantURL);
1236
+ url.searchParams.append("redirectUri", window.location.origin);
1237
+ url.searchParams.append("domainHint", "organizations");
1238
+ if (user.oid !== "1") {
1239
+ url.searchParams.append("loginHint", user.mail);
1240
+ }
1241
+ tasks.setTaskStart("initialization", new Date());
1242
+ tasks.setTaskStart("authenticate user", new Date());
1243
+ window.location.assign(url.href);
1244
+ break;
1245
+ case graphConfig.authorityUS:
1246
+ // retrieve controller protected by USGov authorization
1247
+ let usURL: string = window.location.href;
1248
+ usURL += "USGov";
1249
+ let urlUS: URL = new URL(usURL);
1250
+ urlUS.searchParams.append("redirectUri", window.location.origin);
1251
+ urlUS.searchParams.append("domainHint", user.companyDomain);
1252
+ if (user.oid !== "1") {
1253
+ urlUS.searchParams.append("loginHint", user.mail);
1254
+ }
1255
+ tasks.setTaskStart("initialization", new Date());
1256
+ tasks.setTaskStart("authenticate user", new Date());
1257
+ window.location.assign(urlUS.href);
1258
+ break;
1259
+ case graphConfig.authorityCN:
1260
+ // unsupported
1261
+ break;
1262
+ default:
1263
+ debugger;
1238
1264
  }
1239
- tasks.setTaskStart("initialization", new Date());
1240
- tasks.setTaskStart("authenticate user", new Date());
1241
- window.location.assign(url.href);
1242
1265
  }
1243
1266
  export function signInIncrementally(user: User, scope: string): void {
1244
1267
  if (user.oid == "1") return;
@@ -1432,8 +1455,9 @@ export async function tenantRelationshipsGetById(user: User, ii: InitInfo, insta
1432
1455
  //tenantUnauthenticatedLookup (from https://gettenantpartitionweb.azurewebsites.net/js/gettenantpartition.js)
1433
1456
  export async function tenantUnauthenticatedLookup(tenant: Tenant, debug: boolean): Promise<boolean> {
1434
1457
  if (debug) debugger;
1458
+ // since we should mainly be called when a user is performing a lookup, we can afford the performance hit of looking up the tenant name and domain again
1435
1459
  // do we already have a valid tenant ID? if so, nothing to add
1436
- if (tenant.tid !== "") return false;
1460
+ //if (tenant.tid !== "") return false;
1437
1461
  // do we not have a valid domain? if so, nothing to lookup
1438
1462
  if (tenant.domain == "") return false;
1439
1463
  // prepare the 3 endpoints and corresponding regular expressions
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
3
  "type": "module",
4
- "version": "1.0.53",
4
+ "version": "1.0.55",
5
5
  "types": "index.d.ts",
6
6
  "exports": "./index.ts",
7
7
  "description": "sync is a node.js package encapsulating javscript classes required for configuring Mindline sync service.",