A starting point for a Sinatra-Stormpath implementation for Heavybit, this is an extensible modular Sinatra application that can be further extended and wrapped around a full-fledged web application. Written by Frank Caron using the Stormpath Ruby SDK.
This demonstrative implementation has been written as a starting point for Heavybit's proposed projects which are implementing Stormpath in a Sinatra environment.
The following capabilities have been implemented:
- Account creation
- Authentication
- Password Reset
- Sinatra-centric, modular protected resource structure
This readme assumes that you have already set up a developer account with Stormpath and know how to retrieve your API key and your application URL. If you don't know how to do this, refer to Stormpath's REST Quickstart Guide
-
Clone the repository to your local machine.
-
Navigate to the cloned directory via the command line.
-
Run
bundle install
to install the dependencies. -
Set the following environment variables (e.g., on OS X,
nano ~/.bash_profile
from the terminal):export STORMPATH_API_KEY_FILE_LOCATION=~/.stormpath/apiKey.properties export STORMPATH_APPLICATION_URL=http://yourappurlhere
-
Configure the password reset page on your directory within the Stormpath API Console to use the following URL for its Password Reset workflow (Directory > Workflows > Password Reset show link):
localhost:9292/accounts/recover
-
Run the app locally by running the following command from the repo root:
rackup config.ru
This impl relies on the following, which can all be installed from Rubygems.org using gem install
individually or by via bundle
.
- Ruby (latest)
- Stormpath SDK (v. 1.0.0.beta2)
- Sinatra
- Thin
If needed, additional to do's include:
- Access Control (groups)
- Profile editing
Code provided as-is. No warranty, not guaranteed by anyone for anything other than being an example.