Skip to content
Passport implementation for golang
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
examples
README.md
confirmable.go
error.go
extra.go
go.mod
go.sum
postgres.go
postgres_test.go
recoverable.go
repository.go
trackable.go
usecase_change_email.go
usecase_change_email_test.go
usecase_change_password.go
usecase_change_password_test.go
usecase_confirm.go
usecase_confirm_test.go
usecase_login.go
usecase_login_test.go
usecase_register.go
usecase_register_test.go
usecase_reset_password.go
usecase_reset_password_test.go
usecase_send_confirmation.go
usecase_send_confirmation_test.go
usecase_send_reset_password.go
usecase_send_reset_password_test.go
user.go
validate.go

README.md

CircleCI

passport

WORK IN PROGRESS

Reusable authentication module for golang. Setting up authentication for any golang microservice should be easy.

Installation

$ go get github.com/alextanhongpin/passport

Migrations

The following columns is required in order to use this package. This can be added to an existing table or a new one.

Postgres:

CREATE TABLE IF NOT EXISTS login (
	id UUID DEFAULT uuid_generate_v1mc(),
	
	email TEXT UNIQUE NOT NULL,

	-- Authenticatable.
	encrypted_password TEXT NOT NULL DEFAULT '',

	-- Confirmable.
	confirmation_token TEXT UNIQUE NULL,
	confirmation_sent_at TIMESTAMP WITH TIME ZONE NULL,
	confirmed_at TIMESTAMP WITH TIME ZONE NULL,
	unconfirmed_email TEXT NOT NULL DEFAULT '',

	-- Recoverable.
	reset_password_token TEXT UNIQUE NULL,
	reset_password_sent_at TIMESTAMP WITH TIME ZONE NULL,
	allow_password_change BOOLEAN NOT NULL DEFAULT false,

	-- Timestamp.
	created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
	updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
	deleted_at TIMESTAMP WITH TIME ZONE NULL,

	PRIMARY KEY (id)
);

Provider

You just need to implement a Repository to read and write data to the database of your choice. Passport only implements the business logic and does not assume the choice of storage. And example of the repository implementation can be seen in postgres.go.

You can’t perform that action at this time.