# README
DynamoDB Storage for OAuth 2.0
Based on the https://github.com/go-oauth2/mongo
Install
$ go get -u github.com/aubelsb2/go-oauth2-dynamodb
Usage (specifying credentials)
package main
import (
"github.com/aubelsb2/go-oauth2-dynamodb"
"gopkg.in/oauth2.v4/manage"
)
func main() {
manager := manage.NewDefaultManager()
manager.MustTokenStorage(
dynamo.NewTokenStore(dynamo.NewTokenStoreConfig(
"us-east-1", // AWS Region
"http://localhost:8000", // AWS DynamoDB Endpoint
"AKIA*********", // AWS Access Key
"*************", // AWS Secret
"oauth2_basic", // Oauth2 basic table name
"oauth2_access", // Oauth2 access table name
"oauth2_refresh", // Oauth2 refresh table name
)),
)
// ...
}
Usage (with IAM Role configured for ec2 or Lambda)
package main
import (
"github.com/aubelsb2/go-oauth2-dynamodb"
"gopkg.in/oauth2.v4/manage"
)
func main() {
manager := manage.NewDefaultManager()
manager.MustTokenStorage(
dynamo.NewTokenStore(dynamo.NewTokenStoreConfig(
"us-east-1", // AWS Region
"", // Emtpy
"", // Emtpy
"", // Emtpy
"oauth2_basic", // Oauth2 basic table name
"oauth2_access", // Oauth2 access table name
"oauth2_refresh", // Oauth2 refresh table name
)),
)
// ...
}
Client ID version
package main
import (
"github.com/aubelsb2/go-oauth2-dynamodb"
"gopkg.in/oauth2.v4/manage"
)
func main() {
manager := manage.NewDefaultManager()
manager.MapClientStorage(
dynamo.NewClientStore(dynamo.NewClientStoreConfig(
"us-east-1", // AWS Region
"", // Emtpy
"", // Emtpy
"", // Emtpy
"client_id", // Client id table name
)),
)
// ...
}
Run tests
Start dynamodb local
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
Export env variables
export AWS_REGION=us-east-1
export DYNAMODB_ENDPOINT='http://localhost:8000'
export AWS_ACCESS_KEY=AKIA******
export AWS_SECRET=**************
Run tests
go test
MIT License
Copyright (c) 2018 Conta.MOBI
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewClientStoreConfig create dynamodb configuration.
NewConfig create dynamodb configuration.
No description provided by the author
NewTokenStoreConfig create dynamodb configuration.
# Structs
No description provided by the author
No description provided by the author
Config dynamodb configuration parameters.
No description provided by the author
No description provided by the author
No description provided by the author