Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/contamobi/go-oauth2-dynamodb
DynamoDB storage for OAuth 2.0
https://github.com/contamobi/go-oauth2-dynamodb
Last synced: 11 days ago
JSON representation
DynamoDB storage for OAuth 2.0
- Host: GitHub
- URL: https://github.com/contamobi/go-oauth2-dynamodb
- Owner: contamobi
- License: mit
- Created: 2018-01-24T15:55:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-03T09:01:54.000Z (over 5 years ago)
- Last Synced: 2024-06-20T01:57:51.391Z (5 months ago)
- Language: Go
- Size: 13.7 KB
- Stars: 3
- Watchers: 2
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DynamoDB Storage for OAuth 2.0
> Based on the https://github.com/go-oauth2/mongo
[![License][License-Image]][License-Url]
## Install
``` bash
$ go get -u github.com/contamobi/go-oauth2-dynamodb
```## Usage (specifying credentials)
``` go
package mainimport (
"github.com/contamobi/go-oauth2-dynamodb"
"github.com/contamobi/go-oauth2/manage"
)func main() {
manager := manage.NewDefaultManager()
manager.MustTokenStorage(
dynamo.NewTokenStore(dynamo.NewConfig(
"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)
``` go
package mainimport (
"github.com/contamobi/go-oauth2-dynamodb"
"github.com/contamobi/go-oauth2/manage"
)func main() {
manager := manage.NewDefaultManager()
manager.MustTokenStorage(
dynamo.NewTokenStore(dynamo.NewConfig(
"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)),
)
// ...
}
```## 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
```[License-Url]: http://opensource.org/licenses/MIT
[License-Image]: https://img.shields.io/npm/l/express.svg