Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liut/osin-storage
A storage backend for osin oauth2
https://github.com/liut/osin-storage
oauth2 osin osin-oauth2 osin-storage postgres
Last synced: 1 day ago
JSON representation
A storage backend for osin oauth2
- Host: GitHub
- URL: https://github.com/liut/osin-storage
- Owner: liut
- License: mit
- Created: 2016-11-25T10:42:28.000Z (about 8 years ago)
- Default Branch: develop
- Last Pushed: 2020-06-10T06:33:07.000Z (over 4 years ago)
- Last Synced: 2024-11-18T04:39:10.190Z (2 months ago)
- Topics: oauth2, osin, osin-oauth2, osin-storage, postgres
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# osin-storage
A storage backend for [osin oauth2](https://github.com/openshift/osin) with:* `storage/pg`: [go-pg](https://github.com/go-pg/pg).
* `storage/sqlstore`: [pq](https://github.com/lib/pq) or [sqlx](https://github.com/jmoiron/sqlx)This project was inspired from [ory-am](https://github.com/ory-am/osin-storage)
## 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
```sh
cat storage/database/oauth_schema.sql | docker exec -i osin-db psql -U osin
```## Example
```go
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)
}```