39 |
40 |
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## UPDATE 2023, July 10th
2 |
3 | We have published a new Passwordless sample solution that includes WebAuthn (FIDO2, Passkeys) and e-mail Magic Links: https://github.com/aws-samples/amazon-cognito-passwordless-auth
4 |
5 | The repository here, the one you're looking at now, is still a good reference for implementing e-mail OTP (One Time Password). **_Be aware though_**: we haven't updated this repository in a while, so e.g. dependencies are outdated! Only use the repository here to get an idea on "how to do it".
6 |
7 | ---
8 |
9 | ## Amazon Cognito Passwordless Email Auth
10 |
11 | This is the _**sample**_ code that comes together with [the blog post on passwordless e-mail auth in Amazon Cognito](https://aws.amazon.com/blogs/mobile/implementing-passwordless-email-authentication-with-amazon-cognito/).
12 |
13 | The purpose of this sample code is to demonstrate how Amazon Cognito Custom Authentication Flows can be used to implement passwordless e-mail auth. Please treat the code as an _**illustration**_––thoroughly review it and adapt it to your needs, if you want to use it for serious things.
14 |
15 | The sample code is contained in these folders. Please visit these and run the sample solution:
16 |
17 | - [./cognito](./cognito): a Serverless Application that includes a Cognito user pool with the necessary setup
18 | - [./client](./client): a Web Client that authenticates with the Cognito user pool
19 |
20 | ## License Summary
21 |
22 | This sample code is made available under a modified MIT license. See the LICENSE file.
23 |
--------------------------------------------------------------------------------
/client/src/app/sign-up/sign-up.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | // SPDX-License-Identifier: MIT-0
3 |
4 | import { Component, ChangeDetectionStrategy } from '@angular/core';
5 | import { FormControl } from '@angular/forms';
6 | import { Router } from '@angular/router';
7 | import { AuthService } from '../auth.service';
8 | import { BehaviorSubject } from 'rxjs';
9 |
10 | @Component({
11 | selector: 'app-sign-up',
12 | templateUrl: './sign-up.component.html',
13 | styleUrls: ['./sign-up.component.css'],
14 | changeDetection: ChangeDetectionStrategy.OnPush,
15 | })
16 | export class SignUpComponent {
17 |
18 | email = new FormControl('');
19 | fullName = new FormControl('');
20 |
21 | private busy_ = new BehaviorSubject(false);
22 | public busy = this.busy_.asObservable();
23 |
24 | private errorMessage_ = new BehaviorSubject('');
25 | public errorMessage = this.errorMessage_.asObservable();
26 |
27 | constructor(private router: Router, private auth: AuthService) { }
28 |
29 | public async signup() {
30 | this.errorMessage_.next('');
31 | this.busy_.next(true);
32 | try {
33 | await this.auth.signUp(this.email.value, this.fullName.value);
34 | await this.auth.signIn(this.email.value);
35 | this.router.navigate(['/enter-secret-code']);
36 | } catch (err) {
37 | console.log(err);
38 | this.errorMessage_.next(err.message || err);
39 | } finally {
40 | this.busy_.next(false);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/client/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | // SPDX-License-Identifier: MIT-0
3 |
4 | import { NgModule } from '@angular/core';
5 | import { Routes, RouterModule } from '@angular/router';
6 |
7 | import { SignInComponent } from './sign-in/sign-in.component';
8 | import { SignOutComponent } from './sign-out/sign-out.component';
9 | import { SignUpComponent } from './sign-up/sign-up.component';
10 | import { PrivateComponent } from './private/private.component';
11 | import { AnswerChallengeComponent } from './answer-challenge/answer-challenge.component';
12 | import { NotFoundComponent } from './not-found/not-found.component';
13 |
14 | import { IsAuthenticated, IsNotAuthenticated } from './auth.guard';
15 |
16 | const routes: Routes = [
17 | { path: 'sign-in', component: SignInComponent, canActivate: [IsNotAuthenticated] },
18 | { path: 'sign-up', component: SignUpComponent, canActivate: [IsNotAuthenticated] },
19 | { path: 'enter-secret-code', component: AnswerChallengeComponent, canActivate: [IsNotAuthenticated] },
20 | { path: 'sign-out', component: SignOutComponent, canActivate: [IsAuthenticated] },
21 | { path: 'private', component: PrivateComponent, canActivate: [IsAuthenticated] },
22 | { path: '', redirectTo: '/private', pathMatch: 'full' },
23 | { path: '**', component: NotFoundComponent },
24 | ];
25 |
26 | @NgModule({
27 | imports: [RouterModule.forRoot(routes, { scrollPositionRestoration: 'enabled' })],
28 | exports: [RouterModule]
29 | })
30 | export class AppRoutingModule { }
31 |
--------------------------------------------------------------------------------
/client/README.md:
--------------------------------------------------------------------------------
1 | # Cognito E-Mail Auth Client
2 |
3 | This is a client web app that provides custom sign-in and sign-up pages to authenticate against Amazon Cognito using passwordless e-mail auth.
4 |
5 | This web app is written in Angular 9 but the integration with Amazon Cognito should be mostly identical in other frameworks (React, Vue, Plain HTML+JS). Check out this file: `src/app/auth.service.ts` (and disregard the little Angular Boilerplate)
6 |
7 | The Amazon Cognito User Pool back end that implements the passwordless e-mail auth can be found here: [../cognito](../cognito)
8 |
9 | # How to run this web app
10 |
11 | ### Pre-requisites
12 |
13 | 1. Download and install [Node.js](https://nodejs.org/en/download/)
14 | 2. Set up a Cognito User Pool that implements passwordless e-mail auth: [../cognito](../cognito)
15 |
16 | ### Run the web app
17 |
18 | 1. Clone this repo `git clone https://github.com/aws-samples/amazon-cognito-passwordless-email-auth.git`
19 | 2. Enter client directory: `cd amazon-cognito-passwordless-email-auth/client`
20 | 3. Install dependencies: `npm install`
21 | 4. Enter your AWS region, Cognito User Pool ID and your Web App Client ID in this file: `src/environments/environment.ts`. You can get this information from the CloudFormation stack outputs of the Cognito user pool back end (per pre-requisite 2)
22 | 5. Run the web app: `npm run start`
23 |
24 | If you've done all this, the web app should be running at http://localhost:4200
25 |
26 | ## License Summary
27 |
28 | This sample code is made available under a modified MIT license. See the LICENSE file.
29 |
--------------------------------------------------------------------------------
/client/src/app/sign-up/sign-up.component.html:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 | lock
10 | Please Sign Up
11 | We'd be happy to have you on board!
12 |
13 |
14 |
15 |
24 |
25 |
26 |
27 |
28 |
34 |
35 |
36 |
37 |
50 |
51 |
--------------------------------------------------------------------------------
/cognito/lambda-triggers/create-auth-challenge/create-auth-challenge.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | // SPDX-License-Identifier: MIT-0
3 |
4 | import { CreateAuthChallengeTriggerHandler } from 'aws-lambda';
5 | import { randomDigits } from 'crypto-secure-random-digit';
6 | import { SES } from 'aws-sdk';
7 |
8 | const ses = new SES();
9 |
10 | export const handler: CreateAuthChallengeTriggerHandler = async event => {
11 |
12 | let secretLoginCode: string;
13 | if (!event.request.session || !event.request.session.length) {
14 |
15 | // This is a new auth session
16 | // Generate a new secret login code and mail it to the user
17 | secretLoginCode = randomDigits(6).join('');
18 | await sendEmail(event.request.userAttributes.email, secretLoginCode);
19 |
20 | } else {
21 |
22 | // There's an existing session. Don't generate new digits but
23 | // re-use the code from the current session. This allows the user to
24 | // make a mistake when keying in the code and to then retry, rather
25 | // then needing to e-mail the user an all new code again.
26 | const previousChallenge = event.request.session.slice(-1)[0];
27 | secretLoginCode = previousChallenge.challengeMetadata!.match(/CODE-(\d*)/)![1];
28 | }
29 |
30 | // This is sent back to the client app
31 | event.response.publicChallengeParameters = { email: event.request.userAttributes.email };
32 |
33 | // Add the secret login code to the private challenge parameters
34 | // so it can be verified by the "Verify Auth Challenge Response" trigger
35 | event.response.privateChallengeParameters = { secretLoginCode };
36 |
37 | // Add the secret login code to the session so it is available
38 | // in a next invocation of the "Create Auth Challenge" trigger
39 | event.response.challengeMetadata = `CODE-${secretLoginCode}`;
40 |
41 | return event;
42 | };
43 |
44 | async function sendEmail(emailAddress: string, secretLoginCode: string) {
45 | const params: SES.SendEmailRequest = {
46 | Destination: { ToAddresses: [emailAddress] },
47 | Message: {
48 | Body: {
49 | Html: {
50 | Charset: 'UTF-8',
51 | Data: `
This is your secret login code:
52 |
${secretLoginCode}
`
53 | },
54 | Text: {
55 | Charset: 'UTF-8',
56 | Data: `Your secret login code: ${secretLoginCode}`
57 | }
58 | },
59 | Subject: {
60 | Charset: 'UTF-8',
61 | Data: 'Your secret login code'
62 | }
63 | },
64 | Source: process.env.SES_FROM_ADDRESS!
65 | };
66 | await ses.sendEmail(params).promise();
67 | }
68 |
--------------------------------------------------------------------------------
/cognito/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/osx,node,linux,windows
2 |
3 | ### Linux ###
4 | *~
5 |
6 | # temporary files which can be created if a process still has a handle open of a deleted file
7 | .fuse_hidden*
8 |
9 | # KDE directory preferences
10 | .directory
11 |
12 | # Linux trash folder which might appear on any partition or disk
13 | .Trash-*
14 |
15 | # .nfs files are created when an open file is removed but is still being accessed
16 | .nfs*
17 |
18 | ### Node ###
19 | # Logs
20 | logs
21 | *.log
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
26 | # Runtime data
27 | pids
28 | *.pid
29 | *.seed
30 | *.pid.lock
31 |
32 | # Directory for instrumented libs generated by jscoverage/JSCover
33 | lib-cov
34 |
35 | # Coverage directory used by tools like istanbul
36 | coverage
37 |
38 | # nyc test coverage
39 | .nyc_output
40 |
41 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
42 | .grunt
43 |
44 | # Bower dependency directory (https://bower.io/)
45 | bower_components
46 |
47 | # node-waf configuration
48 | .lock-wscript
49 |
50 | # Compiled binary addons (http://nodejs.org/api/addons.html)
51 | build/Release
52 |
53 | # Dependency directories
54 | node_modules/
55 | jspm_packages/
56 |
57 | # Typescript v1 declaration files
58 | typings/
59 |
60 | # Optional npm cache directory
61 | .npm
62 |
63 | # Optional eslint cache
64 | .eslintcache
65 |
66 | # Optional REPL history
67 | .node_repl_history
68 |
69 | # Output of 'npm pack'
70 | *.tgz
71 |
72 | # Yarn Integrity file
73 | .yarn-integrity
74 |
75 | # dotenv environment variables file
76 | .env
77 |
78 |
79 | ### OSX ###
80 | *.DS_Store
81 | .AppleDouble
82 | .LSOverride
83 |
84 | # Icon must end with two \r
85 | Icon
86 |
87 | # Thumbnails
88 | ._*
89 |
90 | # Files that might appear in the root of a volume
91 | .DocumentRevisions-V100
92 | .fseventsd
93 | .Spotlight-V100
94 | .TemporaryItems
95 | .Trashes
96 | .VolumeIcon.icns
97 | .com.apple.timemachine.donotpresent
98 |
99 | # Directories potentially created on remote AFP share
100 | .AppleDB
101 | .AppleDesktop
102 | Network Trash Folder
103 | Temporary Items
104 | .apdisk
105 |
106 | ### Windows ###
107 | # Windows thumbnail cache files
108 | Thumbs.db
109 | ehthumbs.db
110 | ehthumbs_vista.db
111 |
112 | # Folder config file
113 | Desktop.ini
114 |
115 | # Recycle Bin used on file shares
116 | $RECYCLE.BIN/
117 |
118 | # Windows Installer files
119 | *.cab
120 | *.msi
121 | *.msm
122 | *.msp
123 |
124 | # Windows shortcuts
125 | *.lnk
126 |
127 |
128 | # End of https://www.gitignore.io/api/osx,node,linux,windows
129 |
130 | # Ignore the generated cloudformation template
131 | packaged.yaml
132 |
133 | # Ignore js as we'll be doing typescript
134 | *.js
135 |
136 | # Ignore local file for setting environment variables
137 | setenvs.sh
138 |
--------------------------------------------------------------------------------
/client/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "codelyzer"
4 | ],
5 | "rules": {
6 | "arrow-return-shorthand": true,
7 | "callable-types": true,
8 | "class-name": true,
9 | "comment-format": [
10 | true,
11 | "check-space"
12 | ],
13 | "curly": true,
14 | "deprecation": {
15 | "severity": "warn"
16 | },
17 | "eofline": true,
18 | "forin": true,
19 | "import-blacklist": [
20 | true,
21 | "rxjs/Rx"
22 | ],
23 | "import-spacing": true,
24 | "indent": [
25 | true,
26 | "spaces"
27 | ],
28 | "interface-over-type-literal": true,
29 | "label-position": true,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-arg": true,
47 | "no-bitwise": true,
48 | "no-console": [
49 | true,
50 | "debug",
51 | "info",
52 | "time",
53 | "timeEnd",
54 | "trace"
55 | ],
56 | "no-construct": true,
57 | "no-debugger": true,
58 | "no-duplicate-super": true,
59 | "no-empty": false,
60 | "no-empty-interface": true,
61 | "no-eval": true,
62 | "no-inferrable-types": [
63 | true,
64 | "ignore-params"
65 | ],
66 | "no-misused-new": true,
67 | "no-non-null-assertion": true,
68 | "no-redundant-jsdoc": true,
69 | "no-shadowed-variable": true,
70 | "no-string-literal": false,
71 | "no-string-throw": true,
72 | "no-switch-case-fall-through": true,
73 | "no-trailing-whitespace": true,
74 | "no-unnecessary-initializer": true,
75 | "no-unused-expression": true,
76 | "no-use-before-declare": true,
77 | "no-var-keyword": true,
78 | "object-literal-sort-keys": false,
79 | "one-line": [
80 | true,
81 | "check-open-brace",
82 | "check-catch",
83 | "check-else",
84 | "check-whitespace"
85 | ],
86 | "prefer-const": true,
87 | "quotemark": [
88 | true,
89 | "single"
90 | ],
91 | "radix": true,
92 | "semicolon": [
93 | true,
94 | "always"
95 | ],
96 | "triple-equals": [
97 | true,
98 | "allow-null-check"
99 | ],
100 | "typedef-whitespace": [
101 | true,
102 | {
103 | "call-signature": "nospace",
104 | "index-signature": "nospace",
105 | "parameter": "nospace",
106 | "property-declaration": "nospace",
107 | "variable-declaration": "nospace"
108 | }
109 | ],
110 | "unified-signatures": true,
111 | "variable-name": false,
112 | "whitespace": [
113 | true,
114 | "check-branch",
115 | "check-decl",
116 | "check-operator",
117 | "check-separator",
118 | "check-type"
119 | ],
120 | "no-output-on-prefix": true,
121 | "no-inputs-metadata-property": true,
122 | "no-outputs-metadata-property": true,
123 | "no-host-metadata-property": true,
124 | "no-input-rename": true,
125 | "no-output-rename": true,
126 | "use-lifecycle-interface": true,
127 | "use-pipe-transform-interface": true,
128 | "component-class-suffix": true,
129 | "directive-class-suffix": true
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/client/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "cognito-email-auth-client": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "app",
11 | "schematics": {},
12 | "architect": {
13 | "build": {
14 | "builder": "@angular-devkit/build-angular:browser",
15 | "options": {
16 | "aot": true,
17 | "outputPath": "dist/cognito-email-auth-client",
18 | "index": "src/index.html",
19 | "main": "src/main.ts",
20 | "polyfills": "src/polyfills.ts",
21 | "tsConfig": "src/tsconfig.app.json",
22 | "assets": [
23 | "src/favicon.ico",
24 | "src/assets"
25 | ],
26 | "styles": [
27 | "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
28 | "src/styles.css"
29 | ],
30 | "scripts": []
31 | },
32 | "configurations": {
33 | "production": {
34 | "fileReplacements": [
35 | {
36 | "replace": "src/environments/environment.ts",
37 | "with": "src/environments/environment.prod.ts"
38 | }
39 | ],
40 | "optimization": true,
41 | "outputHashing": "all",
42 | "sourceMap": false,
43 | "extractCss": true,
44 | "namedChunks": false,
45 | "aot": true,
46 | "extractLicenses": true,
47 | "vendorChunk": false,
48 | "buildOptimizer": true,
49 | "budgets": [
50 | {
51 | "type": "initial",
52 | "maximumWarning": "2mb",
53 | "maximumError": "5mb"
54 | },
55 | {
56 | "type": "anyComponentStyle",
57 | "maximumWarning": "6kb"
58 | }
59 | ]
60 | },
61 | "local": {
62 | "budgets": [
63 | {
64 | "type": "anyComponentStyle",
65 | "maximumWarning": "6kb"
66 | }
67 | ],
68 | "fileReplacements": [
69 | {
70 | "replace": "src/environments/environment.ts",
71 | "with": "src/environments/environment.local.ts"
72 | }
73 | ]
74 | }
75 | }
76 | },
77 | "serve": {
78 | "builder": "@angular-devkit/build-angular:dev-server",
79 | "options": {
80 | "browserTarget": "cognito-email-auth-client:build"
81 | },
82 | "configurations": {
83 | "production": {
84 | "browserTarget": "cognito-email-auth-client:build:production"
85 | },
86 | "local": {
87 | "browserTarget": "cognito-email-auth-client:build:local"
88 | }
89 | }
90 | },
91 | "extract-i18n": {
92 | "builder": "@angular-devkit/build-angular:extract-i18n",
93 | "options": {
94 | "browserTarget": "cognito-email-auth-client:build"
95 | }
96 | }
97 | }
98 | }
99 | },
100 | "defaultProject": "cognito-email-auth-client"
101 | }
--------------------------------------------------------------------------------
/client/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | // SPDX-License-Identifier: MIT-0
3 |
4 | /**
5 | * This file includes polyfills needed by Angular and is loaded before the app.
6 | * You can add your own extra polyfills to this file.
7 | *
8 | * This file is divided into 2 sections:
9 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
10 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
11 | * file.
12 | *
13 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
14 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
15 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
16 | *
17 | * Learn more in https://angular.io/guide/browser-support
18 | */
19 |
20 | /***************************************************************************************************
21 | * BROWSER POLYFILLS
22 | */
23 |
24 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
25 | // import 'core-js/es6/symbol';
26 | // import 'core-js/es6/object';
27 | // import 'core-js/es6/function';
28 | // import 'core-js/es6/parse-int';
29 | // import 'core-js/es6/parse-float';
30 | // import 'core-js/es6/number';
31 | // import 'core-js/es6/math';
32 | // import 'core-js/es6/string';
33 | // import 'core-js/es6/date';
34 | // import 'core-js/es6/array';
35 | // import 'core-js/es6/regexp';
36 | // import 'core-js/es6/map';
37 | // import 'core-js/es6/weak-map';
38 | // import 'core-js/es6/set';
39 |
40 | /**
41 | * If the application will be indexed by Google Search, the following is required.
42 | * Googlebot uses a renderer based on Chrome 41.
43 | * https://developers.google.com/search/docs/guides/rendering
44 | **/
45 | // import 'core-js/es6/array';
46 |
47 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
48 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
49 |
50 | /** IE10 and IE11 requires the following for the Reflect API. */
51 | // import 'core-js/es6/reflect';
52 |
53 | /**
54 | * Web Animations `@angular/platform-browser/animations`
55 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
56 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
57 | **/
58 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
59 |
60 | /**
61 | * By default, zone.js will patch all possible macroTask and DomEvents
62 | * user can disable parts of macroTask/DomEvents patch by setting following flags
63 | */
64 |
65 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
66 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
67 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
68 |
69 | /*
70 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
71 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
72 | */
73 | // (window as any).__Zone_enable_cross_context_check = true;
74 |
75 | /***************************************************************************************************
76 | * Zone JS is required by default for Angular itself.
77 | */
78 | import 'zone.js/dist/zone'; // Included with Angular CLI.
79 |
80 |
81 | /***************************************************************************************************
82 | * APPLICATION IMPORTS
83 | */
84 |
85 | /* Fix for Cognito in Angular 6+ */
86 | (window as any).global = window;
87 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guidelines
2 |
3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
4 | documentation, we greatly value feedback and contributions from our community.
5 |
6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
7 | information to effectively respond to your bug report or contribution.
8 |
9 |
10 | ## Reporting Bugs/Feature Requests
11 |
12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features.
13 |
14 | When filing an issue, please check [existing open](https://github.com/aws-samples/amazon-cognito-passwordless-email-auth/issues), or [recently closed](https://github.com/aws-samples/amazon-cognito-passwordless-email-auth/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
16 |
17 | * A reproducible test case or series of steps
18 | * The version of our code being used
19 | * Any modifications you've made relevant to the bug
20 | * Anything unusual about your environment or deployment
21 |
22 |
23 | ## Contributing via Pull Requests
24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
25 |
26 | 1. You are working against the latest source on the *master* branch.
27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
29 |
30 | To send us a pull request, please:
31 |
32 | 1. Fork the repository.
33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
34 | 3. Ensure local tests pass.
35 | 4. Commit to your fork using clear commit messages.
36 | 5. Send us a pull request, answering any default questions in the pull request interface.
37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
38 |
39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
41 |
42 |
43 | ## Finding contributions to work on
44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws-samples/amazon-cognito-passwordless-email-auth/labels/help%20wanted) issues is a great place to start.
45 |
46 |
47 | ## Code of Conduct
48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
50 | opensource-codeofconduct@amazon.com with any additional questions or comments.
51 |
52 |
53 | ## Security issue notifications
54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
55 |
56 |
57 | ## Licensing
58 |
59 | See the [LICENSE](https://github.com/aws-samples/amazon-cognito-passwordless-email-auth/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
60 |
61 | We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
62 |
--------------------------------------------------------------------------------
/client/src/app/answer-challenge/answer-challenge.component.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | // SPDX-License-Identifier: MIT-0
3 |
4 | import { Component, OnInit, OnDestroy, AfterContentInit, ChangeDetectionStrategy, ViewChild, ElementRef } from '@angular/core';
5 | import { Router } from '@angular/router';
6 | import { FormControl } from '@angular/forms';
7 | import { AuthService } from '../auth.service';
8 | import { BehaviorSubject, Subscription } from 'rxjs';
9 | import { tap } from 'rxjs/operators';
10 |
11 | @Component({
12 | selector: 'app-answer-challenge',
13 | templateUrl: './answer-challenge.component.html',
14 | styleUrls: ['./answer-challenge.component.css'],
15 | changeDetection: ChangeDetectionStrategy.OnPush,
16 | })
17 | export class AnswerChallengeComponent implements OnInit, OnDestroy, AfterContentInit {
18 |
19 | digit1 = new FormControl('');
20 | digit2 = new FormControl('');
21 | digit3 = new FormControl('');
22 | digit4 = new FormControl('');
23 | digit5 = new FormControl('');
24 | digit6 = new FormControl('');
25 | @ViewChild('digit1el', { static: true }) digit1element: ElementRef;
26 | @ViewChild('digit2el', { static: true }) digit2element: ElementRef;
27 | @ViewChild('digit3el', { static: true }) digit3element: ElementRef;
28 | @ViewChild('digit4el', { static: true }) digit4element: ElementRef;
29 | @ViewChild('digit5el', { static: true }) digit5element: ElementRef;
30 | @ViewChild('digit6el', { static: true }) digit6element: ElementRef;
31 |
32 | private errorMessage_ = new BehaviorSubject('');
33 | public errorMessage = this.errorMessage_.asObservable();
34 |
35 | private busy_ = new BehaviorSubject(false);
36 | public busy = this.busy_.asObservable();
37 |
38 | private allSubscriptions = new Subscription();
39 |
40 | private email_ = new BehaviorSubject('');
41 | public email = this.email_.asObservable();
42 |
43 | constructor(private auth: AuthService, private router: Router) { }
44 |
45 | ngOnInit() {
46 |
47 | // Get e-mail address the code was sent to
48 | // It is a public challenge parameter so let's try it that way
49 | this.auth.getPublicChallengeParameters()
50 | .then(param => this.email_.next(param.email));
51 |
52 | // Move focus to next field upon entry of a digit
53 | [2, 3, 4, 5, 6].forEach(digit => {
54 | const prev = this[`digit${digit - 1}`] as FormControl;
55 | const next = this[`digit${digit}element`] as ElementRef;
56 | this.allSubscriptions.add(prev.valueChanges.pipe(
57 | tap(() => {
58 | if (prev.value) {
59 | next.nativeElement.focus();
60 | next.nativeElement.setSelectionRange(0, 1);
61 | }
62 | })
63 | ).subscribe());
64 | });
65 |
66 | // If the user copy pastes the code into the first digit field
67 | // we'll be so kind to cut it in 6 pieces and distribute it to the right fields
68 | this.allSubscriptions.add(
69 | this.digit1.valueChanges.pipe(
70 | tap(value => {
71 | if (value && value.length > 1) {
72 | const digits = value.split('').slice(0, 6);
73 | this.digit1.setValue(digits[0]);
74 | this.digit2.setValue(digits[1]);
75 | this.digit3.setValue(digits[2]);
76 | this.digit4.setValue(digits[3]);
77 | this.digit5.setValue(digits[4]);
78 | this.digit6.setValue(digits[5]);
79 | }
80 | })
81 | ).subscribe()
82 | );
83 | }
84 |
85 | ngOnDestroy() {
86 | this.allSubscriptions.unsubscribe();
87 | }
88 |
89 | ngAfterContentInit() {
90 | this.digit1element.nativeElement.focus();
91 | }
92 |
93 | public async submit() {
94 | try {
95 | this.errorMessage_.next('');
96 | this.busy_.next(true);
97 | const answer = [1, 2, 3, 4, 5, 6]
98 | .map(digit => (this[`digit${digit}`] as FormControl).value)
99 | .join('');
100 | const loginSucceeded = await this.auth.answerCustomChallenge(answer);
101 | if (loginSucceeded) {
102 | this.router.navigate(['/private']);
103 | } else {
104 | this.errorMessage_.next('That\'s not the right code');
105 | }
106 | } catch (err) {
107 | this.errorMessage_.next(err.message || err);
108 | } finally {
109 | this.busy_.next(false);
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/cognito/README.md:
--------------------------------------------------------------------------------
1 | # Cognito E-Mail Auth Backend
2 |
3 | This is an AWS Serverless Application. If you deploy it, this is what you get:
4 |
5 | - An Amazon Cognito User Pool, pre-configured with AWS Lambda triggers to implement passwordless e-mail auth
6 | - An Amazon Cognito User Pool Client, that you can use to integrate with the User Pool
7 | - The needed Lambda functions that serve as User Pool triggers
8 | - The permissions on the Lambda functions so that the User Pool may invoke them
9 |
10 | An example client web app that is ready to run against this Serverless Application can be found at [../client](../client)
11 |
12 | ## Deployment instructions
13 |
14 | Deploy either through the Serverless Application Repository or with the AWS SAM CLI
15 |
16 | ### Deployment trough Serverless Application Repository
17 |
18 | This is the easiest path. Find the Serverless Application in the [Repository](https://console.aws.amazon.com/serverlessrepo/) using tags "cognito" and "passwordless" or navigate to it directly with [this link](https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:520945424137:applications~amazon-cognito-passwordless-email-auth).
19 |
20 | If you deploy the Serverless Application you'll get a CloudFormation stack with the resources mentioned above. The outputs of the CloudFormation stack will contain the ID's of the user pool and client, that you can use in your client web app.
21 |
22 | #### Pre-requisite
23 |
24 | - You need to have a [verified e-mail address in Amazon SES](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses-procedure.html) to send the e-mails from. If your AWS account in still in the [SES sandbox](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html), you also need to verify the e-mail adresses you want to send mails to. Lastly, if you don't want your mails to end up in spam folders, [verify the domain](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-domain-procedure.html) you use to send mails from as well.
25 |
26 | ### Alternative Deployment with AWS SAM CLI
27 |
28 | #### Pre-requisites
29 |
30 | 1. Download and install [Node.js](https://nodejs.org/en/download/)
31 | 2. Download and install [AWS SAM CLI](https://github.com/awslabs/aws-sam-cli)
32 | 3. Of course you need an AWS account and necessary permissions to create resources in it. Make sure your AWS credentials can be found during deployment, e.g. by making your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY available as environment variables.
33 | 4. You need to have a [verified e-mail address in Amazon SES](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses-procedure.html) to send the e-mails from. If your AWS account in still in the [SES sandbox](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html), you also need to verify the e-mail adresses you want to send mails to. Lastly, if you don't want your mails to end up in spam folders, [verify the domain](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-domain-procedure.html) you use to send mails from as well.
34 | 5. You need an existing S3 bucket to use for the SAM deployment. Create an empty bucket.
35 |
36 | NOTE: To deploy this application _**please pick an AWS Region in which you can use Amazon Simple E-Mail Service (i.e. us-east-1, us-west-2 or eu-west-1)**_ and create all resources (including the S3 bucket) in that region. This is not a hard requirement for setting up e-mail auth in Cognito in general; but it is so in this demo application to keep things simple.
37 |
38 | #### How to deploy the Serverless Application with AWS SAM CLI
39 |
40 | 1. Clone this repo `git clone https://github.com/aws-samples/amazon-cognito-passwordless-email-auth.git`
41 | 2. Enter cognito directory: `cd amazon-cognito-passwordless-email-auth/cognito`
42 | 3. Install dependencies: `npm install`
43 | 4. Set the following environment variables (all mandatory):
44 | - S3_BUCKET_NAME='the bucket name of the bucket you want to use for your SAM deployment'
45 | - SES_FROM_ADDRESS='the verfied e-mail address in SES the e-mails will be sent from'
46 | - STACK_NAME='the name you want the CloudFormation stack to be created with'
47 | - USER_POOL_NAME='the name you want your User Pool to be created with'
48 | 5. Build and deploy the application: `npm run bd` This runs AWS SAM CLI
49 |
50 | if that succeeded, you have succesfully deployed your application. The outputs of the CloudFormation stack will contain the ID's of the User Pool and Client, that you can use in your client web app.
51 |
52 | ## License Summary
53 |
54 | This sample code is made available under a modified MIT license. See the LICENSE file.
55 |
--------------------------------------------------------------------------------
/cognito/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cognito-email-auth-backend",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "@types/aws-lambda": {
8 | "version": "8.10.71",
9 | "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.71.tgz",
10 | "integrity": "sha512-l0Lag6qq06AlKllprAJ3pbgVUbXCjRGRb7VpHow8IMn2BMHTPR0t5OD97/w8CR1+wA5XZuWQoXLjYvdlk2kQrQ=="
11 | },
12 | "@types/node": {
13 | "version": "14.14.22",
14 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.22.tgz",
15 | "integrity": "sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw=="
16 | },
17 | "aws-sdk": {
18 | "version": "2.834.0",
19 | "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.834.0.tgz",
20 | "integrity": "sha512-9WRULrn4qAmgXI+tEW/IG5s/6ixJGZqjPOrmJsFZQev7/WRkxAZmJAjcwd4Ifm/jsJbXx2FSwO76gOPEvu2LqA==",
21 | "requires": {
22 | "buffer": "4.9.2",
23 | "events": "1.1.1",
24 | "ieee754": "1.1.13",
25 | "jmespath": "0.15.0",
26 | "querystring": "0.2.0",
27 | "sax": "1.2.1",
28 | "url": "0.10.3",
29 | "uuid": "3.3.2",
30 | "xml2js": "0.4.19"
31 | }
32 | },
33 | "base64-js": {
34 | "version": "1.5.1",
35 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
36 | "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
37 | },
38 | "buffer": {
39 | "version": "4.9.2",
40 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
41 | "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
42 | "requires": {
43 | "base64-js": "^1.0.2",
44 | "ieee754": "^1.1.4",
45 | "isarray": "^1.0.0"
46 | }
47 | },
48 | "crypto-secure-random-digit": {
49 | "version": "1.0.9",
50 | "resolved": "https://registry.npmjs.org/crypto-secure-random-digit/-/crypto-secure-random-digit-1.0.9.tgz",
51 | "integrity": "sha512-0jKZnjMf5lWYUdtu611xEdRCqMBD4xils04cGU5+5+50NyJ+DC2soGaLCVPTYAssK80NkPYHF2tlHjegGKSbcQ=="
52 | },
53 | "events": {
54 | "version": "1.1.1",
55 | "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
56 | "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ="
57 | },
58 | "ieee754": {
59 | "version": "1.1.13",
60 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
61 | "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
62 | },
63 | "isarray": {
64 | "version": "1.0.0",
65 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
66 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
67 | },
68 | "jmespath": {
69 | "version": "0.15.0",
70 | "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz",
71 | "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc="
72 | },
73 | "punycode": {
74 | "version": "1.3.2",
75 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
76 | "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
77 | },
78 | "querystring": {
79 | "version": "0.2.0",
80 | "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
81 | "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
82 | },
83 | "sax": {
84 | "version": "1.2.1",
85 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
86 | "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o="
87 | },
88 | "typescript": {
89 | "version": "4.1.3",
90 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz",
91 | "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg=="
92 | },
93 | "url": {
94 | "version": "0.10.3",
95 | "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz",
96 | "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=",
97 | "requires": {
98 | "punycode": "1.3.2",
99 | "querystring": "0.2.0"
100 | }
101 | },
102 | "uuid": {
103 | "version": "3.3.2",
104 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
105 | "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
106 | },
107 | "xml2js": {
108 | "version": "0.4.19",
109 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
110 | "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
111 | "requires": {
112 | "sax": ">=0.6.0",
113 | "xmlbuilder": "~9.0.1"
114 | }
115 | },
116 | "xmlbuilder": {
117 | "version": "9.0.7",
118 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
119 | "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
120 | }
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/cognito/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Basic Options */
4 | "target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
5 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
6 | // "lib": [], /* Specify library files to be included in the compilation. */
7 | // "allowJs": true, /* Allow javascript files to be compiled. */
8 | // "checkJs": true, /* Report errors in .js files. */
9 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
10 | // "declaration": true, /* Generates corresponding '.d.ts' file. */
11 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
12 | // "sourceMap": true, /* Generates corresponding '.map' file. */
13 | // "outFile": "./", /* Concatenate and emit output to single file. */
14 | // "outDir": "./", /* Redirect output structure to the directory. */
15 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
16 | // "composite": true, /* Enable project compilation */
17 | // "removeComments": true, /* Do not emit comments to output. */
18 | // "noEmit": true, /* Do not emit outputs. */
19 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */
20 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
21 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
22 |
23 | /* Strict Type-Checking Options */
24 | "strict": true, /* Enable all strict type-checking options. */
25 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
26 | // "strictNullChecks": true, /* Enable strict null checks. */
27 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */
28 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
29 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
30 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
31 |
32 | /* Additional Checks */
33 | // "noUnusedLocals": true, /* Report errors on unused locals. */
34 | // "noUnusedParameters": true, /* Report errors on unused parameters. */
35 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
36 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
37 |
38 | /* Module Resolution Options */
39 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
40 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
41 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
42 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
43 | // "typeRoots": [], /* List of folders to include type definitions from. */
44 | // "types": [], /* Type declaration files to be included in compilation. */
45 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
46 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
47 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
48 |
49 | /* Source Map Options */
50 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
51 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
52 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
53 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
54 |
55 | /* Experimental Options */
56 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
57 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
58 | }
59 | }
--------------------------------------------------------------------------------
/cognito/template.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | # SPDX-License-Identifier: MIT-0
3 |
4 | AWSTemplateFormatVersion: "2010-09-09"
5 | Transform: AWS::Serverless-2016-10-31
6 | Description: >
7 | Amazon Cognito User Pool with Passwordless E-Mail Auth configured
8 |
9 | Metadata:
10 | AWS::ServerlessRepo::Application:
11 | Name: amazon-cognito-passwordless-email-auth
12 | Description: >
13 | An Amazon Cognito user pool, pre-configured with AWS Lambda triggers to implement passwordless e-mail auth
14 | Author: AWS Samples
15 | SpdxLicenseId: MIT-0
16 | LicenseUrl: LICENSE
17 | ReadmeUrl: README.md
18 | Labels: ["cognito", "passwordless", "authentication", "auth", "sample"]
19 | HomepageUrl: https://github.com/aws-samples/amazon-cognito-passwordless-email-auth/tree/master/cognito
20 | SemanticVersion: 1.0.3
21 | SourceCodeUrl: https://github.com/aws-samples/amazon-cognito-passwordless-email-auth/tree/master/cognito
22 |
23 | Globals:
24 | Function:
25 | Timeout: 3
26 |
27 | Parameters:
28 | UserPoolName:
29 | Type: String
30 | Description: The name you want the User Pool to be created with
31 | SESFromAddress:
32 | Type: String
33 | Description: The e-mail address to send the secret login code from
34 |
35 | Resources:
36 | DefineAuthChallenge:
37 | Type: AWS::Serverless::Function
38 | Properties:
39 | CodeUri: lambda-triggers/define-auth-challenge/
40 | Handler: define-auth-challenge.handler
41 | Runtime: nodejs12.x
42 |
43 | CreateAuthChallenge:
44 | Type: AWS::Serverless::Function
45 | Properties:
46 | CodeUri: lambda-triggers/create-auth-challenge/
47 | Handler: create-auth-challenge.handler
48 | Runtime: nodejs12.x
49 | Environment:
50 | Variables:
51 | SES_FROM_ADDRESS: !Ref SESFromAddress
52 | Policies:
53 | - Version: "2012-10-17"
54 | Statement:
55 | - Effect: Allow
56 | Action:
57 | - ses:SendEmail
58 | Resource: "*"
59 |
60 | VerifyAuthChallengeResponse:
61 | Type: AWS::Serverless::Function
62 | Properties:
63 | CodeUri: lambda-triggers/verify-auth-challenge-response/
64 | Handler: verify-auth-challenge-response.handler
65 | Runtime: nodejs12.x
66 |
67 | PreSignUp:
68 | Type: AWS::Serverless::Function
69 | Properties:
70 | CodeUri: lambda-triggers/pre-sign-up/
71 | Handler: pre-sign-up.handler
72 | Runtime: nodejs12.x
73 |
74 | PostAuthentication:
75 | Type: AWS::Serverless::Function
76 | Properties:
77 | CodeUri: lambda-triggers/post-authentication/
78 | Handler: post-authentication.handler
79 | Runtime: nodejs12.x
80 | Role: !GetAtt PostAuthenticationRole.Arn
81 |
82 | PostAuthenticationRole:
83 | Type: AWS::IAM::Role
84 | Properties:
85 | AssumeRolePolicyDocument:
86 | Version: "2012-10-17"
87 | Statement:
88 | - Effect: Allow
89 | Principal:
90 | Service:
91 | - lambda.amazonaws.com
92 | Action:
93 | - 'sts:AssumeRole'
94 | ManagedPolicyArns:
95 | - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
96 |
97 | SetUserAttributesPolicy:
98 | Type: AWS::IAM::Policy
99 | Properties:
100 | PolicyName: allow-set-user-attributes
101 | PolicyDocument:
102 | Version: "2012-10-17"
103 | Statement:
104 | - Effect: Allow
105 | Action:
106 | - cognito-idp:AdminUpdateUserAttributes
107 | Resource:
108 | - !GetAtt UserPool.Arn
109 | Roles:
110 | - !Ref PostAuthenticationRole
111 |
112 | UserPool:
113 | Type: "AWS::Cognito::UserPool"
114 | Properties:
115 | UserPoolName: !Ref UserPoolName
116 | Schema:
117 | - Name: name
118 | AttributeDataType: String
119 | Mutable: true
120 | Required: true
121 | - Name: email
122 | AttributeDataType: String
123 | Mutable: true
124 | Required: true
125 | Policies:
126 | PasswordPolicy:
127 | MinimumLength: 8
128 | RequireLowercase: false
129 | RequireNumbers: false
130 | RequireSymbols: false
131 | RequireUppercase: false
132 | UsernameAttributes:
133 | - email
134 | MfaConfiguration: "OFF"
135 | LambdaConfig:
136 | CreateAuthChallenge: !GetAtt CreateAuthChallenge.Arn
137 | DefineAuthChallenge: !GetAtt DefineAuthChallenge.Arn
138 | PreSignUp: !GetAtt PreSignUp.Arn
139 | VerifyAuthChallengeResponse: !GetAtt VerifyAuthChallengeResponse.Arn
140 | PostAuthentication: !GetAtt PostAuthentication.Arn
141 |
142 | DefineAuthChallengeInvocationPermission:
143 | Type: AWS::Lambda::Permission
144 | Properties:
145 | Action: lambda:InvokeFunction
146 | FunctionName: !GetAtt DefineAuthChallenge.Arn
147 | Principal: cognito-idp.amazonaws.com
148 | SourceArn: !GetAtt UserPool.Arn
149 | CreateAuthChallengeInvocationPermission:
150 | Type: AWS::Lambda::Permission
151 | Properties:
152 | Action: lambda:InvokeFunction
153 | FunctionName: !GetAtt CreateAuthChallenge.Arn
154 | Principal: cognito-idp.amazonaws.com
155 | SourceArn: !GetAtt UserPool.Arn
156 | VerifyAuthChallengeResponseInvocationPermission:
157 | Type: AWS::Lambda::Permission
158 | Properties:
159 | Action: lambda:InvokeFunction
160 | FunctionName: !GetAtt VerifyAuthChallengeResponse.Arn
161 | Principal: cognito-idp.amazonaws.com
162 | SourceArn: !GetAtt UserPool.Arn
163 | PreSignUpInvocationPermission:
164 | Type: AWS::Lambda::Permission
165 | Properties:
166 | Action: lambda:InvokeFunction
167 | FunctionName: !GetAtt PreSignUp.Arn
168 | Principal: cognito-idp.amazonaws.com
169 | SourceArn: !GetAtt UserPool.Arn
170 | PostAuthenticationInvocationPermission:
171 | Type: AWS::Lambda::Permission
172 | Properties:
173 | Action: lambda:InvokeFunction
174 | FunctionName: !GetAtt PostAuthentication.Arn
175 | Principal: cognito-idp.amazonaws.com
176 | SourceArn: !GetAtt UserPool.Arn
177 |
178 | UserPoolClient:
179 | Type: "AWS::Cognito::UserPoolClient"
180 | Properties:
181 | ClientName: email-auth-client
182 | GenerateSecret: false
183 | UserPoolId: !Ref UserPool
184 | ExplicitAuthFlows:
185 | - CUSTOM_AUTH_FLOW_ONLY
186 |
187 | Outputs:
188 | UserPoolId:
189 | Description: ID of the User Pool
190 | Value: !Ref UserPool
191 | UserPoolClientId:
192 | Description: ID of the User Pool Client
193 | Value: !Ref UserPoolClient
194 |
--------------------------------------------------------------------------------
/cognito/THIRD-PARTY:
--------------------------------------------------------------------------------
1 | @types/aws-lambda
2 | 8.10.17
3 | MIT License
4 |
5 | Copyright (c) Microsoft Corporation. All rights reserved.
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all
15 | copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE
24 |
25 |
26 | ******************************
27 |
28 | @types/node
29 | 10.12.18
30 | MIT License
31 |
32 | Copyright (c) Microsoft Corporation. All rights reserved.
33 |
34 | Permission is hereby granted, free of charge, to any person obtaining a copy
35 | of this software and associated documentation files (the "Software"), to deal
36 | in the Software without restriction, including without limitation the rights
37 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
38 | copies of the Software, and to permit persons to whom the Software is
39 | furnished to do so, subject to the following conditions:
40 |
41 | The above copyright notice and this permission notice shall be included in all
42 | copies or substantial portions of the Software.
43 |
44 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
50 | SOFTWARE
51 |
52 |
53 | ******************************
54 |
55 | aws-sdk
56 | 2.382.0
57 |
58 | Apache License
59 | Version 2.0, January 2004
60 | http://www.apache.org/licenses/
61 |
62 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
63 |
64 | 1. Definitions.
65 |
66 | "License" shall mean the terms and conditions for use, reproduction,
67 | and distribution as defined by Sections 1 through 9 of this document.
68 |
69 | "Licensor" shall mean the copyright owner or entity authorized by
70 | the copyright owner that is granting the License.
71 |
72 | "Legal Entity" shall mean the union of the acting entity and all
73 | other entities that control, are controlled by, or are under common
74 | control with that entity. For the purposes of this definition,
75 | "control" means (i) the power, direct or indirect, to cause the
76 | direction or management of such entity, whether by contract or
77 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
78 | outstanding shares, or (iii) beneficial ownership of such entity.
79 |
80 | "You" (or "Your") shall mean an individual or Legal Entity
81 | exercising permissions granted by this License.
82 |
83 | "Source" form shall mean the preferred form for making modifications,
84 | including but not limited to software source code, documentation
85 | source, and configuration files.
86 |
87 | "Object" form shall mean any form resulting from mechanical
88 | transformation or translation of a Source form, including but
89 | not limited to compiled object code, generated documentation,
90 | and conversions to other media types.
91 |
92 | "Work" shall mean the work of authorship, whether in Source or
93 | Object form, made available under the License, as indicated by a
94 | copyright notice that is included in or attached to the work
95 | (an example is provided in the Appendix below).
96 |
97 | "Derivative Works" shall mean any work, whether in Source or Object
98 | form, that is based on (or derived from) the Work and for which the
99 | editorial revisions, annotations, elaborations, or other modifications
100 | represent, as a whole, an original work of authorship. For the purposes
101 | of this License, Derivative Works shall not include works that remain
102 | separable from, or merely link (or bind by name) to the interfaces of,
103 | the Work and Derivative Works thereof.
104 |
105 | "Contribution" shall mean any work of authorship, including
106 | the original version of the Work and any modifications or additions
107 | to that Work or Derivative Works thereof, that is intentionally
108 | submitted to Licensor for inclusion in the Work by the copyright owner
109 | or by an individual or Legal Entity authorized to submit on behalf of
110 | the copyright owner. For the purposes of this definition, "submitted"
111 | means any form of electronic, verbal, or written communication sent
112 | to the Licensor or its representatives, including but not limited to
113 | communication on electronic mailing lists, source code control systems,
114 | and issue tracking systems that are managed by, or on behalf of, the
115 | Licensor for the purpose of discussing and improving the Work, but
116 | excluding communication that is conspicuously marked or otherwise
117 | designated in writing by the copyright owner as "Not a Contribution."
118 |
119 | "Contributor" shall mean Licensor and any individual or Legal Entity
120 | on behalf of whom a Contribution has been received by Licensor and
121 | subsequently incorporated within the Work.
122 |
123 | 2. Grant of Copyright License. Subject to the terms and conditions of
124 | this License, each Contributor hereby grants to You a perpetual,
125 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
126 | copyright license to reproduce, prepare Derivative Works of,
127 | publicly display, publicly perform, sublicense, and distribute the
128 | Work and such Derivative Works in Source or Object form.
129 |
130 | 3. Grant of Patent License. Subject to the terms and conditions of
131 | this License, each Contributor hereby grants to You a perpetual,
132 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
133 | (except as stated in this section) patent license to make, have made,
134 | use, offer to sell, sell, import, and otherwise transfer the Work,
135 | where such license applies only to those patent claims licensable
136 | by such Contributor that are necessarily infringed by their
137 | Contribution(s) alone or by combination of their Contribution(s)
138 | with the Work to which such Contribution(s) was submitted. If You
139 | institute patent litigation against any entity (including a
140 | cross-claim or counterclaim in a lawsuit) alleging that the Work
141 | or a Contribution incorporated within the Work constitutes direct
142 | or contributory patent infringement, then any patent licenses
143 | granted to You under this License for that Work shall terminate
144 | as of the date such litigation is filed.
145 |
146 | 4. Redistribution. You may reproduce and distribute copies of the
147 | Work or Derivative Works thereof in any medium, with or without
148 | modifications, and in Source or Object form, provided that You
149 | meet the following conditions:
150 |
151 | (a) You must give any other recipients of the Work or
152 | Derivative Works a copy of this License; and
153 |
154 | (b) You must cause any modified files to carry prominent notices
155 | stating that You changed the files; and
156 |
157 | (c) You must retain, in the Source form of any Derivative Works
158 | that You distribute, all copyright, patent, trademark, and
159 | attribution notices from the Source form of the Work,
160 | excluding those notices that do not pertain to any part of
161 | the Derivative Works; and
162 |
163 | (d) If the Work includes a "NOTICE" text file as part of its
164 | distribution, then any Derivative Works that You distribute must
165 | include a readable copy of the attribution notices contained
166 | within such NOTICE file, excluding those notices that do not
167 | pertain to any part of the Derivative Works, in at least one
168 | of the following places: within a NOTICE text file distributed
169 | as part of the Derivative Works; within the Source form or
170 | documentation, if provided along with the Derivative Works; or,
171 | within a display generated by the Derivative Works, if and
172 | wherever such third-party notices normally appear. The contents
173 | of the NOTICE file are for informational purposes only and
174 | do not modify the License. You may add Your own attribution
175 | notices within Derivative Works that You distribute, alongside
176 | or as an addendum to the NOTICE text from the Work, provided
177 | that such additional attribution notices cannot be construed
178 | as modifying the License.
179 |
180 | You may add Your own copyright statement to Your modifications and
181 | may provide additional or different license terms and conditions
182 | for use, reproduction, or distribution of Your modifications, or
183 | for any such Derivative Works as a whole, provided Your use,
184 | reproduction, and distribution of the Work otherwise complies with
185 | the conditions stated in this License.
186 |
187 | 5. Submission of Contributions. Unless You explicitly state otherwise,
188 | any Contribution intentionally submitted for inclusion in the Work
189 | by You to the Licensor shall be under the terms and conditions of
190 | this License, without any additional terms or conditions.
191 | Notwithstanding the above, nothing herein shall supersede or modify
192 | the terms of any separate license agreement you may have executed
193 | with Licensor regarding such Contributions.
194 |
195 | 6. Trademarks. This License does not grant permission to use the trade
196 | names, trademarks, service marks, or product names of the Licensor,
197 | except as required for reasonable and customary use in describing the
198 | origin of the Work and reproducing the content of the NOTICE file.
199 |
200 | 7. Disclaimer of Warranty. Unless required by applicable law or
201 | agreed to in writing, Licensor provides the Work (and each
202 | Contributor provides its Contributions) on an "AS IS" BASIS,
203 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
204 | implied, including, without limitation, any warranties or conditions
205 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
206 | PARTICULAR PURPOSE. You are solely responsible for determining the
207 | appropriateness of using or redistributing the Work and assume any
208 | risks associated with Your exercise of permissions under this License.
209 |
210 | 8. Limitation of Liability. In no event and under no legal theory,
211 | whether in tort (including negligence), contract, or otherwise,
212 | unless required by applicable law (such as deliberate and grossly
213 | negligent acts) or agreed to in writing, shall any Contributor be
214 | liable to You for damages, including any direct, indirect, special,
215 | incidental, or consequential damages of any character arising as a
216 | result of this License or out of the use or inability to use the
217 | Work (including but not limited to damages for loss of goodwill,
218 | work stoppage, computer failure or malfunction, or any and all
219 | other commercial damages or losses), even if such Contributor
220 | has been advised of the possibility of such damages.
221 |
222 | 9. Accepting Warranty or Additional Liability. While redistributing
223 | the Work or Derivative Works thereof, You may choose to offer,
224 | and charge a fee for, acceptance of support, warranty, indemnity,
225 | or other liability obligations and/or rights consistent with this
226 | License. However, in accepting such obligations, You may act only
227 | on Your own behalf and on Your sole responsibility, not on behalf
228 | of any other Contributor, and only if You agree to indemnify,
229 | defend, and hold each Contributor harmless for any liability
230 | incurred by, or claims asserted against, such Contributor by reason
231 | of your accepting any such warranty or additional liability.
232 |
233 | END OF TERMS AND CONDITIONS
234 |
235 | APPENDIX: How to apply the Apache License to your work.
236 |
237 | To apply the Apache License to your work, attach the following
238 | boilerplate notice, with the fields enclosed by brackets "[]"
239 | replaced with your own identifying information. (Don't include
240 | the brackets!) The text should be enclosed in the appropriate
241 | comment syntax for the file format. We also recommend that a
242 | file or class name and description of purpose be included on the
243 | same "printed page" as the copyright notice for easier
244 | identification within third-party archives.
245 |
246 | Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
247 |
248 | Licensed under the Apache License, Version 2.0 (the "License");
249 | you may not use this file except in compliance with the License.
250 | You may obtain a copy of the License at
251 |
252 | http://www.apache.org/licenses/LICENSE-2.0
253 |
254 | Unless required by applicable law or agreed to in writing, software
255 | distributed under the License is distributed on an "AS IS" BASIS,
256 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
257 | See the License for the specific language governing permissions and
258 | limitations under the License.
259 |
260 |
261 | ******************************
262 |
263 | base64-js
264 | 1.3.0
265 | The MIT License (MIT)
266 |
267 | Copyright (c) 2014
268 |
269 | Permission is hereby granted, free of charge, to any person obtaining a copy
270 | of this software and associated documentation files (the "Software"), to deal
271 | in the Software without restriction, including without limitation the rights
272 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
273 | copies of the Software, and to permit persons to whom the Software is
274 | furnished to do so, subject to the following conditions:
275 |
276 | The above copyright notice and this permission notice shall be included in
277 | all copies or substantial portions of the Software.
278 |
279 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
280 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
281 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
282 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
283 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
284 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
285 | THE SOFTWARE.
286 |
287 |
288 | ******************************
289 |
290 | buffer
291 | 4.9.1
292 | The MIT License (MIT)
293 |
294 | Copyright (c) Feross Aboukhadijeh, and other contributors.
295 |
296 | Permission is hereby granted, free of charge, to any person obtaining a copy
297 | of this software and associated documentation files (the "Software"), to deal
298 | in the Software without restriction, including without limitation the rights
299 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
300 | copies of the Software, and to permit persons to whom the Software is
301 | furnished to do so, subject to the following conditions:
302 |
303 | The above copyright notice and this permission notice shall be included in
304 | all copies or substantial portions of the Software.
305 |
306 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
307 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
308 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
309 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
310 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
311 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
312 | THE SOFTWARE.
313 |
314 |
315 | ******************************
316 |
317 | crypto-secure-random-digit
318 | 1.0.7
319 | license: MIT
320 | authors: ottokruse@gmail.com
321 |
322 | ******************************
323 |
324 | events
325 | 1.1.1
326 | MIT
327 |
328 | Copyright Joyent, Inc. and other Node contributors.
329 |
330 | Permission is hereby granted, free of charge, to any person obtaining a
331 | copy of this software and associated documentation files (the
332 | "Software"), to deal in the Software without restriction, including
333 | without limitation the rights to use, copy, modify, merge, publish,
334 | distribute, sublicense, and/or sell copies of the Software, and to permit
335 | persons to whom the Software is furnished to do so, subject to the
336 | following conditions:
337 |
338 | The above copyright notice and this permission notice shall be included
339 | in all copies or substantial portions of the Software.
340 |
341 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
342 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
343 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
344 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
345 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
346 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
347 | USE OR OTHER DEALINGS IN THE SOFTWARE.
348 |
349 |
350 | ******************************
351 |
352 | ieee754
353 | 1.1.8
354 | Copyright (c) 2008, Fair Oaks Labs, Inc.
355 | All rights reserved.
356 |
357 | Redistribution and use in source and binary forms, with or without
358 | modification, are permitted provided that the following conditions are met:
359 |
360 | * Redistributions of source code must retain the above copyright notice,
361 | this list of conditions and the following disclaimer.
362 |
363 | * Redistributions in binary form must reproduce the above copyright notice,
364 | this list of conditions and the following disclaimer in the documentation
365 | and/or other materials provided with the distribution.
366 |
367 | * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors
368 | may be used to endorse or promote products derived from this software
369 | without specific prior written permission.
370 |
371 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
372 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
373 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
374 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
375 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
376 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
377 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
378 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
379 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
380 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
381 | POSSIBILITY OF SUCH DAMAGE.
382 |
383 |
384 | ******************************
385 |
386 | isarray
387 | 1.0.0
388 | license: MIT
389 | authors: Julian Gruber
390 |
391 | ******************************
392 |
393 | jmespath
394 | 0.15.0
395 | Copyright 2014 James Saryerwinnie
396 |
397 | Licensed under the Apache License, Version 2.0 (the "License");
398 | you may not use this file except in compliance with the License.
399 | You may obtain a copy of the License at
400 |
401 | http://www.apache.org/licenses/LICENSE-2.0
402 |
403 | Unless required by applicable law or agreed to in writing, software
404 | distributed under the License is distributed on an "AS IS" BASIS,
405 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
406 | See the License for the specific language governing permissions and
407 | limitations under the License.
408 |
409 |
410 | ******************************
411 |
412 | punycode
413 | 1.3.2
414 | license: MIT
415 | authors: Mathias Bynens
416 |
417 | ******************************
418 |
419 | querystring
420 | 0.2.0
421 |
422 | Copyright 2012 Irakli Gozalishvili. All rights reserved.
423 | Permission is hereby granted, free of charge, to any person obtaining a copy
424 | of this software and associated documentation files (the "Software"), to
425 | deal in the Software without restriction, including without limitation the
426 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
427 | sell copies of the Software, and to permit persons to whom the Software is
428 | furnished to do so, subject to the following conditions:
429 |
430 | The above copyright notice and this permission notice shall be included in
431 | all copies or substantial portions of the Software.
432 |
433 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
434 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
435 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
436 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
437 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
438 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
439 | IN THE SOFTWARE.
440 |
441 |
442 | ******************************
443 |
444 | sax
445 | 1.2.1
446 | The ISC License
447 |
448 | Copyright (c) Isaac Z. Schlueter and Contributors
449 |
450 | Permission to use, copy, modify, and/or distribute this software for any
451 | purpose with or without fee is hereby granted, provided that the above
452 | copyright notice and this permission notice appear in all copies.
453 |
454 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
455 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
456 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
457 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
458 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
459 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
460 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
461 |
462 | ====
463 |
464 | `String.fromCodePoint` by Mathias Bynens used according to terms of MIT
465 | License, as follows:
466 |
467 | Copyright Mathias Bynens
468 |
469 | Permission is hereby granted, free of charge, to any person obtaining
470 | a copy of this software and associated documentation files (the
471 | "Software"), to deal in the Software without restriction, including
472 | without limitation the rights to use, copy, modify, merge, publish,
473 | distribute, sublicense, and/or sell copies of the Software, and to
474 | permit persons to whom the Software is furnished to do so, subject to
475 | the following conditions:
476 |
477 | The above copyright notice and this permission notice shall be
478 | included in all copies or substantial portions of the Software.
479 |
480 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
481 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
482 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
483 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
484 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
485 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
486 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
487 |
488 |
489 | ******************************
490 |
491 | typescript
492 | 3.2.2
493 | Apache License
494 |
495 | Version 2.0, January 2004
496 |
497 | http://www.apache.org/licenses/
498 |
499 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
500 |
501 | 1. Definitions.
502 |
503 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
504 |
505 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
506 |
507 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
508 |
509 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
510 |
511 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
512 |
513 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
514 |
515 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
516 |
517 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
518 |
519 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
520 |
521 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
522 |
523 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
524 |
525 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
526 |
527 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
528 |
529 | You must give any other recipients of the Work or Derivative Works a copy of this License; and
530 |
531 | You must cause any modified files to carry prominent notices stating that You changed the files; and
532 |
533 | You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
534 |
535 | If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
536 |
537 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
538 |
539 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
540 |
541 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
542 |
543 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
544 |
545 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
546 |
547 | END OF TERMS AND CONDITIONS
548 |
549 |
550 | ******************************
551 |
552 | url
553 | 0.10.3
554 | The MIT License (MIT)
555 |
556 | Copyright Joyent, Inc. and other Node contributors.
557 |
558 | Permission is hereby granted, free of charge, to any person obtaining a copy
559 | of this software and associated documentation files (the "Software"), to deal
560 | in the Software without restriction, including without limitation the rights
561 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
562 | copies of the Software, and to permit persons to whom the Software is
563 | furnished to do so, subject to the following conditions:
564 |
565 | The above copyright notice and this permission notice shall be included in all
566 | copies or substantial portions of the Software.
567 |
568 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
569 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
570 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
571 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
572 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
573 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
574 | SOFTWARE.
575 |
576 |
577 | ******************************
578 |
579 | uuid
580 | 3.1.0
581 | The MIT License (MIT)
582 |
583 | Copyright (c) 2010-2016 Robert Kieffer and other contributors
584 |
585 | Permission is hereby granted, free of charge, to any person obtaining a copy
586 | of this software and associated documentation files (the "Software"), to deal
587 | in the Software without restriction, including without limitation the rights
588 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
589 | copies of the Software, and to permit persons to whom the Software is
590 | furnished to do so, subject to the following conditions:
591 |
592 | The above copyright notice and this permission notice shall be included in all
593 | copies or substantial portions of the Software.
594 |
595 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
596 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
597 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
598 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
599 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
600 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
601 | SOFTWARE.
602 |
603 |
604 | ******************************
605 |
606 | xml2js
607 | 0.4.19
608 | Copyright 2010, 2011, 2012, 2013. All rights reserved.
609 |
610 | Permission is hereby granted, free of charge, to any person obtaining a copy
611 | of this software and associated documentation files (the "Software"), to
612 | deal in the Software without restriction, including without limitation the
613 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
614 | sell copies of the Software, and to permit persons to whom the Software is
615 | furnished to do so, subject to the following conditions:
616 |
617 | The above copyright notice and this permission notice shall be included in
618 | all copies or substantial portions of the Software.
619 |
620 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
621 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
622 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
623 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
624 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
625 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
626 | IN THE SOFTWARE.
627 |
628 |
629 | ******************************
630 |
631 | xmlbuilder
632 | 9.0.7
633 | The MIT License (MIT)
634 |
635 | Copyright (c) 2013 Ozgur Ozcitak
636 |
637 | Permission is hereby granted, free of charge, to any person obtaining a copy
638 | of this software and associated documentation files (the "Software"), to deal
639 | in the Software without restriction, including without limitation the rights
640 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
641 | copies of the Software, and to permit persons to whom the Software is
642 | furnished to do so, subject to the following conditions:
643 |
644 | The above copyright notice and this permission notice shall be included in
645 | all copies or substantial portions of the Software.
646 |
647 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
648 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
649 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
650 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
651 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
652 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
653 | THE SOFTWARE.
654 |
--------------------------------------------------------------------------------