crabio / robin

Authentication service, which provide multiple authentication providers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Robin

License: MIT

Authentication service, which provide multiple authentication providers

Structure

Code structure is based on the Golang-Project-Structure

Presequinces

  • Install protobuf compiler:
sudo apt-get -y install protobuf-compiler
  • Install Google protobuf for Golang:
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}

Configuration

App should be located near configuration file config.yml.

Example file can be found in repo's config.yml.

Auth providers secrets

All auth providers secrets are stored in the secrets folder.

Google

For creating OAuth2 secrets, follow steps:

  1. Go to Google API console
  2. Create project
  3. Add OAuth 2.0 Client IDs creadentials
  4. Add scopes for getting user profile info:
    • https://www.googleapis.com/auth/userinfo.email
    • https://www.googleapis.com/auth/userinfo.profile
  5. Add redirecting URL, which is link to your server API. (example: http://localhost:9000)

Google OAuth2 secrets should be downloaded as JSON file from Google API console.

Lint

For linting we are using golangci-lint

To run this we recomend use Docker:

docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.40-alpine golangci-lint run

Test

Before pull request, please run test.sh script from the scripts folder for checking errors.

Code coverage

After executing test.sh file coverage.out with code coverage statistic will be generated. For view this file in HTML format use:

go tool cover -html=coverage.out

Run

For running use:

go run .

Deployment

Docker

For building docker container use:

sh scripts/build_docker.sh

For deploy app with docker run script in docker folder:

docker-compose up -d

About

Authentication service, which provide multiple authentication providers

License:MIT License


Languages

Language:Go 90.1%Language:Dockerfile 5.4%Language:Shell 3.6%Language:HTML 1.0%