sully

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

README

sully

Introduction

Today Go community is at a disadvantageous position and the reason for this is: There is no library like Warrant for Python that would help the Go community to work with the AWS Cognito constructs in a simplified way.

This package sully is an attempt to simplify the life of a Go developer when interacting with AWS Cognito.

Many thanks to AlexRudd. See the Credits section for details

Why the name Sully

I chose this name after watching the movie Sully in which Tom Hanks plays the real life character of Chesley Sullenberger who is a speaker on airline safety, I saw it fit to name this library after Sully as this eases the developer's effort when working with AWS Cognito

Credits

I have copied the SRP implementation for Cognito by @AlexRudd cognito-srp to build a new library which does more than just SRP calculation

Documentation

Overview

Package sully provides interfaces to work with AWS Cognito to fetch the OpenID Token

Example (FetchOpenIDToken)
package main

import (
	"fmt"

	"github.com/alwindoss/sully"
)

func main() {
	cfg := &sully.Config{
		UserPoolID:     "dummy-user-pool-id",
		IdentityPoolID: "dummy-identity-pool-id",
		ClientID:       "dummy-client-id",
		Region:         "dummy-region",
	}
	client := sully.NewCognitoClient(cfg)
	token, err := client.Authenticate("user-name", "password")
	if err != nil {
		fmt.Printf("Error: %v", err)
		return
	}
	fmt.Printf("Token: %s\n", token)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cognito

type Cognito interface {
	Authenticate(userName, password string) (string, error)
}

Cognito is

func NewCognitoClient

func NewCognitoClient(cfg *Config) Cognito

NewCognitoClient is a factory to create the cognito client if the nil config is not provided or any of the fields in the config are not set then a nil object would ne returned

type Config

type Config struct {
	UserPoolID     string
	IdentityPoolID string
	ClientID       string
	Region         string
}

Config is the configuration that needs to be provided to the factory functon NewCognitoClient

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL