Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@equinor/fusion-framework-module-msal

Package Overview
Dependencies
Maintainers
3
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/fusion-framework-module-msal - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.1.7](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.1.6...@equinor/fusion-framework-module-msal@0.1.7) (2022-02-23)
### Bug Fixes
* **module-msal:** await auth ([#33](https://github.com/equinor/fusion-framework/issues/33)) ([d4c3dbd](https://github.com/equinor/fusion-framework/commit/d4c3dbd0afc6a3adebe23853ccd363d1bf37f131))
## [0.1.6](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.1.5...@equinor/fusion-framework-module-msal@0.1.6) (2022-02-23)

@@ -8,0 +19,0 @@

17

dist/esm/client/client.js

@@ -7,4 +7,13 @@ import { PublicClientApplication, } from '@azure/msal-browser';

const accounts = this.getAllAccounts();
return accounts.find((a) => a.idTokenClaims?.aud === this.clientId);
const account = accounts.find((a) => a.idTokenClaims?.aud === this.clientId);
return account;
}
get hasValidClaims() {
const { idTokenClaims } = this.account ?? {};
if (idTokenClaims) {
const epoch = Math.ceil(Date.now() / 1000);
return idTokenClaims.exp > epoch;
}
return false;
}
get clientId() {

@@ -27,3 +36,4 @@ return this.config.auth?.clientId;

try {
return this.ssoSilent(request);
const res = await this.ssoSilent(request);
return res;
}

@@ -48,3 +58,4 @@ catch {

try {
return this.acquireTokenSilent({ account, ...options });
const token = await this.acquireTokenSilent({ account, ...options });
return token;
}

@@ -51,0 +62,0 @@ catch (err) {

@@ -1,7 +0,15 @@

import { PublicClientApplication, Configuration, AuthenticationResult, AccountInfo } from '@azure/msal-browser';
import { PublicClientApplication, Configuration, AuthenticationResult, AccountInfo as AccountInfoBase } from '@azure/msal-browser';
import { AuthBehavior } from './behavior';
import { AuthRequest } from './request';
export declare type IdTokenClaims = {
aud: string;
exp: number;
};
export declare type AccountInfo = AccountInfoBase & {
idTokenClaims?: IdTokenClaims;
};
export declare class AuthClient extends PublicClientApplication {
readonly tenantId: string;
get account(): AccountInfo | undefined;
get hasValidClaims(): boolean;
get clientId(): string | undefined;

@@ -8,0 +16,0 @@ get requestOrigin(): string | null;

4

package.json
{
"name": "@equinor/fusion-framework-module-msal",
"version": "0.1.6",
"version": "0.1.7",
"description": "",

@@ -36,3 +36,3 @@ "main": "./dist/esm/index.js",

},
"gitHead": "075883ab8865523aef6a373e4aeccf1c54c095b4"
"gitHead": "cbb102f5162153624948cce8c45a5e608ce2feba"
}

@@ -8,3 +8,3 @@ import {

RedirectRequest,
AccountInfo,
AccountInfo as AccountInfoBase,
} from '@azure/msal-browser';

@@ -15,2 +15,11 @@

export type IdTokenClaims = {
aud: string;
exp: number;
};
export type AccountInfo = AccountInfoBase & {
idTokenClaims?: IdTokenClaims;
};
/**

@@ -55,5 +64,17 @@ * ### Simple extension of Microsoft`s authentication client.

const accounts = this.getAllAccounts();
return accounts.find((a) => (a.idTokenClaims as { aud: string })?.aud === this.clientId);
const account = accounts.find(
(a) => (a as AccountInfo).idTokenClaims?.aud === this.clientId
);
return account as AccountInfo;
}
get hasValidClaims(): boolean {
const { idTokenClaims } = this.account ?? {};
if (idTokenClaims) {
const epoch = Math.ceil(Date.now() / 1000);
return idTokenClaims.exp > epoch;
}
return false;
}
/**

@@ -101,3 +122,4 @@ * @returns - Configured client id

try {
return this.ssoSilent(request as SsoSilentRequest);
const res = await this.ssoSilent(request as SsoSilentRequest);
return res;
} catch {

@@ -142,3 +164,4 @@ this.logger.verbose('Silent login attempt failed');

try {
return this.acquireTokenSilent({ account, ...options });
const token = await this.acquireTokenSilent({ account, ...options });
return token;
} catch (err) {

@@ -145,0 +168,0 @@ this.logger.info(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc