Skip to content

Commit

Permalink
fix: remove http schema and use localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
manekinekko committed Jun 30, 2020
1 parent a4b9f97 commit b0da97a
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 24 deletions.
7 changes: 3 additions & 4 deletions app_auth_complete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module.exports = async function (context, req) {
const { provider } = context.bindingData;
const { post_login_redirect_uri } = req.query;

const location = `//127.0.0.1:4200/profile`;
context.res = response({
context,
status: 302,
Expand All @@ -13,7 +12,7 @@ module.exports = async function (context, req) {
name: "StaticWebAppsAuthContextCookie",
value: "deleted",
path: "/",
domain: "127.0.0.1",
domain: "localhost",
expires: new Date(1970),
},
{
Expand All @@ -22,12 +21,12 @@ module.exports = async function (context, req) {
path: "/",
secure: false,
HttpOnly: false,
domain: "127.0.0.1",
domain: "localhost",
SameSite: "Strict",
},
],
headers: {
location,
location: `//localhost:4200/profile`,
},
});
};
4 changes: 2 additions & 2 deletions app_auth_login_provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = async function (context, req) {
const { provider } = context.bindingData;
const { post_login_redirect_uri } = req.query;

const location = `http://127.0.0.1:4242/.redirect/${provider}?hostName=localhost&staticWebAppsAuthNonce=${context.invocationId}`;
const location = `//localhost:4242/.redirect/${provider}?hostName=localhost&staticWebAppsAuthNonce=${context.invocationId}`;
context.res = response({
context,
status: 302,
Expand All @@ -15,7 +15,7 @@ module.exports = async function (context, req) {
path: "/",
secure: false,
HttpOnly: false,
domain: "127.0.0.1",
domain: "localhost",
SameSite: "None",
},
],
Expand Down
4 changes: 2 additions & 2 deletions app_auth_logout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ module.exports = async function (context, req) {
path: "/",
secure: false,
HttpOnly: false,
domain: "127.0.0.1",
domain: "localhost",
SameSite: "None",
},
],
headers: {
location: `http://127.0.0.1:4242/.redirect/logout?hostName=127.0.0.1`,
location: `//localhost:4242/.redirect/logout?hostName=localhost`,
},
});
};
8 changes: 4 additions & 4 deletions app_auth_logout_complete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = async function (context, req) {
path: "/",
secure: false,
HttpOnly: false,
domain: "127.0.0.1",
domain: "localhost",
expires: new Date(1970),
},
{
Expand All @@ -20,7 +20,7 @@ module.exports = async function (context, req) {
path: "/",
secure: false,
HttpOnly: false,
domain: "127.0.0.1",
domain: "localhost",
expires: new Date(1970),
},
{
Expand All @@ -29,12 +29,12 @@ module.exports = async function (context, req) {
path: "/",
secure: false,
HttpOnly: false,
domain: "127.0.0.1",
domain: "localhost",
expires: new Date(1970),
},
],
headers: {
location: `http://127.0.0.1:4200/`,
location: `//localhost:4200/`,
},
});
};
8 changes: 4 additions & 4 deletions identity_auth_login_done/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports = async function (context, req) {
existingroles: "",
},
nonce: context.invocationId,
iss: "https://127.0.0.1/",
aud: "https://127.0.0.1/",
iss: "https://localhost/",
aud: "https://localhost/",
};
const user_login_jwt = jwt.sign(payload, jwtKey, {
algorithm: "HS256",
Expand All @@ -31,7 +31,7 @@ module.exports = async function (context, req) {
name: "StaticWebAppsAuthContextCookie",
value: "deleted",
path: "/",
domain: "127.0.0.1",
domain: "localhost",
}
],
headers: {
Expand All @@ -40,7 +40,7 @@ module.exports = async function (context, req) {
},
body: `
<title>Working...</title>
<form id="f" method="POST" action="http://127.0.0.1:4242/app/.auth/complete">
<form id="f" method="POST" action="http://localhost:4242/app/.auth/complete">
<input type="hidden" name="user_login_jwt" value="${user_login_jwt}" />
<noscript>
<p>Script is disabled.Click Submit to continue.</p>
Expand Down
2 changes: 1 addition & 1 deletion identity_auth_login_provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = async function (context, req) {
const { provider } = context.bindingData;
const { post_login_redirect_uri } = req.query;

const redirect_uri = `http://127.0.0.1:4242/.auth/login/${provider}/callback&state=${encodeURIComponent(
const redirect_uri = `http://localhost:4242/.auth/login/${provider}/callback&state=${encodeURIComponent(
`redir=${post_login_redirect_uri}&nonce=${context.invocationId}`
)}`;

Expand Down
2 changes: 1 addition & 1 deletion identity_auth_login_provider_callback/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = async function (context, req) {
const token = await githubOauthResponse.json();
console.log(JSON.stringify(token));

const location = "http://127.0.0.1:4242/.auth/login/done";
const location = "//localhost:4242/.auth/login/done";
context.res = response({
context,
status: 302,
Expand Down
2 changes: 1 addition & 1 deletion identity_auth_logout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = async function (context, req) {
},
],
headers: {
location: `http://127.0.0.1:4242/.auth/logout/complete`,
location: `http://localhost:4242/.auth/logout/complete`,
},
});
};
4 changes: 2 additions & 2 deletions identity_auth_logout_complete/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { response } = require("../utils");

module.exports = async function (context, req) {
const location = `http://127.0.0.1:4242/app/.auth/logout/complete`;
const location = `//localhost:4242/app/.auth/logout/complete`;

context.res = response({
context,
Expand All @@ -13,7 +13,7 @@ module.exports = async function (context, req) {
path: "/",
secure: false,
HttpOnly: false,
domain: "127.0.0.1",
domain: "localhost",
expires: new Date(1970),
},
],
Expand Down
4 changes: 2 additions & 2 deletions identity_redirect_logout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { response } = require("../utils");
module.exports = async function (context, req) {
const { hostName, post_logout_redirect_uri = "/" } = req.query;

const location = `http://127.0.0.1:4242/.auth/logout?post_login_redirect_uri=${post_logout_redirect_uri}`;
const location = `//localhost:4242/.auth/logout?post_login_redirect_uri=${post_logout_redirect_uri}`;

context.res = response({
context,
Expand All @@ -15,7 +15,7 @@ module.exports = async function (context, req) {
path: "/",
secure: false,
HttpOnly: false,
domain: "127.0.0.1",
domain: "localhost",
SameSite: "None",
},
],
Expand Down
2 changes: 1 addition & 1 deletion identity_redirect_provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = async function (context, req) {
const { provider } = context.bindingData;
const { hostName, post_login_redirect_uri = "/.auth/login/done" } = req.query;

const location = `http://127.0.0.1:4242/.auth/login/${provider}?post_login_redirect_uri=${post_login_redirect_uri}`;
const location = `//localhost:4242/.auth/login/${provider}?post_login_redirect_uri=${post_login_redirect_uri}`;

context.res = response({
context,
Expand Down

0 comments on commit b0da97a

Please sign in to comment.