All Projects → alexrudd → cognito-srp

alexrudd / cognito-srp

Licence: Apache-2.0 license
Go library for AWS Cognito SRP

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to cognito-srp

aws-sdk-net-extensions-cognito
An extension library to assist in the Amazon Cognito User Pools authentication process
Stars: ✭ 80 (+100%)
Mutual labels:  srp, cognito-user-pool
terraform-aws-cognito-user-pool
A Terraform module to create and manage Cognito User Pools (Simple and Secure User Sign-Up, Sign-In, and Access Control) on Amazon Web Services (AWS). https://aws.amazon.com/cognito
Stars: ✭ 46 (+15%)
Mutual labels:  cognito, cognito-user-pool
terraform-aws-cognito-user-pool
Terraform module to create Amazon Cognito User Pools, configure its attributes and resources such as app clients, domain, resource servers. Amazon Cognito User Pools provide a secure user directory that scales to hundreds of millions of users.
Stars: ✭ 65 (+62.5%)
Mutual labels:  cognito, cognito-user-pool
Ixortalk.aws.cognito.jwt.security.filter
Spring Boot security filter for decoding Cognito JWT IdTokens
Stars: ✭ 75 (+87.5%)
Mutual labels:  cognito
React Cognito Auth
A sample authentication app implemented with a server-less architecture, using cognito User Pools, API Gateway, react
Stars: ✭ 76 (+90%)
Mutual labels:  cognito
Terraform Aws Cognito Auth
Serverless Authentication as a Service (AaaS) provider built on top of AWS Cognito
Stars: ✭ 248 (+520%)
Mutual labels:  cognito
cognito-amplify-custom-auth
A React/Redux web application that implements a custom UI for Cognito Userpool Auth using AWS Amplify
Stars: ✭ 27 (-32.5%)
Mutual labels:  cognito-user-pool
Amplify Js
A declarative JavaScript library for application development using cloud services.
Stars: ✭ 8,539 (+21247.5%)
Mutual labels:  cognito
amazon-ivs-ugc-web-demo
This repository shows how you can build a compelling user-generated content (UGC) live streaming webapp with Amazon IVS.
Stars: ✭ 14 (-65%)
Mutual labels:  cognito
Aws Mobile React Native Starter
AWS Mobile React Native Starter App https://aws.amazon.com/mobile
Stars: ✭ 2,247 (+5517.5%)
Mutual labels:  cognito
Cognito Express
Authenticates API requests on a Node application by verifying the JWT signature of AccessToken or IDToken generated by Amazon Cognito.
Stars: ✭ 165 (+312.5%)
Mutual labels:  cognito
Aws Cli Cheatsheet
☁️ AWS CLI + JQ = Make life easier
Stars: ✭ 94 (+135%)
Mutual labels:  cognito
openapi-tf-example
Example of how you can use OpenAPI with AWS API Gateway, Also includes integrations with AWSLambda, AWS Cognito, AWS SNS and CloudWatch logs
Stars: ✭ 38 (-5%)
Mutual labels:  cognito
Cognitocurl
🦉🤖Easily sign curl calls to API Gateway with Cognito authorization token.
Stars: ✭ 76 (+90%)
Mutual labels:  cognito
noiiice
a serverless blog built on NuxtJS, AWS, serverless framework, and irrational exuberance.
Stars: ✭ 42 (+5%)
Mutual labels:  cognito
Aws Amplify Ecommerce
Learn how to integrate AWS Amplify and Amazon Pinpoint to create a retail website. You use the event data that's generated by customers activities on your site to send custom-tailored emails, creating a curated, omnichannel experience.
Stars: ✭ 71 (+77.5%)
Mutual labels:  cognito
RamblerAppDelegateProxy
divide et impera
Stars: ✭ 83 (+107.5%)
Mutual labels:  srp
Cognito Backup Restore
AIO Tool for backing up and restoring AWS Cognito User Pools
Stars: ✭ 142 (+255%)
Mutual labels:  cognito
Retail Demo Store
AWS Retail Demo Store is a sample retail web application and workshop platform demonstrating how AWS infrastructure and services can be used to build compelling customer experiences for eCommerce, retail, and digital marketing use-cases
Stars: ✭ 238 (+495%)
Mutual labels:  cognito
ses-email-client
Simple, serverless client for AWS SES. With this, you can send/read emails received by SES into S3 without purchasing AWS Workmail. If you only use SES for email marketing, you can also see and preview your SES templates in the browser
Stars: ✭ 21 (-47.5%)
Mutual labels:  cognito

cognito-srp

Build Status Go Report Card Maintainability Test Coverage

This is almost a direct port of capless/warrant

All crypto functions are tested against equivalent values produced by warrant

  • v2 - Removed dependency on aws-sdk-go-v2
  • v3 - Migrate to map[string]*string types for better compatability with aws-sdk-go-v2
  • v4 - Migrate back to map[string]string types as aws-sdk-go-v2 reverted their API changes

Usage

package main

import (
	"context"
	"fmt"
	"time"

	cognitosrp "github.com/alexrudd/cognito-srp/v4"

	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/aws-sdk-go-v2/config"
	cip "github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider"
	"github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider/types"
)

func main() {
	// configure cognito srp
	csrp, _ := cognitosrp.NewCognitoSRP("user", "pa55w0rd", "eu-west-1_myPoolId", "client", nil)

	// configure cognito identity provider
	cfg, _ := config.LoadDefaultConfig(
		config.WithRegion("eu-west-1"),
		config.WithCredentialsProvider(aws.AnonymousCredentials{}),
	)
	svc := cip.NewFromConfig(cfg)

	// initiate auth
	resp, err := svc.InitiateAuth(context.Background(), &cip.InitiateAuthInput{
		AuthFlow:       types.AuthFlowTypeUserSrpAuth,
		ClientId:       aws.String(csrp.GetClientId()),
		AuthParameters: csrp.GetAuthParams(),
	})
	if err != nil {
		panic(err)
	}

	// respond to password verifier challenge
	if resp.ChallengeName == types.ChallengeNameTypePasswordVerifier {
		challengeResponses, _ := csrp.PasswordVerifierChallenge(resp.ChallengeParameters, time.Now())

		resp, err := svc.RespondToAuthChallenge(context.Background(), &cip.RespondToAuthChallengeInput{
			ChallengeName:      types.ChallengeNameTypePasswordVerifier,
			ChallengeResponses: challengeResponses,
			ClientId:           aws.String(csrp.GetClientId()),
		})
		if err != nil {
			panic(err)
		}

		// print the tokens
		fmt.Printf("Access Token: %s\n", *resp.AuthenticationResult.AccessToken)
		fmt.Printf("ID Token: %s\n", *resp.AuthenticationResult.IdToken)
		fmt.Printf("Refresh Token: %s\n", *resp.AuthenticationResult.RefreshToken)
	} else {
		// other challenges await...
	}
}
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].