-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4a6431
commit a4b9f97
Showing
14 changed files
with
262 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": "app/.auth/logout" | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { response, validateCookie } = require("../utils"); | ||
|
||
module.exports = async function (context, req) { | ||
const cookie = req.headers.cookie; | ||
const { post_logout_redirect_uri } = req.query; | ||
|
||
if (!cookie || !validateCookie(cookie)) { | ||
return response({ | ||
context, | ||
status: 401, | ||
}); | ||
} | ||
|
||
context.res = response({ | ||
context, | ||
status: 302, | ||
cookies: [ | ||
{ | ||
name: "StaticWebAppsAuthContextCookie", | ||
value: process.env.StaticWebAppsAuthContextCookie, | ||
path: "/", | ||
secure: false, | ||
HttpOnly: false, | ||
domain: "127.0.0.1", | ||
SameSite: "None", | ||
}, | ||
], | ||
headers: { | ||
location: `http://127.0.0.1:4242/.redirect/logout?hostName=127.0.0.1`, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": "app/.auth/logout/complete" | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const { response } = require("../utils"); | ||
|
||
module.exports = async function (context, req) { | ||
context.res = response({ | ||
context, | ||
status: 302, | ||
cookies: [ | ||
{ | ||
name: "StaticWebAppsAuthCookie", | ||
value: "deleted", | ||
path: "/", | ||
secure: false, | ||
HttpOnly: false, | ||
domain: "127.0.0.1", | ||
expires: new Date(1970), | ||
}, | ||
{ | ||
name: "StaticSitesAuthCookie", | ||
value: "deleted", | ||
path: "/", | ||
secure: false, | ||
HttpOnly: false, | ||
domain: "127.0.0.1", | ||
expires: new Date(1970), | ||
}, | ||
{ | ||
name: "StaticWebAppsAuthContextCookie", | ||
value: "deleted", | ||
path: "/", | ||
secure: false, | ||
HttpOnly: false, | ||
domain: "127.0.0.1", | ||
expires: new Date(1970), | ||
}, | ||
], | ||
headers: { | ||
location: `http://127.0.0.1:4200/`, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "$return" | ||
"name": "res" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": ".auth/logout" | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { response } = require("../utils"); | ||
|
||
module.exports = async function (context, req) { | ||
context.res = response({ | ||
context, | ||
status: 302, | ||
cookies: [ | ||
{ | ||
name: "AppServiceAuthSession", | ||
value: "deleted", | ||
path: "/", | ||
secure: false, | ||
HttpOnly: false, | ||
expires: new Date(1970), | ||
}, | ||
], | ||
headers: { | ||
location: `http://127.0.0.1:4242/.auth/logout/complete`, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": ".auth/logout/complete" | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { response } = require("../utils"); | ||
|
||
module.exports = async function (context, req) { | ||
const location = `http://127.0.0.1:4242/app/.auth/logout/complete`; | ||
|
||
context.res = response({ | ||
context, | ||
status: 302, | ||
cookies: [ | ||
{ | ||
name: "StaticWebAppsAuthContextCookie", | ||
value: "deleted", | ||
path: "/", | ||
secure: false, | ||
HttpOnly: false, | ||
domain: "127.0.0.1", | ||
expires: new Date(1970), | ||
}, | ||
], | ||
headers: { | ||
location, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"methods": [ | ||
"get" | ||
], | ||
"route": ".redirect/logout" | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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}`; | ||
|
||
context.res = response({ | ||
context, | ||
status: 302, | ||
cookies: [ | ||
{ | ||
name: "StaticWebAppsAuthContextCookie", | ||
value: process.env.StaticWebAppsAuthContextCookie, | ||
path: "/", | ||
secure: false, | ||
HttpOnly: false, | ||
domain: "127.0.0.1", | ||
SameSite: "None", | ||
}, | ||
], | ||
headers: { | ||
location, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters