Skip to content

liut/osin-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:osin@127.0.0.1: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)
}

Releases

No releases published

Packages

No packages published