Categorygithub.com/liut/osin-storage
repositorypackage
0.0.0-20200610063248-987a2ef39890
Repository: https://github.com/liut/osin-storage.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

osin-storage

A storage backend for osin oauth2 with:

This project was inspired from ory-am

Addition features

  • Save map and struct meta information with JSON(or JSONB) for Client and Authorization
  • Use SaveClient() instead of CreateClient() and UpdateClient()
  • Add AllClients() [] interface for management
  • Add remember function for authorization

Prepare database

cat storage/database/oauth_schema.sql | docker exec -i osin-db psql -U osin

Example


import (
	"database/sql"

	_ "github.com/lib/pq"
	"github.com/liut/osin-storage/storage/sqlstore"
	"github.com/openshift/osin"
)

func main () {
	dsn := "postgres://osin:[email protected]:5432/osin?sslmode=disable"
	db, err := sql.Open("postgres", dsn)
	if err != nil {
		log.Fatal(err)
	}

	store := sqlstore.New(db)
	server := osin.NewServer(newOsinConfig(), store)
}