Giter VIP home page Giter VIP logo

fingerprint's Introduction

Fingerprint

A customer authentication/authorization microsevice in Go. It allows for user authorization both synchronously and asynchronously.

To validate synchronously, simply give the token to the validate session endpoint, which returns information about the session.

To validate asynchronously, decrypt the bearer token, which is also a JWT token. If you want to validate if its been revolked, call the validate session endpoint. Because you already have the session information from the token decryption, the validation can either be skipped or allowed to fail.

The bearer token is a JWT token, it can be decrypted to provide information about the session (see below).

Passwords are hashed via bcrypt.

The backing database is postgres.

Has the concept of expiring scopes, allowing one session to have multiple groupings of scopes that expire at different times.
Useful for making customers re-login to perform sensisive actions after a period of time.

Has the concept of a guest customer.
This works by generating a customer with an addendum to their email address that fingerprint splits off for you automatically.
This customer is generated a password that cannot be recovered, and is never exposed to any client. Sessions can be requested for guest users to grant them access to things with out having to register.

Setup

Secret for hashing.
Secret for token decoding.

Token Format

{
    "version": 1,
    "session": {
        "customer_id": 1,
        "session_id": 1,
        "expiration": 1538523728,
        "is_guest": false,
        "scope_groupings": [
            {
                "scopes": ["read", "comment"],
                "expiration": 1538523728
            },
            {
                "scopes": ["write"],
                "expiration": 1538523720
            }
        ]
    }
}

Version specifies the format of the token.
Scope groupings are collections of scopes with each set of scopes experation date. Dates are a unix timestamp.

GRPC/API Endpoints (Not for external use)

User Exists

Request: email
Respone: status 

Create User

Request: email, password, scopes 
Response: token 

Create Guest User

Appends .guest.random_id, scrambles a password it does not tell you
Request: email, scopes
Response: token 

Create Session

Request: email, password, scopes  
Response: token  

Update Password

Request: reset token, new password 
Response: status 

Validate Session

Request: token
Response: status, scopes 

Create Password Reset Token

Request: email
Response: reset token

Create Session Revoke

Request: session_id OR customer_id
Response: status 

Tables

Customers

Field Type
uuid
email
reset_token
first_name
last_name
is_guest
updated_at
created_at
  • Has many Sessions
  • Has many PasswordResets

Sessions

Field Type
customer_id
uuid
experation
updated_at
created_at
  • Has many ScopeGroupings
  • Belongs to a Customer

ScopeGroupings

Field Type
session_id
uuid
scopes [String]
updated_at
created_at
  • Belongs to a Session

SessionRevokes

Field Type
session_id
uuid
updated_at
created_at
  • Belongs to a Session

PasswordResets

Field Type
customer_id
uuid
reset_hash
updated_at
created_at
  • Belongs to a Customer

fingerprint's People

Contributors

willschroederdsc avatar willschroeder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.