cognito-signature-auth-lambda
Cognito Signature Auth Lambda is a project that to test a custom signature-based authentication flow for AWS Cognito using Lambda functions and the Serverless Application Model (SAM). This service provides a sample framework for integrating public key cryptography and digital signatures into Cognito's authentication process. 🔐🚀
- Custom Cognito User Pool Lambda triggers for signature-based authentication
- Public key and signature verification during user registration and authentication
- Custom challenge creation and verification using cryptographic signatures
- Flexible authentication flow management centered around digital signatures
- Extensible post-authentication actions
.
├── Makefile
├── README.md
├── internal
│ └── helpers
│ └── signature.go
├── lambdas
│ ├── create-auth-challenge
│ ├── define-auth-challenge
│ ├── post-authentication
│ ├── pre-sign-up
│ └── verify-auth-challenge-response
├── samconfig.toml
└── template.yaml
-
Pre Sign-Up (
lambdas/pre-sign-up/
)- Validates user's public key and initial signature during Cognito sign-up
-
Define Auth Challenge (
lambdas/define-auth-challenge/
)- Manages the flow of signature-based authentication challenges
-
Create Auth Challenge (
lambdas/create-auth-challenge/
)- Generates cryptographic challenges for signature-based authentication
-
Verify Auth Challenge Response (
lambdas/verify-auth-challenge-response/
)- Verifies digital signatures provided in response to authentication challenges
- Signature Verification (
internal/helpers/signature.go
)- Provides core functionality for cryptographic operations and signature verification
AWS SAM is used for configuration and deployment:
template.yaml
: Defines AWS resources, including Cognito User Pool and Lambda functionssamconfig.toml
: Configuration for SAM CLI
- Go 1.x 🐹
- AWS CLI 🧰
- AWS SAM CLI 🛠️
- AWS account with necessary permissions 🔑
- Clone the repository:
git clone https://github.com/your-username/cognito-signature-auth-lambda.git
- Navigate to the project directory:
cd cognito-signature-auth-lambda
- Run
sam build
to compile the Lambda functions - Run
sam deploy
to deploy the stack to AWS
Once deployed, this service creates a Cognito User Pool with custom Lambda triggers that implement a signature-based authentication flow. Users can register and authenticate using their public keys and digital signatures.
To modify the project:
- Update Lambda functions in the
lambdas/
directory to adjust signature verification or challenge processes - Modify
template.yaml
to fine-tune Cognito User Pool or Lambda function configurations
- Ensure proper configuration of AWS environment variables and permissions
- This project provides a foundation for implementing robust, signature-based authentication in Cognito
- Thorough cryptographic review and security testing is recommended before any production use