Skip to content

Commit 0406347

Browse files
committed
tmp
1 parent fc60493 commit 0406347

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

src/authentication/armAuthenticator.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export class ArmAuthenticator implements IAuthenticator {
5151
return accessToken;
5252
}
5353

54-
public async getAccessToken(): Promise<string> {
54+
public async getAccessToken(): Promise<AccessToken> {
5555
if (this.accessToken && !this.accessToken.isExpired()) {
56-
return this.accessToken.toString();
56+
return this.accessToken;
5757
}
5858

5959
const storedAccessToken = sessionStorage.getItem("armAccessToken");
@@ -62,11 +62,16 @@ export class ArmAuthenticator implements IAuthenticator {
6262
const parsedToken = AccessToken.parse(storedAccessToken);
6363

6464
if (!parsedToken.isExpired()) {
65-
return parsedToken.toString();
65+
return parsedToken;
6666
}
6767
}
6868

6969
const accessToken = await this.tryAcquireToken();
70+
return accessToken;
71+
}
72+
73+
public async getAccessTokenAsString(): Promise<string> {
74+
const accessToken = await this.getAccessToken();
7075
return accessToken.toString();
7176
}
7277

@@ -91,12 +96,6 @@ export class ArmAuthenticator implements IAuthenticator {
9196
return false;
9297
}
9398

94-
const parsedToken = AccessToken.parse(accessToken);
95-
96-
if (!parsedToken) {
97-
return false;
98-
}
99-
100-
return !parsedToken.isExpired();
99+
return !accessToken.isExpired();
101100
}
102101
}

src/services/armService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class AzureResourceManagementService {
1717
*/
1818
public async getServiceDescription(): Promise<ServiceDescriptionContract> {
1919
const managementApiUrl = await this.settingsProvider.getSetting<string>(Constants.SettingNames.managementApiUrl);
20-
const armAccessToken = await this.authenticator.getAccessToken();
20+
const armAccessToken = await this.authenticator.getAccessTokenAsString();
2121

2222
const serviceDescriptionResponse = await this.httpClient.send<ServiceDescriptionContract>({
2323
url: `${managementApiUrl}?api-version=${Constants.managementApiVersion}`,
@@ -36,7 +36,7 @@ export class AzureResourceManagementService {
3636
*/
3737
public async getUserAccessToken(userName: string): Promise<string> {
3838
const managementApiUrl = await this.settingsProvider.getSetting<string>(Constants.SettingNames.managementApiUrl);
39-
const armAccessToken = await this.authenticator.getAccessToken();
39+
const armAccessToken = await this.authenticator.getAccessTokenAsString();
4040
const exp = new Date(new Date().valueOf() + 60 * 60 * 1000);
4141

4242
const userTokenResponse = await this.httpClient.send<ServiceDescriptionContract>({

webpack.designer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@ const designerConfig = {
6363
}),
6464
new CopyWebpackPlugin({
6565
patterns: [
66-
{ from: `./scripts/data.json`, to: "editors/themes/default.json" },
6766
{ from: `./src/themes/designer/assets/index.html`, to: "index.html" },
6867
{ from: `./src/themes/designer/styles/fonts`, to: "editors/styles/fonts" },
6968
{ from: `./src/libraries`, to: "data" },
7069
{ from: `./scripts.v3/data.json`, to: "editors/themes/default.json" },
71-
{ from: "./src/config.design.json", to: "config.json" }
70+
{ from: "./src/config.design.json" },
7271
{ from: "./src/config.runtime.json" }
7372
]
7473
})

0 commit comments

Comments
 (0)