Simple fake AWS Cognito User Pool API server for development.

Overview

Fakey Cognito

test

🏑 Homepage

Simple fake AWS Cognito API server for development.

βœ… Implemented features

  • AdminXxx on User Pools API.

Get Started

# run with cargo on port 8080
cargo run &

# or run with docker
docker build -t fakey-cognito .
docker run -p 8080:8080 fakey-cognito

# request AdminGetUser
curl -X POST http://localhost:8080 \
     -H 'Content-Type:application/x-amz-json-1.1' \
     -H 'X-Amz-Target:AWSCognitoIdentityProviderService.AdminGetUser' \
     -d '{"Username":"${USER_NAME}","UserPoolId":"${USER_POOL_ID}"}'

Prerequisites

  • rust >= 1.55.0

OR

  • docker >= 19.03

Usage

First read "Get Started".

Configurations

You use configuration with file (YAML).
Default configuration path is /repository_root/config.yml .

Following configuration file format.

ActionName:
  error_type: <force response error type (e.g. InternalFailure)>

...

When use custom path you specify a command line arguments.

cargo run -- --config /path/to/config.yml

Response templates

Fackey-cognito returns simple response by default.
It also returns rendering templates if you need custom responses.

Default template path is /repository_root/templates/**/*.json .
Template file name is a action name and a directory is user_pools, user_pools_auth.

You can use request parameters in template.

Example for template file (e.g.user_pools/AdminGetDevice.json).

{
   "Device": { 
      "DeviceAttributes": [ 
         { 
            "Name": "DeviceName",
            "Value": "DeviceValue"
         }
      ],
      "DeviceCreateDate": {{ now() | date(format="%Y%m%d%H%M%S" )}},
      "DeviceKey": "{{DeviceKey}}",
      "DeviceLastAuthenticatedDate": {{ now() | date(format="%Y%m%d%H%M%S" )}},
      "DeviceLastModifiedDate": {{ now() | date(format="%Y%m%d%H%M%S" )}}
   }
}

Rendering template by tera (Tera is Jinja2 like template engine).

When use custom path you specify a command line arguments.

cargo run -- --templates /path/to/templates

Hooks

Can run python hook scripts before responses.

fakey-cognito calls a hook function in snake_case action name python script.
A hook function takes a request json body string and should return a json string for using a response template.

Example for AdminGetUser action hook script (e.g.hooks/admin_get_user.py).

def hook(request):
    return '{ "json": "response" }'

Default hook scripts directory path is ./hooks.
When use custom path you specify a command line arguments.

cargo run -- --hooks /path/to/hooks

⚠️ Unsupported features

  • Request parameter validations
  • Error response with corrected messages (but supported error types)
  • No check any authentication and authorization

License

Fakey Cognito(fakey-cognito) is under MIT License

Authors

Comments
  • Update crates

    Update crates

    :notebook: Description

    Update crates

    :wrench: Features or Solutions

    Update following crates

    • strum
    • strum_macros
    • pyo3
    • heck
    • pretty_assertions

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Refactor response error with macro

    Refactor response error with macro

    :notebook: Description

    • Refactor response error enum and converting status code function.

    :wrench: Features or Solutions

    • Generate response error enum and converting status code function with macro.

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Add CreateUserImportJob

    Add CreateUserImportJob

    :notebook: Description

    • Add CreateUserImportJob API

    :wrench: Features or Solutions

    • Add CreateUserImportJob API

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Add CreateResourceServer

    Add CreateResourceServer

    :notebook: Description

    • Add CreateResourceServer API

    :wrench: Features or Solutions

    • Add CreateResourceServer API

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Add CreateIdentityProvider

    Add CreateIdentityProvider

    :notebook: Description

    • Add CreateIdentityProvider API

    :wrench: Features or Solutions

    • Add CreateIdentityProvider API

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Add ConfirmForgotPassword

    Add ConfirmForgotPassword

    :notebook: Description

    • Add ConfirmForgotPassword API

    :wrench: Features or Solutions

    • Add Confirm ForgotPassword API

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Create post_action_routes_match! macro for post action routes

    Create post_action_routes_match! macro for post action routes

    :notebook: Description

    Refactor post_action_routes by macro

    :wrench: Features or Solutions

    • Create post_action_routes_match macro that create routing match expression
    • Refactor routes::post_action_routes using post_action_routes_match macro

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Fix README

    Fix README

    :notebook: Description

    Fix readme layout and expressions.

    :wrench: Features or Solutions

    Fix following README sections.

    • Remove 'Priority for implementation'
    • Add 'Implemented features'
    • Move 'Unsupported features' to back

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Add hook

    Add hook

    :notebook: Description

    • Add a hook script system only before response.

    :wrench: Features or Solutions

    • A Python hook script is called before response.
    • A response template can use hook returned value.

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Run concurrent jobs for Github Actions

    Run concurrent jobs for Github Actions

    :notebook: Description

    CI runs static checks and tests with Github Actions, but sequentially.
    This change separates the job into setup(cache), fmt, clippy and test.

    :wrench: Features or Solutions

    • Separates Github Actions test job.
      • makes to run concurrently fmt, clippy and tests.

    :warning: Breaking changes

    • Nothing
    opened by naokirin 0
  • Add log level option

    Add log level option

    Thank you for your contribution to fakey-cognito repo. Before submitting this PR, please check your changes.

    • [x] Title and description have been written simple and useful
    • [x] This PR has made smaller, not bigger
    • [x] Unit tests / integration tests have been added (for bug fixes / features)

    :notebook: Description

    • Add command line argument of log level
    • small debug log changes

    :wrench: Features or Solutions

    • Add --log-level option

    :warning: Breaking changes

    • Changes not to be applied log level until complete to parse command line args
    opened by naokirin 0
Releases(0.2.0)
  • 0.2.0(Sep 30, 2021)

  • 0.1.0(Sep 23, 2021)

    v0.1.0 (2021-09-24)

    πŸŽ‰ First release for fakey-cognito. πŸŽ‰

    Features

    • Create README.
    • Running server on docker container.
    • Custom template responses.
    • Support specified error response on user configuration.
    • Supporting following fake responses.
      • AdminAddUserToGroup
      • AdminConfirmSignUp
      • AdminCreateUser
      • AdminDeleteUserAttributes
      • AdminDeleteUser
      • AdminDisableProviderForUser
      • AdminDisableUser
      • AdminEnableUser
      • AdminForgetDevice
      • AdminGetDevice
      • AdminInitiateAuth
      • AdminLinkProviderForUser
      • AdminListDevices
      • AdminListGroupsForUser
      • AdminListUserAuthEvents
      • AdminRemoveUserFromGroup
      • AdminRespondToAuthChallenge
      • AdminSetUserMFAPreference
      • AdminSetUserPassword
      • AdminSetUserSettings
      • AdminUpdateAuthEventFeedback
      • AdminUpdateDeviceStatus
      • AdminUpdateUserAttributes
      • AdminUserGlobalSignOut
    Source code(tar.gz)
    Source code(zip)
Owner
naokirin
naokirin
Rs.aws-login - A command line utility to simplify logging into AWS services.

aws-login A command line utility to simplify logging into AWS accounts and services. $ aws-login use ? Please select a profile to use: β€Ί ❯ dev-read

Kevin Herrera 11 Oct 30, 2022
Fake ping times.

Pong A Linux program that replies to ping but modifies the payload of the ICMP package to get lower ping times in some ping implementations. See https

Mara Bos 136 Sep 21, 2022
Rust Shop is a fake cloud-based software company that you can fork.

RustShop RustShop is an attempt at building a template and utilities to help quickly set up and manage a production grade cloud-based system. The core

null 56 Dec 17, 2022
A simple workshop to learn how to write, test and deploy AWS Lambda functions using the Rust programming language

Rust Lambda Workshop Material to host a workshop on how to build and deploy Rust Lambda functions with AWS SAM and Cargo Lambda. Intro What is Serverl

Luciano Mammino 13 Mar 28, 2024
Remote Secret Editor for AWS Secret Manager

Barberousse - Remote Secrets Editor About Usage Options Printing Editing Copying RoadMap 1.0 1.1 Future About A project aimed to avoid downloading sec

Mohamed Zenadi 18 Sep 28, 2021
Rust client for AWS Infinidash service.

AWS Infinidash - Fully featured Rust client Fully featured AWS Infinidash client for Rust applications. You can use the AWS Infinidash client to make

Rafael CarΓ­cio 15 Feb 12, 2022
Rusoto is an AWS SDK for Rust

Rusoto is an AWS SDK for Rust You may be looking for: An overview of Rusoto AWS services supported by Rusoto API documentation Getting help with Rusot

null 2.6k Jan 3, 2023
Easy switch between AWS Profiles and Regions

AWSP - CLI To Manage your AWS Profiles! AWSP provides an interactive terminal to interact with your AWS Profiles. The aim of this project is to make i

KubeOps Skills 14 Dec 25, 2022
Postgres proxy which allows tools that don't natively supports IAM auth to connect to AWS RDS instances.

rds-iamauth-proxy rds-proxy lets you make use of IAM-based authentication to AWS RDS instances from tools that don't natively support that method of a

Gold Fig Labs Inc. 10 Nov 7, 2022
A tool to run web applications on AWS Lambda without changing code.

AWS Lambda Adapter A tool to run web applications on AWS Lambda without changing code. How does it work? AWS Lambda Adapter supports AWS Lambda functi

AWS Samples 321 Jan 2, 2023
Cookiecutter templates for Serverless applications using AWS SAM and the Rust programming language.

Cookiecutter SAM template for Lambda functions in Rust This is a Cookiecutter template to create a serverless application based on the Serverless Appl

AWS Samples 24 Nov 11, 2022
πŸ“¦ πŸš€ a smooth-talking smuggler of Rust HTTP functions into AWS lambda

lando ?? maintenance mode ahead ?? As of this announcement AWS not officialy supports Rust through this project. As mentioned below this projects goal

Doug Tangren 68 Dec 7, 2021
Ref Arch: Serverless GraphQL in Rust on AWS

A Whole Hog Reference Architecture for an Apollo Federation-Ready, Serverless, Rust-Based GraphQL Microservice on AWS using Cloud Development Kit (CDK)

Michael Edelman 3 Jan 12, 2022
cargo-lambda a Cargo subcommand to help you work with AWS Lambda

cargo-lambda cargo-lambda is a Cargo subcommand to help you work with AWS Lambda. This subcommand compiles AWS Lambda functions natively and produces

David Calavera 184 Jan 5, 2023
cargo-lambda is a Cargo subcommand to help you work with AWS Lambda.

cargo-lambda cargo-lambda is a Cargo subcommand to help you work with AWS Lambda. The new subcommand creates a basic Rust package from a well defined

null 184 Jan 5, 2023
A Rust runtime for AWS Lambda

Rust Runtime for AWS Lambda This package makes it easy to run AWS Lambda Functions written in Rust. This workspace includes multiple crates: lambda-ru

Amazon Web Services - Labs 2.4k Dec 29, 2022
Managing schema for AWS Athena in GitOps-style

athena-rs Managing AWS Athena Schemas Installation $ cargo install --git https://github.com/duyet/athena-rs $ athena --help athena 0.1.0 Duyet <me@du

Duyet Le 3 Sep 25, 2022
Nitrogen - a tool for deploying web services to AWS Nitro Enclaves

Nitrogen CLI Nitrogen is a tool for deploying web services to AWS Nitro Enclaves. Given a dockerfile and an ssh key, Nitrogen will spin up an EC2, con

Cape Privacy 57 Dec 26, 2022
This repo is a sample video search app using AWS services.

Video Search This repo is a sample video search app using AWS services. You can check the demo on this link. Features Transcribing Video and generate

AWS Samples 8 Jan 5, 2023