{"id":41308387,"url":"https://github.com/capralifecycle/cdk-cloudfront-auth","last_synced_at":"2026-05-06T04:01:54.787Z","repository":{"id":302281258,"uuid":"1009661879","full_name":"capralifecycle/cdk-cloudfront-auth","owner":"capralifecycle","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-19T11:41:52.000Z","size":9096,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-19T13:27:32.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capralifecycle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-27T13:54:04.000Z","updated_at":"2026-04-18T10:55:26.000Z","dependencies_parsed_at":"2026-02-13T06:02:22.455Z","dependency_job_id":null,"html_url":"https://github.com/capralifecycle/cdk-cloudfront-auth","commit_stats":null,"previous_names":["capralifecycle/cdk-cloudfront-auth"],"tags_count":281,"template":false,"template_full_name":null,"purl":"pkg:github/capralifecycle/cdk-cloudfront-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fcdk-cloudfront-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fcdk-cloudfront-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fcdk-cloudfront-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fcdk-cloudfront-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capralifecycle","download_url":"https://codeload.github.com/capralifecycle/cdk-cloudfront-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fcdk-cloudfront-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32166661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T02:19:40.750Z","status":"ssl_error","status_checked_at":"2026-04-23T02:17:55.737Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T05:11:05.636Z","updated_at":"2026-04-23T05:04:29.076Z","avatar_url":"https://github.com/capralifecycle.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CloudFront authorization with Cognito for CDK\n\nEasily add Cognito-based authorization to your CloudFront distribution,\nto place static files behind authorization.\n\nThis is based on https://github.com/aws-samples/cloudfront-authorization-at-edge.\n\n## Usage\n\n```bash\nbun add @liflig/cdk-cloudfront-auth\n```\n\nDeploy the Lambda@Edge functions to us-east-1:\n\n```ts\n// In a stack deployed to us-east-1.\nconst authLambdas = new AuthLambdas(this, \"AuthLambdas\", {\n  regions: [\"eu-west-1\"], // Regions to make Lambda version params available.\n})\n```\n\nDeploy the Cognito and CloudFront setup in whatever region\nof your choice:\n\n```ts\nconst auth = new CloudFrontAuth(this, \"Auth\", {\n  cognitoAuthDomain: `${domain.domainName}.auth.${region}.amazoncognito.com`,\n  authLambdas, // AuthLambdas from above\n  userPool, // Cognito User Pool\n})\nconst distribution = new cloudfront.Distribution(this, \"Distribution\", {\n  defaultBehavior: auth.createProtectedBehavior(origin),\n  additionalBehaviors: auth.createAuthPagesBehaviors(origin),\n})\nauth.updateClient(\"ClientUpdate\", {\n  signOutUrl: `https://${distribution.distributionDomainName}${auth.signOutRedirectTo}`,\n  callbackUrl: `https://${distribution.distributionDomainName}${auth.callbackPath}`,\n})\n```\n\nIf using `CloudFrontWebDistribution` instead of `Distribution`:\n\n```ts\nconst distribution = new cloudfront.CloudFrontWebDistribution(this, \"Distribution\", {\n  originConfigs: [\n    {\n      behaviors: [\n        ...auth.authPages,\n        {\n          isDefaultBehavior: true,\n          lambdaFunctionAssociations: auth.authFilters,\n        },\n      ],\n    },\n  ],\n})\n```\n\n## Customizing authorization\n\nThe `CloudFrontAuth` construct accepts a `requireGroupAnyOf` property\nthat causes access to be restricted to only users in specific groups.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapralifecycle%2Fcdk-cloudfront-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapralifecycle%2Fcdk-cloudfront-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapralifecycle%2Fcdk-cloudfront-auth/lists"}