Socket
Book a DemoInstallSign in
Socket

github.com/zerepl/bookstore_oauth-api

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/zerepl/bookstore_oauth-api

Source
Go
Version
v0.0.0-20220610125302-af21cd6fe5d2
Version published
Created
Source

Bookstore OAuth API

A Golang microservice that will be used as an OAuth API to centralize authentication.

Architecture

Arch

How it works

OAuth

This service will work as a security layer for other services, basic all requisition will need a token that will be generated and used by the client to make requests to others APIs, these APIs will send a request back to our OAuth in order to verify if this token is valid.

Requirements

Standalone

  • Cassandra

Running a container

Before running

This app collect some data from env, bellow you can find a list of all vars and their values:

VariableDescription
cassandra_oauth_hostDatabase URL
cassandra_oauth_keyspaceDatabase Keyspace

Inside this folder you will find a file called migration.cql, run it in your database.

Creating the container

While the same folder of Dockerfile, run:

docker build --tag bookstore_oauth-api:latest .

Running

go run *.go

Running as container

Starting Cassandra container:

docker run --name cassandra --network host -d cassandra:latest

Remember to run migration.cql in your database

Starting the app

docker run -ti --network host -e cassandra_oauth_host=127.0.0.1 -e cassandra_oauth_keyspace=oauth bookstore_oauth-api:latest

API

/oauth/

FunctionMethodPathExpected
Get tokenGET/{token_name}String
Create tokenPOST/JSON
Update tokenPUT/{token_name}String

Create Token

return a token

{
    "access_token": "abc123",
    "user_id": 1,
    "client_id": 2,
    "expires": 123
}

Update Token

  • TBD

TODO

  • Create deployment for K8s

Credits

This microservice is based in this course

FAQs

Package last updated on 10 Jun 2022

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