diff --git a/authn/github.index.js b/authn/github.index.js
index a155a00..809c1cb 100644
--- a/authn/github.index.js
+++ b/authn/github.index.js
@@ -64,6 +64,10 @@ function mainProcess(event, context, callback) {
"statusDescription": "Found",
"body": "ID token retrieved.",
"headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }],
"location" : [{
"key": "Location",
"value": event.Records[0].cf.config.hasOwnProperty('test') ? (config.AUTH_REQUEST.redirect_uri + queryDict.state) : queryDict.state
@@ -147,6 +151,10 @@ function redirect(request, headers, callback) {
statusDescription: "Found",
body: "Redirecting to OAuth2 provider",
headers: {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }],
"location" : [{
"key": "Location",
"value": config.AUTHORIZATION_ENDPOINT + '?' + querystring
@@ -166,10 +174,14 @@ function unauthorized(body, callback) {
"statusDescription": "Unauthorized",
"body": body,
"headers": {
- "set-cookie" : [{
- "key": "Set-Cookie",
- "value" : cookie.serialize('TOKEN', '', { path: '/', expires: new Date(1970, 1, 1, 0, 0, 0, 0) })
- }],
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }],
+ "set-cookie" : [{
+ "key": "Set-Cookie",
+ "value" : cookie.serialize('TOKEN', '', { path: '/', expires: new Date(1970, 1, 1, 0, 0, 0, 0) })
+ }],
},
};
callback(null, response);
@@ -180,6 +192,12 @@ function internalServerError(body, callback) {
"status": "500",
"statusDescription": "Internal Server Error",
"body": body,
+ "headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }]
+ }
};
callback(null, response);
}
diff --git a/authn/openid.index.js b/authn/openid.index.js
index 8a5d5a0..b1a23c4 100644
--- a/authn/openid.index.js
+++ b/authn/openid.index.js
@@ -161,6 +161,10 @@ function mainProcess(event, context, callback) {
"statusDescription": "Found",
"body": "ID token retrieved.",
"headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }],
"location" : [
{
"key": "Location",
@@ -221,6 +225,10 @@ function mainProcess(event, context, callback) {
"statusDescription": "Found",
"body": "Logged out. Redirecting to OIDC provider",
"headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }],
"location" : [{
"key": "Location",
"value": authproviderOrigin
@@ -295,6 +303,10 @@ function redirect(request, headers, callback) {
"statusDescription": "Found",
"body": "Redirecting to OIDC provider",
"headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }],
"location" : [{
"key": "Location",
"value": discoveryDocument.authorization_endpoint + '?' + querystring
@@ -323,21 +335,19 @@ function redirect(request, headers, callback) {
}
function unauthorized(error, error_description, error_uri, callback) {
- let page = `
-
-
-
-
-
- We've got some trouble | 401 - Unauthorized
-
-
-
- %error% Error 401
%error_description%
%error_uri%
-
-
-
- `;
+ let page = `
+
+
+
+
+ We've got some trouble | 401 - Unauthorized
+
+
+
+ %error% Error 401
%error_description%
%error_uri%
+
+
+`;
page = page.replace(/%error%/g, encodeURI(error).replace(/%20/g,' '));
page = page.replace(/%error_description%/g, encodeURI(error_description).replace(/%20/g,' '));
@@ -349,6 +359,10 @@ function unauthorized(error, error_description, error_uri, callback) {
"statusDescription": "Unauthorized",
"body": page,
"headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/html;charset=UTF-8"
+ }],
"set-cookie" : [
{
"key": "Set-Cookie",
@@ -371,26 +385,30 @@ function unauthorized(error, error_description, error_uri, callback) {
}
function internalServerError(callback) {
- let page = `
-
-
-
-
-
- We've got some trouble | 500 - Internal Server Error
-
-
-
- Internal Server Error Error 500
-
-
-
- `;
+ let page = `
+
+
+
+
+ We've got some trouble | 500 - Internal Server Error
+
+
+
+ Internal Server Error Error 500
+
+
+`;
const response = {
"status": "500",
"statusDescription": "Internal Server Error",
"body": page,
+ "headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }]
+ }
};
callback(null, response);
}
diff --git a/authn/pkce.index.js b/authn/pkce.index.js
index 241827b..9bc001b 100755
--- a/authn/pkce.index.js
+++ b/authn/pkce.index.js
@@ -224,6 +224,10 @@ function mainProcess(event, context, callback) {
"statusDescription": "Found",
"body": "Logged out. Redirecting to OIDC provider",
"headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }],
"location" : [{
"key": "Location",
"value": authproviderOrigin
@@ -313,6 +317,10 @@ function redirect(request, headers, callback) {
"statusDescription": "Found",
"body": "Redirecting to OIDC provider",
"headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/plain;charset=UTF-8"
+ }],
"location" : [{
"key": "Location",
"value": discoveryDocument.authorization_endpoint + '?' + querystring
@@ -351,21 +359,19 @@ function redirect(request, headers, callback) {
function unauthorized(error, error_description, error_uri, callback) {
- let page = `
-
-
-
-
-
- We've got some trouble | 401 - Unauthorized
-
-
-
- %error% Error 401
%error_description%
%error_uri%
-
-
-
- `;
+ let page = `
+
+
+
+
+ We've got some trouble | 401 - Unauthorized
+
+
+
+ %error% Error 401
%error_description%
%error_uri%
+
+
+`;
page = page.replace(/%error%/g, error);
page = page.replace(/%error_description%/g, error_description);
@@ -377,6 +383,10 @@ function unauthorized(error, error_description, error_uri, callback) {
"statusDescription": "Unauthorized",
"body": page,
"headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/html;charset=UTF-8"
+ }],
"set-cookie" : [
{
"key": "Set-Cookie",
@@ -399,26 +409,30 @@ function unauthorized(error, error_description, error_uri, callback) {
}
function internalServerError(callback) {
- let page = `
-
-
-
-
-
- We've got some trouble | 500 - Internal Server Error
-
-
-
- Internal Server Error Error 500
-
-
-
- `;
+ let page = `
+
+
+
+
+ We've got some trouble | 500 - Internal Server Error
+
+
+
+ Internal Server Error Error 500
+
+
+`;
const response = {
"status": "500",
"statusDescription": "Internal Server Error",
"body": page,
+ "headers": {
+ "content-type": [{
+ "key": "Content-Type",
+ "value": "text/html;charset=UTF-8"
+ }]
+ }
};
callback(null, response);
}