@mindline/sync 1.0.53 → 1.0.54

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,43 @@ 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
+ case "":
1233
+ // SignIn by an admin consents more permissions than Challenge which requires a consented app
1234
+ let tenantURL: string = window.location.href;
1235
+ tenantURL += "MicrosoftIdentity/Account/SignIn";
1236
+ let url: URL = new URL(tenantURL);
1237
+ url.searchParams.append("redirectUri", window.location.origin);
1238
+ url.searchParams.append("domainHint", "organizations");
1239
+ if (user.oid !== "1") {
1240
+ url.searchParams.append("loginHint", user.mail);
1241
+ }
1242
+ tasks.setTaskStart("initialization", new Date());
1243
+ tasks.setTaskStart("authenticate user", new Date());
1244
+ window.location.assign(url.href);
1245
+ break;
1246
+ case graphConfig.authorityUS:
1247
+ // retrieve controller protected by USGov authorization
1248
+ let usURL: string = window.location.href;
1249
+ usURL += "USGov";
1250
+ let urlUS: URL = new URL(usURL);
1251
+ urlUS.searchParams.append("redirectUri", window.location.origin);
1252
+ urlUS.searchParams.append("domainHint", user.companyDomain);
1253
+ if (user.oid !== "1") {
1254
+ urlUS.searchParams.append("loginHint", user.mail);
1255
+ }
1256
+ tasks.setTaskStart("initialization", new Date());
1257
+ tasks.setTaskStart("authenticate user", new Date());
1258
+ window.location.assign(urlUS.href);
1259
+ break;
1260
+ case graphConfig.authorityCN:
1261
+ // unsupported
1262
+ break;
1263
+ default:
1264
+ debugger;
1238
1265
  }
1239
- tasks.setTaskStart("initialization", new Date());
1240
- tasks.setTaskStart("authenticate user", new Date());
1241
- window.location.assign(url.href);
1242
1266
  }
1243
1267
  export function signInIncrementally(user: User, scope: string): void {
1244
1268
  if (user.oid == "1") return;
@@ -1432,8 +1456,9 @@ export async function tenantRelationshipsGetById(user: User, ii: InitInfo, insta
1432
1456
  //tenantUnauthenticatedLookup (from https://gettenantpartitionweb.azurewebsites.net/js/gettenantpartition.js)
1433
1457
  export async function tenantUnauthenticatedLookup(tenant: Tenant, debug: boolean): Promise<boolean> {
1434
1458
  if (debug) debugger;
1459
+ // 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
1460
  // do we already have a valid tenant ID? if so, nothing to add
1436
- if (tenant.tid !== "") return false;
1461
+ //if (tenant.tid !== "") return false;
1437
1462
  // do we not have a valid domain? if so, nothing to lookup
1438
1463
  if (tenant.domain == "") return false;
1439
1464
  // 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.54",
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.",