WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 4ccea55

Browse files
authored
Merge pull request #901 from Timothyw0/developer/timothywang/revert-to-last-release-and-update-versions-url
fix: Update SWA versions.json metadata URL & chore: Prepare 2.0.2 release
2 parents c74de88 + 29ca328 commit 4ccea55

File tree

10 files changed

+345
-372
lines changed

10 files changed

+345
-372
lines changed

.github/workflows/azuresdkdrop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- run: npm pack
4646

4747
- name: Upload
48-
uses: actions/upload-artifact@v4
48+
uses: actions/upload-artifact@v2
4949
with:
5050
name: package
5151
path: "*.tgz"

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ jobs:
228228
- run: npm version prerelease --preid=ci-$GITHUB_RUN_ID --no-git-tag-version
229229
- run: npm pack
230230
- name: Upload
231-
uses: actions/upload-artifact@v4
231+
uses: actions/upload-artifact@v2
232232
with:
233233
name: static-web-apps-cli
234234
path: "*.tgz"

docs/www/docs/cli/swa.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This is the commandline utility for streamlining local development for Azure Sta
1919
- start emulator or bind to dev server
2020
- deploy project to Azure Static Web Apps
2121

22-
If you don't enter any command and run `swa`, it will act as a macro command shortcut for `swa init`, `swa build`, `swa login` and `swa deploy`. The `swa init` command will only be executed if the `swa-cli.config.json` does not exist in the current folder.
22+
If you don't enter any command and run `swa`, it will act as a macro command shorcut for `swa init`, `swa build`, `swa login` and `swa deploy`. The `swa init` command will only be executed if the `swa-cli.config.json` does not exist in the current folder.
2323

2424
The best way to get started is to use the `swa` command and follow the interactive prompts.
2525

package-lock.json

Lines changed: 10 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure/static-web-apps-cli",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Azure Static Web Apps CLI",
55
"type": "module",
66
"scripts": {
@@ -49,7 +49,6 @@
4949
"internal-ip": "^6.2.0",
5050
"json-schema-library": "^9.3.5",
5151
"json-source-map": "^0.6.1",
52-
"jwt-decode": "^4.0.0",
5352
"keytar": "^7.9.0",
5453
"node-fetch": "^2.7.0",
5554
"open": "^8.4.2",

src/core/constants.ts

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const __dirname = path.dirname(__filename);
1111
export const DEPLOY_BINARY_NAME = "StaticSitesClient";
1212
export const DEPLOY_BINARY_STABLE_TAG = "stable";
1313
export const DEPLOY_FOLDER = path.join(os.homedir(), ".swa", "deploy");
14-
export const STATIC_SITE_CLIENT_RELEASE_METADATA_URL = "https://swalocaldeploy.azureedge.net/downloads/versions.json";
14+
export const STATIC_SITE_CLIENT_RELEASE_METADATA_URL = "https://aka.ms/swalocaldeploy";
1515

1616
// Data-api-builder related constants
1717
export const DATA_API_BUILDER_BINARY_NAME = "DataApiBuilder";
@@ -49,68 +49,6 @@ export const SWA_AUTH_CONTEXT_COOKIE = `StaticWebAppsAuthContextCookie`;
4949
export const SWA_AUTH_COOKIE = `StaticWebAppsAuthCookie`;
5050
export const ALLOWED_HTTP_METHODS_FOR_STATIC_CONTENT = ["GET", "HEAD", "OPTIONS"];
5151

52-
// Custom Auth constants
53-
export const SUPPORTED_CUSTOM_AUTH_PROVIDERS = ["google", "github", "aad", "facebook", "twitter", "dummy"];
54-
/*
55-
The full name is required in staticwebapp.config.json's schema that will be normalized to aad
56-
https://learn.microsoft.com/en-us/azure/static-web-apps/authentication-custom?tabs=aad%2Cinvitations
57-
*/
58-
export const ENTRAID_FULL_NAME = "azureActiveDirectory";
59-
export const CUSTOM_AUTH_TOKEN_ENDPOINT_MAPPING: AuthIdentityTokenEndpoints = {
60-
google: {
61-
host: "oauth2.googleapis.com",
62-
path: "/token",
63-
},
64-
github: {
65-
host: "github.com",
66-
path: "/login/oauth/access_token",
67-
},
68-
aad: {
69-
host: "login.microsoftonline.com",
70-
path: "/tenantId/oauth2/v2.0/token",
71-
},
72-
facebook: {
73-
host: "graph.facebook.com",
74-
path: "/v11.0/oauth/access_token",
75-
},
76-
twitter: {
77-
host: "api.twitter.com",
78-
path: "/2/oauth2/token",
79-
},
80-
};
81-
export const CUSTOM_AUTH_USER_ENDPOINT_MAPPING: AuthIdentityTokenEndpoints = {
82-
google: {
83-
host: "www.googleapis.com",
84-
path: "/oauth2/v2/userinfo",
85-
},
86-
github: {
87-
host: "api.github.com",
88-
path: "/user",
89-
},
90-
aad: {
91-
host: "graph.microsoft.com",
92-
path: "/oidc/userinfo",
93-
},
94-
twitter: {
95-
host: "api.twitter.com",
96-
path: "/2/users/me",
97-
},
98-
};
99-
export const CUSTOM_AUTH_ISS_MAPPING: AuthIdentityIssHosts = {
100-
google: "https://account.google.com",
101-
github: "",
102-
aad: "https://graph.microsoft.com",
103-
facebook: "https://www.facebook.com",
104-
twitter: "https://www.x.com",
105-
};
106-
export const CUSTOM_AUTH_REQUIRED_FIELDS: AuthIdentityRequiredFields = {
107-
google: ["clientIdSettingName", "clientSecretSettingName"],
108-
github: ["clientIdSettingName", "clientSecretSettingName"],
109-
aad: ["clientIdSettingName", "clientSecretSettingName", "openIdIssuer"],
110-
facebook: ["appIdSettingName", "appSecretSettingName"],
111-
twitter: ["consumerKeySettingName", "consumerSecretSettingName"],
112-
};
113-
11452
export const AUTH_STATUS = {
11553
NoAuth: 0,
11654
HostNameAuthLogin: 1,

src/msha/auth/index.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,27 @@ import type http from "node:http";
22
import { serializeCookie } from "../../core/utils/cookie.js";
33
import { logger } from "../../core/utils/logger.js";
44
import { response as newResponse } from "../../core/utils/net.js";
5-
import { SUPPORTED_CUSTOM_AUTH_PROVIDERS } from "../../core/constants.js";
65

76
function getAuthPaths(isCustomAuth: boolean): Path[] {
87
const paths: Path[] = [];
98

109
if (isCustomAuth) {
11-
const supportedAuthsRegex = SUPPORTED_CUSTOM_AUTH_PROVIDERS.join("|");
12-
1310
paths.push({
1411
method: "GET",
15-
// only match for providers with custom auth support implemented (github, google, aad, facebook, twitter)
16-
route: new RegExp(`^/\\.auth/login/(?<provider>${supportedAuthsRegex})/callback(\\?.*)?$`, "i"),
12+
// only match for providers with custom auth support implemented (github, google)
13+
route: /^\/\.auth\/login\/(?<provider>github|google|dummy)\/callback(\?.*)?$/i,
1714
function: "auth-login-provider-callback",
1815
});
1916
paths.push({
2017
method: "GET",
21-
// only match for providers with custom auth support implemented (github, google, aad, facebook, twitter)
22-
route: new RegExp(`^/\\.auth/login/(?<provider>${supportedAuthsRegex})(\\?.*)?$`, "i"),
18+
// only match for providers with custom auth support implemented (github, google)
19+
route: /^\/\.auth\/login\/(?<provider>github|google|dummy)(\?.*)?$/i,
2320
function: "auth-login-provider-custom",
2421
});
2522
paths.push({
2623
method: "GET",
2724
// For providers with custom auth support not implemented, revert to old behavior
28-
route: /^\/\.auth\/login\/(?<provider>twitter|[a-z]+)(\?.*)?$/i,
25+
route: /^\/\.auth\/login\/(?<provider>aad|twitter|facebook|[a-z]+)(\?.*)?$/i,
2926
function: "auth-login-provider",
3027
});
3128
paths.push({
@@ -36,7 +33,7 @@ function getAuthPaths(isCustomAuth: boolean): Path[] {
3633
} else {
3734
paths.push({
3835
method: "GET",
39-
route: /^\/\.auth\/login\/(?<provider>github|twitter|google|facebook|[a-z0-9]+)(\?.*)?$/i,
36+
route: /^\/\.auth\/login\/(?<provider>aad|github|twitter|google|facebook|[a-z]+)(\?.*)?$/i,
4037
function: "auth-login-provider",
4138
});
4239
}
@@ -54,7 +51,7 @@ function getAuthPaths(isCustomAuth: boolean): Path[] {
5451
},
5552
{
5653
method: "GET",
57-
route: /^\/\.auth\/purge\/(?<provider>aad|github|twitter|google|facebook|[a-z0-9]+)(\?.*)?$/i,
54+
route: /^\/\.auth\/purge\/(?<provider>aad|github|twitter|google|facebook|[a-z]+)(\?.*)?$/i,
5855
// locally, all purge requests are processed as logout requests
5956
function: "auth-logout",
6057
},

0 commit comments

Comments
 (0)