Kauthie
Kauthie is a account/user managment implementation so I don't ever have to write that again.
I implemented this all login/logout/reset/invite/edit thing a few times and I am getting tiered of it, I looked at UserApp and StormPath but I never was stoked @ outsourcing or depending on someone else for a core part of an app.
This implementation is written on Go with the Gin framework and exposes a simple JSON API to allow other parts of the app to interact with account data. OAuth2 is also implemented.
Drawing by yassui @ DeviantArt
Deploying / Demo
Setting up Kauthie on Heroku is pretty straight foward:
git clone [email protected]:kiasaki/kauthie.git
./heroku-setup.sh
git push heroku master
Technology
Kauthie is written in Go using MongoDB as datastore and Stripe for payment processing and recurring billing.
This technology stack has a nice balance of speed, maintainability, ease of deployment and flexibility to adapt to different requirements.
The important libraries Kauthie relies upon are the following:
- github.com/GeertJohan/go.rice
- github.com/gorilla/mux
- github.com/gorilla/sessions
- gopkg.in/mgo.v2
- github.com/stripe/stripe
- github.com/bluele/gforms
- code.google.com/p/go.crypto/bcrypt
What's implemented?
- Signed out
- GET /signup => Signup form with CC info & account name & user info
- POST /signup => Creates account & Creates user & Links user to account & Creates Stripe custumer with selected plan
- GET /login => Login page, support "?next=http://app.exemple.com"
- POST /login => Redirects to next url or to "/"
- GET /forgot => Asks for email to whom send recovery instructions
- POST /forgot => Sends an email containg the nessesary information to change password
- GET /change-password => Allows for changing password provided you have a key (email links send here)
- GET /logout => Well ... logs you out!
- Signed in
- GET / => Redirects you to your first account or make your select one if you have multiple
- GET /a/{id}/profile => Editing your personnal info (email, name, password)
- POST /a/{id}/profile => Saves profile
- GET /a/{id}/settings => Editing the accounts settings (account name, owner, delete account)
- POST /a/{id}/settings => Saves account / Changes owner
- DELETE /a/{id} => Queues account for deletion
- GET /a/{id}/billing => Plan seelction and billing details
- POST /a/{id}/billing => Saves billing info & handles changing plan
- GET /a/{id}/history => Show billing history (past bills)
- GET /a/{id}/bill/{id} => Show bill details and offer print option
- GET /a/{id}/users => Show account users list
- GET /a/{id}/users/invite => Show account user invitation form
- GET /authorize => OAuth 2.0 Authrization page (send to login before if not connected)
- GET /token => OAuth 2.0 Token page, used for access tokens/refresh token validation during OAuth auth