Skip to content

Commit

Permalink
updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
swithek authored Jul 31, 2019
1 parent 8c12c1f commit 30e84f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ go get github.com/swithek/sessionup
## Usage
The first thing you will need, in order to start creating and validating your sessions, is a Manager:
```go
manager := sessionup.NewManager(yourStore)
store := memstore.New(time.Minute * 5)
manager := sessionup.NewManager(store)
```

Out-of-the-box sessionup's Manager instance comes with recommended [OWASP](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Session_Management_Cheat_Sheet.md#binding-the-session-id-to-other-user-properties)
configuration options already set, but if you feel the need to customize the behaviour and the cookie values the Manager
will use, you can painlessly provide your own options:
```go
manager := sessionup.NewManager(yourStore, sessionup.Secure(false), sessionup.ExpiresIn(time.Hour * 24))
manager := sessionup.NewManager(store, sessionup.Secure(false), sessionup.ExpiresIn(time.Hour * 24))
```

During registration, login or whenever you want to create a fresh session, you have to call the `Init` method and provide
Expand Down Expand Up @@ -111,6 +112,7 @@ lacks randomness or has other issues, pass your custom ID generation function as
- ./memstore/ - in-memory store implementation, already included in this package.
- [github.com/swithek/sessionup-pgstore](https://github.com/swithek/sessionup-pgstore) - PostgreSQL store implementation.

Custom stores need to implement the [Store](https://godoc.org/github.com/swithek/sessionup#Store) interface to be used by the Manager.

## Limitations
sessionup offers server-only session storing and management, since the functionality to revoke/retrieve session not in the
Expand Down

0 comments on commit 30e84f0

Please sign in to comment.