Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ma91n/airac

πŸ‘ͺπŸ”πŸ”πŸ”‘Auth Identify Resource and Access Controller
https://github.com/ma91n/airac

go golang oauth

Last synced: 6 days ago
JSON representation

πŸ‘ͺπŸ”πŸ”πŸ”‘Auth Identify Resource and Access Controller

Awesome Lists containing this project

README

        

# airac
Auth Identify Resource and Access Controller

## API Spec

// TODO

## Configurations

### Windows

Get clientID and Secret Key each applications.

* [Google]()
* [Twitter]()
* Permissions > Access permission > check "Read-only"
* Permissions > Additional permissions > check on "Request email address from users"
* [Facebook]()
* [GitHub](https://github.com/settings/apps/new)
* User authorization callback URL > "http://localhost:8000/github/callback"
* User permissions > check on "User permissions" Access Read-only
* Where can this GitHub App be installed? > Any account

Create Keys

1. ssh-keygen -t rsa
* example) file name is `demo`
2. ssh-keygen -f demo.rsa.pub -e -m pkcs8 > demo.rsa.pub.pkcs8

Set environment variables.

```sh
# Google Client ID
set GOOGLE_CLIENT_ID=
set GOOGLE_CLIENT_SECRET=

# Twitter Consumer API keys
set TWITTER_CONSUMER_KEY=
set TWITTER_CONSUMER_SECRET=

# Facebook
set FACEBOOK_CLIENT_ID=
set FACEBOOK_CLIENT_SECRET=

# GitHub
set GITHUB_CLIENT_ID=
set GITHUB_CLIENT_SECRET=

# PublicKey & SecretKey
set PRIVATE_KEY_PATH=
set PUBLIC_KEY_PATH=

# Optional(default 8000)
set PORT=8000
```

### Mac/Linux

TODO

## Developer Guide

### Required

* go 1.12+

### Setup

1. git clone http://github.com/laqiiz/airac
2. cd airac
3. go mod download
4. go run main.go
5. curl http://localhost:8080/health
* confirming return `ok`

### Install git pre-commit hook script before developing.

```bash
# Windows
cd airac
copy /Y .\.githooks\*.* .\.git\hooks

# Mac/Linux
cd airac
cp .githooks/* .git/hooks
chmod +x .git/hooks/pre-commit
```

### Build

Binary for Linux

```sh
# on Linux
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-s -w' -a -installsuffix cgo -o main main.go

# on Windows
set GOOS=linux
set GOARCH=amd64
set CGO_ENABLED=0
go build -ldflags "-s -w" -a -installsuffix cgo -o main main.go
```

Docker
```sh
docker build -t airac .
docker run airac
```

### Hot Reload

1. Install
* `go get github.com/pilu/fresh`
* `go mod tidy`
2. Run
* `fresh` instead of go run main.go

## License

This project is licensed under the Apache License 2.0 License - see the [LICENSE](LICENSE) file for details