Skip to content

Commit

Permalink
NOBUG: Disable authorizer
Browse files Browse the repository at this point in the history
  • Loading branch information
marklise committed Oct 16, 2024
1 parent 55ce72d commit faf6591
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions handlers/authorizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const verifier = CognitoJwtVerifier.create({
exports.handler = async function (event, context, callback) {
logger.debug('event', JSON.stringify(event));

return await authorizeAll(event);

try {
const headers = event?.headers;
const authorization = event?.headers?.Authorization;
Expand Down Expand Up @@ -51,6 +53,16 @@ exports.handler = async function (event, context, callback) {
return getDenyPolicy(event.methodArn);
};

async function authorizeAll(event) {
const arnPrefix = event.methodArn.split(':').slice(0, 6);
const joinedArnPrefix = arnPrefix.slice(0, 5).join(':');
const apiIDString = arnPrefix[5];
const apiString = apiIDString.split('/')[0];
const fullAPIMethods = joinedArnPrefix + ':' + apiString + '/' + process.env.STAGE_NAME + '/*';
console.log("fullAPIMethods:", fullAPIMethods);
return generatePolicy('pub', 'Allow', fullAPIMethods);
}

async function getUserData(sub) {
const dynamodb = new DynamoDBClient();
const params = {
Expand Down

0 comments on commit faf6591

Please sign in to comment.