Add telemetry event for settings sync auth
This commit is contained in:
parent
6b54950359
commit
967aab8156
2 changed files with 19 additions and 2 deletions
|
@ -33,6 +33,7 @@ interface ITokenClaims {
|
|||
unique_name?: string;
|
||||
oid?: string;
|
||||
altsecid?: string;
|
||||
ipd?: string;
|
||||
scp: string;
|
||||
}
|
||||
|
||||
|
@ -360,7 +361,7 @@ export class AzureActiveDirectoryService {
|
|||
accessToken: json.access_token,
|
||||
refreshToken: json.refresh_token,
|
||||
scope,
|
||||
sessionId: claims.tid + (claims.oid || claims.altsecid) + scope,
|
||||
sessionId: `${claims.tid}/${(claims.oid || (claims.altsecid || '' + claims.ipd || ''))}/${scope}`,
|
||||
displayName: claims.email || claims.unique_name || 'user@example.com'
|
||||
};
|
||||
}
|
||||
|
|
|
@ -143,6 +143,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
|
|||
}
|
||||
|
||||
if (sessions.length === 1) {
|
||||
this.logAuthenticatedEvent(sessions[0]);
|
||||
this.activeAccount = sessions[0];
|
||||
return;
|
||||
}
|
||||
|
@ -155,10 +156,25 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
|
|||
}), { canPickMany: false });
|
||||
|
||||
if (selectedAccount) {
|
||||
this.activeAccount = sessions.filter(account => selectedAccount.id === account.id)[0];
|
||||
const selected = sessions.filter(account => selectedAccount.id === account.id)[0];
|
||||
this.logAuthenticatedEvent(selected);
|
||||
this.activeAccount = selected;
|
||||
}
|
||||
}
|
||||
|
||||
private logAuthenticatedEvent(session: AuthenticationSession): void {
|
||||
type UserAuthenticatedClassification = {
|
||||
id: { classification: 'EndUserPseudonymizedInformation', purpose: 'BusinessInsight' };
|
||||
};
|
||||
|
||||
type UserAuthenticatedEvent = {
|
||||
id: string;
|
||||
};
|
||||
|
||||
const id = session.id.split('/')[1];
|
||||
this.telemetryService.publicLog2<UserAuthenticatedEvent, UserAuthenticatedClassification>('user.authenticated', { id });
|
||||
}
|
||||
|
||||
get activeAccount(): AuthenticationSession | undefined {
|
||||
return this._activeAccount;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue