All Projects → danilop → Lambdauth

danilop / Lambdauth

Licence: mit
A sample authentication service implemented with a server-less architecture, using AWS Lambda to host and execute the code and Amazon DynamoDB as persistent storage. This provides a cost-efficient solution that is scalable and highly available and can be used with Amazon Cognito for Developer Authenticated Identities.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Lambdauth

Lambcycle
🐑🛵 A declarative lambda middleware with life cycle hooks 🐑🛵
Stars: ✭ 88 (-93.55%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Cljs Plugin
Serverless plugin for Clojurescript deployment w/ cljs-lambda
Stars: ✭ 72 (-94.73%)
Mutual labels:  aws, serverless, aws-lambda
Contacts api
Serverless RESTful API with AWS Lambda, API Gateway and DynamoDB
Stars: ✭ 66 (-95.16%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Chat
A serverless web chat built using AWS Lambda, AWS IoT (for WebSockets) and Amazon DynamoDB
Stars: ✭ 99 (-92.75%)
Mutual labels:  aws, serverless, aws-lambda
Kinesis Streams Fan Out Kinesis Analytics
Amazon Kinesis Streams fan-out via Kinesis Analytics (powered by the Serverless Framework)
Stars: ✭ 95 (-93.04%)
Mutual labels:  aws, serverless, aws-lambda
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+518.24%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Plugin Webpack
Serverless Plugin Webpack
Stars: ✭ 72 (-94.73%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Export Env
Serverless plugin to export environment variables into a .env file
Stars: ✭ 51 (-96.26%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Plugin Git Variables
⚡️ Expose git variables to serverless
Stars: ✭ 75 (-94.51%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Node Simple Messaging
Simple email AWS lambda function
Stars: ✭ 75 (-94.51%)
Mutual labels:  aws, serverless, aws-lambda
Aws Serverless Airline Booking
Airline Booking is a sample web application that provides Flight Search, Flight Payment, Flight Booking and Loyalty points including end-to-end testing, GraphQL and CI/CD. This web application was the theme of Build on Serverless Season 2 on AWS Twitch running from April 24th until end of August in 2019.
Stars: ✭ 1,290 (-5.49%)
Mutual labels:  aws, serverless, aws-lambda
Tensorflow Lambda Layer
Lets you import Tensorflow + Keras from an AWS lambda
Stars: ✭ 79 (-94.21%)
Mutual labels:  aws, serverless, aws-lambda
Apex
Old apex/apex
Stars: ✭ 20 (-98.53%)
Mutual labels:  aws, serverless, aws-lambda
Ng Toolkit
⭐️ Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
Stars: ✭ 1,116 (-18.24%)
Mutual labels:  aws, serverless, aws-lambda
Aws Power Tuner Ui
AWS Lambda Power Tuner UI is an open source project creating a deployable easy to use website built on a layered technology stack allowing you to optimize your Lambda functions for cost and/or performance in a data-driven way via an easy to use UI.
Stars: ✭ 52 (-96.19%)
Mutual labels:  aws, serverless, aws-lambda
Aws Github Actions
Deploy 🚀 to AWS ☁️ with GitHub Actions!
Stars: ✭ 70 (-94.87%)
Mutual labels:  aws, serverless, aws-lambda
Aws Serverless Java Container
A Java wrapper to run Spring, Jersey, Spark, and other apps inside AWS Lambda.
Stars: ✭ 1,054 (-22.78%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-96.26%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Node Simple Image Resize
Simple image resize AWS lambda function
Stars: ✭ 74 (-94.58%)
Mutual labels:  aws, serverless, aws-lambda
Lambda Refarch Webapp
The Web Application reference architecture is a general-purpose, event-driven, web application back-end that uses AWS Lambda, Amazon API Gateway for its business logic. It also uses Amazon DynamoDB as its database and Amazon Cognito for user management. All static content is hosted using AWS Amplify Console.
Stars: ✭ 1,208 (-11.5%)
Mutual labels:  aws, serverless, aws-lambda

LambdAuth

Join the chat at https://gitter.im/danilop/LambdAuth

Note:

A sample authentication service implemented with a server-less architecture, using AWS Lambda to host and execute the code and Amazon DynamoDB as persistent storage. This provides a cost-efficient solution that is scalable and highly available.

The authentication can be used with Amazon Cognito to assume an Authenticated Role via Developer Authenticated Identities.

The basic functions implemented are:

  • new user creation, an email is sent to validate the email address provided
  • login, getting back an authentication "token" that can be used with Amazon Cognito to assume an Authenticated Role via Developer Authenticated Identities
  • password change
  • password reset, an email is sent with a link to reset the password

Passwords are not saved in clear in the database, but "salted" (via HMAC-SHA1) using a dedicated, random salt for each password.

Amazon SES is used to send all emails.

The login function is calling in the backend GetOpenIdTokenForDeveloperIdentity, a Cognito API to register (or retrieve) the IdentityId and an OpenID Connect token for a user authenticated by your backend authentication process.

A sample implementation can be found at http://lambdauth.danilop.net.

License

Copyright (c) 2015 Danilo Poccia, http://danilop.net

This code is licensed under the The MIT License (MIT). Please see the LICENSE file that accompanies this project for the terms of use.

Installation

A sample installation script using Bash (init.sh) is provided to install and configure all necessary resources in your AWS account:

The init.sh script requires a configured AWS Command Line Interface (CLI) and the jq tool. The script is designed to be non destructive, so you can run it again (e.g. if you delete a role) without affecting the other resources.

Before running the init.sh script, set up your configuration in the config.json file:

  • your AWS account (12-digit number). If an alias happens to be set for your root account, then you will need to go to Support > Support Center of your AWS Console and find your Account Number from the top right corner.
  • name of your CLI profile. This is the CLI profile that you want to represent while running ./init.sh from the command-line. This value is usually found in square brackets inside the ~/.aws/credentials file (%UserProfile%\.aws\credentials file in Windows) after installing the AWS CLI tools for your operating system. For more information, you may refer to the section called Named Profiles in the AWS CLI tools user guide.
  • the AWS region (e.g. "eu-west-1")
  • the Amazon S3 bucket to use for the sample HTML pages
  • the Cache-Control: max-age value, in seconds, to use on Amazon S3 (e.g. if distributed by Amazon CloudFront or another CDN)
  • the cryptographically generated byte size: the length of the various randomly generated hashes / keys / tokens etc can be altered from here centrally. If you choose to use different lengths for the different strings generated by the different lambda functions, you can override this value in those particular lambda scripts individually as desired
  • the Amazon DynamoDB table to create/use
  • the Amazon Cognito identity pool name to create/use (the identity pool id is automatically overwritten if present in the config.json file)
  • the Developer Provider Name to use with Amazon Cognito
  • the external name to be included in emails
  • the email source for emails (must be verified by Amazon SES)
  • the link to the verification page (usually http://bucket.s3.amazonaws.com/verify.html, but can be customized using a bucket name that is a DNS domain, Amazon CloudFront or another CDN)
  • the link to the password reset page (usually http://bucket.s3.amazonaws.com/reset.html, but can be customized using a bucket name that is a DNS domain, Amazon CloudFront or another CDN)
{
  "AWS_ACCOUNT_ID": "123412341234",
  "CLI_PROFILE": "default",
  "REGION": "eu-west-1",
  "BUCKET": "bucket",
  "MAX_AGE": "10",
  "CRYPTO_BYTE_SIZE": 128,
  "DDB_TABLE": "LambdAuthUsers",
  "IDENTITY_POOL_NAME": "LambdAuth",
  "DEVELOPER_PROVIDER_NAME": "login.mycompany.myapp",
  "EXTERNAL_NAME": "My Authentication",
  "EMAIL_SOURCE": "[email protected]",
  "VERIFICATION_PAGE": "http://bucket.s3.amazonaws.com/verify.html",
  "RESET_PAGE": "http://bucket.s3.amazonaws.com/reset.html"
}

At the end of the init.sh script, you can start creating users pointing your browser to:

http://bucket.s3.amazonaws.com/index.html (replacing bucket with your bucket name)

As an optional step, you may want to configure Amazon S3 for Website Hosting and use Amazon CloudFront to distribute the static content.

A sample deployment script using Bash (deploy.sh) is provided to update the AWS Lambda functions and the sample HTML pages on the Amazon S3 bucket.

Usage

Sample HTML pages are provided to showcase how to use this framework with a JavaScript application:

  • signup.html - to create a new user, the email address will be validated sending a custom link to the verify.html page
  • login.html - to login in, assuming an authenitcated role with Cognito
  • verify.html - to validate the email address of a new user
  • changePassword.html - to change password, knowing the old one
  • lostPassword.html - to ask for a passwrod reser, via email
  • reset.html - to reset the password, linked by the email sent for a lost password

The same use cases can be implemented on a Mobile device using the AWS Mobile SDK.

APIs

The APIs are exposed as AWS Lambda Functions:

Function Input Output
LambdAuthCreateUser email, password created: true / false
LambdAuthVerifyUser email, verify verified: true / false
LambdAuthLogin email, password login: true / false, identityId, token
LambdAuthChangePassword email, oldPassword, newPassword changed: true / false
LambdAuthLostPassword email sent: true / false
LambdAuthResetPassword email, lost, password changed: true / false
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].