Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/influenzanet/authentication-service

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/influenzanet/authentication-service

  • v0.0.0-20200506135015-882ece86b082
  • Source
  • Go
  • Socket score

Version published
Created
Source

Authorization Service

Test

Setup

The tests use the gomock library. To install this use:

go get github.com/golang/mock/gomock
go install github.com/golang/mock/mockgen

Then generate mock client for the user management service:

mockgen -source=./api/user-management-api.pb.go UserManagementApiClient > mocks/user-management.go

For more information about testing grpc clients with go check: https://github.com/grpc/grpc-go/blob/master/Documentation/gomock-example.md

Script to run tests

After installing the dependencies, you can add a script to initiate tests. This script is not included in this repository, since it contains secret infos, like DB password.

export JWT_TOKEN_KEY="<insert secret key to sign jwt>"
export TOKEN_EXPIRATION_MIN="10" # minutes token is valid
export TOKEN_MINIMUM_AGE_MIN="2"  # wait so many minutes at least before refreshing the token

export DB_CONNECTION_STR="<mongo db connection string without prefix and auth infos>"
export DB_USERNAME="<username for mongodb auth>"
export DB_PASSWORD="<password for mongodb auth>"
export DB_PREFIX="+srv" # e.g. "" (emtpy) or "+srv"
export DB_TIMEOUT=30 # seconds until connection times out
export DB_IDLE_CONN_TIMEOUT=45 # terminate idle connection after seconds
export DB_MAX_POOL_SIZE=8
export DB_DB_NAME_PREFIX="<DB_PREFIX>" # DB names will be then > <DB_PREFIX>+"hard-coded-db-name-as-we-need-it"

go test  ./...

Build

The included Dockerfile should provide everything needed to build and run the application.

Build the image:

docker build --rm -t 'authentication-service:latest' .

Run the image:

docker run -p 3100:3100 authentication-service

Access the API on localhost:3100

Token signiture key

You can use the key generator, to generate a random private key to sign tokens.

FAQs

Package last updated on 06 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc