All Projects → SharkBait80 → GrandmasRecipes

SharkBait80 / GrandmasRecipes

Licence: other
A web application demonstrating how to create an API Gateway custom authoriser in .NET Core 2.0.

Programming Languages

C#
18002 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to GrandmasRecipes

Aws Sam Golang Example
An example API and Worker written in Golang using the Amazon Serverless Application Model (AWS SAM)
Stars: ✭ 73 (+180.77%)
Mutual labels:  aws-apigateway
bam
Official Github repository of BAM!
Stars: ✭ 19 (-26.92%)
Mutual labels:  aws-apigateway
xilution-react-todomvc
An implementation of TodoMVC featuring AWS Serverless Application Model (SAM) and Xilution SaaS.
Stars: ✭ 24 (-7.69%)
Mutual labels:  aws-apigateway
Serverless Sam
Serverless framework plugin to export AWS SAM templates for a service
Stars: ✭ 143 (+450%)
Mutual labels:  aws-apigateway
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+730.77%)
Mutual labels:  aws-apigateway
ginger
Serverless framework for Go runtime.
Stars: ✭ 16 (-38.46%)
Mutual labels:  aws-apigateway
Amplify Js
A declarative JavaScript library for application development using cloud services.
Stars: ✭ 8,539 (+32742.31%)
Mutual labels:  aws-apigateway
aws-sync-routes
Synchronizes the specified route from the main/default route table to all custom route tables in the VPC.
Stars: ✭ 16 (-38.46%)
Mutual labels:  aws-apigateway
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (+776.92%)
Mutual labels:  aws-apigateway
aws-serverless-swift-api-template
A Serverless REST API template, implemented in Swift with swift-aws-lambda-runtime.
Stars: ✭ 42 (+61.54%)
Mutual labels:  aws-apigateway
Awsmobile Cli
CLI experience for Frontend developers in the JavaScript ecosystem.
Stars: ✭ 147 (+465.38%)
Mutual labels:  aws-apigateway
Aws Csa Notes 2018
My AWS Certified Solutions Architect Associate Study Notes!
Stars: ✭ 167 (+542.31%)
Mutual labels:  aws-apigateway
aws-secure-websockets
Secure web socket implementation using AWS products and serverless framework
Stars: ✭ 49 (+88.46%)
Mutual labels:  aws-apigateway
Architect
The simplest, most powerful way to build serverless applications
Stars: ✭ 1,925 (+7303.85%)
Mutual labels:  aws-apigateway
Dracker
An iOS and React App to track debt and send/receive payments.
Stars: ✭ 22 (-15.38%)
Mutual labels:  aws-apigateway
Alagarr
🦍 Alagarr is a request-response helper library that removes the boilerplate from your Node.js (AWS Lambda) serverless functions and helps make your code portable.
Stars: ✭ 58 (+123.08%)
Mutual labels:  aws-apigateway
agw
Route AWS APIGateway to lambda with standard router such as mux
Stars: ✭ 24 (-7.69%)
Mutual labels:  aws-apigateway
hyper-kube-config
H Y P E R K U B E - A Serverless API and kubectl plugin providing a storage and retrieval Kubernetes cluster credentials. Hyperkube leverages AWS Secrets Manager for storing credential information.
Stars: ✭ 27 (+3.85%)
Mutual labels:  aws-apigateway
terraform-aws-apigateway-v2
Terraform module to create an AWS API Gateway v2 (HTTP/WebSocket) 🇺🇦
Stars: ✭ 71 (+173.08%)
Mutual labels:  aws-apigateway
serverless-swagger-api
Simplifies the process of generating an API Gateway API from a swagger file.
Stars: ✭ 15 (-42.31%)
Mutual labels:  aws-apigateway

Grandma's Recipes

A demo web application to showcase API Gateway custom authorizers in .NET Core. API Gateway security with .NET doesn't need to be a complete mystery!

Pre-Requisites

  • Install .NET Core 2.0

  • Install Visual Studio or Rider

  • If you are using Windows, install the AWS Toolkit for Visual Studio


The application is made up of a frontend which is a single page application and a .NET-based solution which serves as the API.


Front End

This is a single page web application in /UI. It consists of a HTML page that uses AJAX calls to an API endpoint. The web application is designed to show the delicious recipes that Grandma has created over the years, but unfortunately she's forgotten to lock-down her API.

API

The API is a .NET Core application and laid out as a Visual Studio .sln solution. These are the projects.

DataLayer

This is the DbContext for Entity Framework to access the database where all the delicious recipes are stored. The connection string uses AWS SSM parameter store to make sure it doesn't fall into the wrong hands.

Entities

This project contains the data model for the database objects. It currently only has one object, a Recipe.

Security

This is a shared class library between the token issuer and the token validator which contains the shared secrets.

To be more secure, this could probably be locked down using AWS SSM parameter store.

RecipesAPI

This is an ASP.NET Web API project that is used to serve recipes out using the RecipesController. Using the AWS toolkit for Visual Studio, you can deploy this easily as a serverless application using API Gateway and AWS Lambda.

RecipesAPI.Tokens

This is an ASP.NET Web API Project that issues tokens for the custom authorizer to validate. Using the AWS toolkit for Visual Studio, you can deploy this easily as a serverless application using API Gateway and AWS Lambda.

Recipes.API.Authorizer

This is a AWS Lambda project that is used as a custom authorizer to validate tokens issued using the tokens project. By configuring API Gateway to use this as a custom authorizer, you can take load off your web servers/reverse proxies by offloading AuthZ using this AWS Lambda function.

What are the key libraries/dependencies/NuGet pacakges?

Remember, we're dealing with security so as far as possible, we want to use standard libraries and not roll our own. The ones that we are using in this project are:

  • Microsoft.IdentityModel.Tokens

  • System.IdentityModel.Tokens.Jwt

Of course, we are dealing with AWS so the AWS SDK for .NET is going to be used.

  • AWSSDK.Core
  • AWSSDK.SimpleSystemsManagement

Building AWS serverless applications with for .NET are a lot easier once you have imported the object model libraries:

  • Amazon.Lambda.APIGatewayEvents
  • Amazon.Lambda.Core
  • Amazon.Lambda.Serialization.Json
  • Amazon.Lambda.AspNetCoreServer

Wait a minute - why don't I just use the Authorize attribute and let ASP.NET handle the authZ?

The short answer is that you can! If you choose to go down this route, you can add authorization policies in your Startup.cs and because AWS deploys your ASP.NET Web API pipeline in the same manner that Kestrel does, you'll be able to get JWT authorization through your ASP.NET web API that way.

By using a custom authorizer, you get a few benefits:

  • Custom authorizers can take load off your normal workload, so if you are using a web server to back your API Gateway deployment, you don't need to waste compute cycles on authZ with each request.

  • API Gateway supports cross-account custom authorizers. If you have an architecture that allows you to centralise authorization, you can create a few authorizers to handle many APIs.

  • API Gateway supports caching of authorization, so this saves compute resources as each request does not need to go through authorization.

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].