Oct 25th, 2012, 11:36 AM
Persisting oAuth credentials for an integration user in Spring (Heroku/cloudfoundry)
I have written a Spring MVC app that uploads files to my dropbox account.
I authenticate my Spring app with dropbox using oAuth once, at start up, using a specific Dropbox account which I'm using as an integration user.
I have written a FileUploadService that wraps all the authentication and upload logic. I use @autowire to use that service in my controllers/service layer.
I need to persist my oAuth credentials, so that I can restart my app without having to do that oAuth dance every time.
I'm looking for guidance on how to implement this in a clean way. I plan to deploy this app to heroku (and possibly move to cloudfoundry when that is GA) so local file storage is not an option AFAIK.
I can use postgresql to persist the credentials, but as they are static values, I'm not sure of the best approach to persist those JPA.
I think the crux of my question is how do I persist state of a singleton, but I don't want to scope the question so specifically, in case there are better approaches.