@mindline/sync 1.0.41 → 1.0.42
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/.vs/VSWorkspaceState.json +1 -0
- package/.vs/slnx.sqlite +0 -0
- package/.vs/sync/FileContentIndex/9f8422ce-7c66-4297-9964-e1ce6180fd31.vsidx +0 -0
- package/.vs/sync/v17/.wsuo +0 -0
- package/index.d.ts +3 -2
- package/index.ts +26 -13
- package/package.json +1 -1
- package/tasks.ts +1 -1
- package/.vs/sync/FileContentIndex/952c1cfb-eca2-4b04-b041-a15b6e311a74.vsidx +0 -0
package/.vs/slnx.sqlite
CHANGED
|
Binary file
|
package/.vs/sync/v17/.wsuo
CHANGED
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ declare module "@mindline/sync" {
|
|
|
26
26
|
loginHint: string;
|
|
27
27
|
scopes: string[];
|
|
28
28
|
authTS: Date;
|
|
29
|
+
claimsprincipal: string; // claims principal cached at login to allow clearing cache at logout
|
|
29
30
|
constructor();
|
|
30
31
|
}
|
|
31
32
|
// tenant (Azure AD tenant, AD domain, Google workspace)
|
|
@@ -104,7 +105,7 @@ declare module "@mindline/sync" {
|
|
|
104
105
|
export type TaskType = "initialization" |
|
|
105
106
|
"authenticate user" |
|
|
106
107
|
"reload React" |
|
|
107
|
-
"PUT
|
|
108
|
+
"PUT tenant" |
|
|
108
109
|
"GET tenant details" |
|
|
109
110
|
"POST config init" |
|
|
110
111
|
"GET workspaces" |
|
|
@@ -221,7 +222,7 @@ declare module "@mindline/sync" {
|
|
|
221
222
|
export function groupsGet(instance: IPublicClientApplication, user: User | undefined, groupSearchString: string): Promise<{groups: Group[], error: string}>;
|
|
222
223
|
export function signIn(user: User, tasks: TaskArray): void;
|
|
223
224
|
export function signInIncrementally(user: User, scope: string): void;
|
|
224
|
-
export function signOut(user: User):
|
|
225
|
+
export function signOut(user: User): boolean;
|
|
225
226
|
export function tenantRelationshipsGetByDomain(loggedInuser: User, tenant: Tenant, instance: IPublicClientApplication, debug: boolean): boolean;
|
|
226
227
|
export function tenantRelationshipsGetById(user: User, ii: InitInfo, instance: IPublicClientApplication, tasks: TaskArray, debug: boolean): boolean;
|
|
227
228
|
export function tenantUnauthenticatedLookup(tenant: Tenant, debug: boolean): Promise<boolean>;
|
package/index.ts
CHANGED
|
@@ -1074,11 +1074,11 @@ export async function groupsGet(instance: IPublicClientApplication, user: User |
|
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
1076
|
export function signIn(user: User, tasks: TaskArray): void {
|
|
1077
|
+
// SignIn by an admin consents the full set of permissions, unlike Challenge which requires a consented app
|
|
1077
1078
|
let tenantURL: string = window.location.href;
|
|
1078
|
-
tenantURL += "MicrosoftIdentity/Account/
|
|
1079
|
+
tenantURL += "MicrosoftIdentity/Account/SignIn";
|
|
1079
1080
|
let url: URL = new URL(tenantURL);
|
|
1080
1081
|
url.searchParams.append("redirectUri", window.location.origin);
|
|
1081
|
-
url.searchParams.append("scope", "openid offline_access Directory.AccessAsUser.All CrossTenantInformation.ReadBasic.All");
|
|
1082
1082
|
url.searchParams.append("domainHint", "organizations");
|
|
1083
1083
|
if (user.oid !== "1") {
|
|
1084
1084
|
url.searchParams.append("loginHint", user.mail);
|
|
@@ -1099,18 +1099,31 @@ export function signInIncrementally(user: User, scope: string): void {
|
|
|
1099
1099
|
url.searchParams.append("loginHint", user.mail);
|
|
1100
1100
|
window.location.assign(url.href);
|
|
1101
1101
|
}
|
|
1102
|
-
export function signOut(user: User):
|
|
1102
|
+
export async function signOut(user: User): Promise<boolean>{
|
|
1103
1103
|
if (user.oid == "1") return;
|
|
1104
|
-
//
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
url.searchParams.append("
|
|
1112
|
-
|
|
1113
|
-
|
|
1104
|
+
// set logout_hint in the .NET session for streamlined logout
|
|
1105
|
+
let userEndpoint: string = window.location.href;
|
|
1106
|
+
userEndpoint += "user";
|
|
1107
|
+
let url = new URL(userEndpoint);
|
|
1108
|
+
url.searchParams.append("oid", user.oid);
|
|
1109
|
+
url.searchParams.append("tid", user.tid);
|
|
1110
|
+
url.searchParams.append("loginHint", user.loginHint);
|
|
1111
|
+
url.searchParams.append("verb", "LOGOUT");
|
|
1112
|
+
let options = { method: "PATCH" };
|
|
1113
|
+
let userLogoutResponse: Response = await fetch(url.href, options);
|
|
1114
|
+
if (userLogoutResponse.status == 200 && userLogoutResponse.statusText == "OK") {
|
|
1115
|
+
console.log(`Successfully set admin ${user.mail} logout_hint`);
|
|
1116
|
+
}
|
|
1117
|
+
else {
|
|
1118
|
+
console.log(`Failed to set admin ${user.mail} logout_hint`);
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
// start the logout process triggering callbacks during logout
|
|
1122
|
+
// OnRedirectToIdentityProviderForSignOut - this is where we set the logout_hint for user we are trying to logout
|
|
1123
|
+
// OnSignedOutCallbackRedirect - called when the call sucessfully completes
|
|
1124
|
+
let signoutURL: string = window.location.href;
|
|
1125
|
+
signoutURL += "MicrosoftIdentity/Account/SignOut";
|
|
1126
|
+
window.location.assign(signoutURL);
|
|
1114
1127
|
}
|
|
1115
1128
|
//tenantRelationshipsGetByDomain - query AAD for associated company name and id
|
|
1116
1129
|
export async function tenantRelationshipsGetByDomain(loggedInUser: User, tenant: Tenant, instance: IPublicClientApplication, debug: boolean): Promise<boolean> {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindline/sync",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.42",
|
|
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.",
|
package/tasks.ts
CHANGED
|
Binary file
|