RangelReale/osin — pull request #21 by RangelReale (2014-06-26 12:29:54+00:00)
Title: BREAKING CHANGES proposal, please review

I am proposing these breaking changes, that should improve the interface of the library. If you are using the library, please review these and comment if you see any trouble with them.

* Change Client to be an interface (allows more secure Secret Handling)
* Add Clone and Close methods to Storage (for storages that need to be cloned each call, e.g. mgo)
* Add Close method to Response and required it to be closed with defer on use (to cleanup the Storage)

* BREAKING CHANGES:
- Storage interface has 2 new methods, Clone and Close, to better support storages
that need to clone / close in each connection (mgo)
- Client was changed to be an interface instead of an struct. Because of that,
the Storage interface also had to change, as interface is already a pointer.

- HOW TO FIX YOUR CODE:
+ In your Storage, add a Clone function returning itself, and a do nothing Close.
+ In your Storage, replace all *osin.Client with osin.Client (remove the pointer reference)
+ If you used the osin.Client struct directly in your code, change it to osin.DefaultClient,
which is a struct with the same fields that implements the interface.
+ Change all accesses using osin.Client to use the methods instead of the fields directly.
+ You MUST defer Response.Close in all your http handlers, otherwise some
Storages may not clean correctly.

resp := server.NewResponse()
defer resp.Close()