stormpath-rails 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.md +11 -0
  6. data/README.md +1 -1
  7. data/app/controllers/stormpath/rails/register/create_controller.rb +1 -1
  8. data/docs/Makefile +225 -0
  9. data/docs/_static/facebook-new-project.png +0 -0
  10. data/docs/_static/facebook-url-settings.png +0 -0
  11. data/docs/_static/forgot-change.png +0 -0
  12. data/docs/_static/forgot-complete.png +0 -0
  13. data/docs/_static/forgot-email-sent.png +0 -0
  14. data/docs/_static/forgot-email.png +0 -0
  15. data/docs/_static/forgot-init.png +0 -0
  16. data/docs/_static/forgot.png +0 -0
  17. data/docs/_static/github_create_app.png +0 -0
  18. data/docs/_static/google-enable-login.png +0 -0
  19. data/docs/_static/google-new-project.png +0 -0
  20. data/docs/_static/google-oauth-settings.png +0 -0
  21. data/docs/_static/id-site-login.png +0 -0
  22. data/docs/_static/id-site-settings.png +0 -0
  23. data/docs/_static/id-site-stormpath-config.png +0 -0
  24. data/docs/_static/linkedin-add-authorized-urls.gif +0 -0
  25. data/docs/_static/linkedin-add-permissions.gif +0 -0
  26. data/docs/_static/linkedin-new-application.gif +0 -0
  27. data/docs/_static/linkedin-permissions-page.png +0 -0
  28. data/docs/_static/login-page-basic.png +0 -0
  29. data/docs/_static/login-page-facebook-permissions.png +0 -0
  30. data/docs/_static/login-page-facebook.png +0 -0
  31. data/docs/_static/login-page-google-account.png +0 -0
  32. data/docs/_static/login-page-google.png +0 -0
  33. data/docs/_static/login-page-linkedin.png +0 -0
  34. data/docs/_static/login-page.png +0 -0
  35. data/docs/_static/login_page_with_all_providers.png +0 -0
  36. data/docs/_static/registration-page-basic.png +0 -0
  37. data/docs/_static/registration-page-error.png +0 -0
  38. data/docs/_static/registration-page.png +0 -0
  39. data/docs/_static/verification-complete.png +0 -0
  40. data/docs/_static/verification-email.png +0 -0
  41. data/docs/_static/verification.png +0 -0
  42. data/docs/_templates/layout.html +6 -0
  43. data/docs/about.rst +72 -0
  44. data/docs/authentication.rst +332 -0
  45. data/docs/changelog.rst +41 -0
  46. data/docs/conf.py +346 -0
  47. data/docs/configuration.rst +151 -0
  48. data/docs/contributors.rst +56 -0
  49. data/docs/devise_import.rst +112 -0
  50. data/docs/help.rst +24 -0
  51. data/docs/index.rst +31 -0
  52. data/docs/login.rst +242 -0
  53. data/docs/logout.rst +73 -0
  54. data/docs/password_reset.rst +85 -0
  55. data/docs/quickstart.rst +179 -0
  56. data/docs/registration.rst +364 -0
  57. data/docs/social_login.rst +409 -0
  58. data/docs/templates.rst +100 -0
  59. data/docs/user_data.rst +216 -0
  60. data/lib/stormpath/rails/version.rb +1 -1
  61. data/stormpath-rails.gemspec +1 -1
  62. metadata +57 -4
data/docs/conf.py ADDED
@@ -0,0 +1,346 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Stormpath Rails Documentation documentation build configuration file, created by
4
+ # sphinx-quickstart on Tue Sep 20 12:56:07 2016.
5
+ #
6
+ # This file is execfile()d with the current directory set to its
7
+ # containing dir.
8
+ #
9
+ # Note that not all possible configuration values are present in this
10
+ # autogenerated file.
11
+ #
12
+ # All configuration values have a default; values that are commented out
13
+ # serve to show the default.
14
+
15
+ # If extensions (or modules to document with autodoc) are in another directory,
16
+ # add these directories to sys.path here. If the directory is relative to the
17
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
18
+ #
19
+ # import os
20
+ # import sys
21
+ # sys.path.insert(0, os.path.abspath('.'))
22
+
23
+ # -- General configuration ------------------------------------------------
24
+
25
+ # If your documentation needs a minimal Sphinx version, state it here.
26
+ #
27
+ # needs_sphinx = '1.0'
28
+ # Add any Sphinx extension module names here, as strings. They can be
29
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
30
+ # ones.
31
+ extensions = [
32
+ 'sphinx.ext.autodoc',
33
+ 'sphinx.ext.doctest',
34
+ 'sphinx.ext.intersphinx',
35
+ 'sphinx.ext.todo',
36
+ 'sphinx.ext.coverage',
37
+ 'sphinx.ext.imgmath',
38
+ 'sphinx.ext.ifconfig',
39
+ 'sphinx.ext.viewcode',
40
+ ]
41
+
42
+ # Add any paths that contain templates here, relative to this directory.
43
+ templates_path = ['_templates']
44
+
45
+ # The suffix(es) of source filenames.
46
+ # You can specify multiple suffix as a list of string:
47
+ #
48
+ # source_suffix = ['.rst', '.md']
49
+ source_suffix = '.rst'
50
+
51
+ # The encoding of source files.
52
+ #
53
+ # source_encoding = 'utf-8-sig'
54
+
55
+ # The master toctree document.
56
+ master_doc = 'index'
57
+
58
+ # General information about the project.
59
+ project = u'Stormpath Rails Documentation'
60
+ copyright = u'2016, Stormpath, Inc.'
61
+
62
+ # The version info for the project you're documenting, acts as replacement for
63
+ # |version| and |release|, also used in various other places throughout the
64
+ # built documents.
65
+ #
66
+ # The short X.Y version.
67
+ version = u'0.1'
68
+ # The full version, including alpha/beta/rc tags.
69
+ release = u'0.1'
70
+
71
+ # The language for content autogenerated by Sphinx. Refer to documentation
72
+ # for a list of supported languages.
73
+ #
74
+ # This is also used if you do content translation via gettext catalogs.
75
+ # Usually you set "language" from the command line for these cases.
76
+ # language = None
77
+
78
+ # There are two options for replacing |today|: either, you set today to some
79
+ # non-false value, then it is used:
80
+ #
81
+ # today = ''
82
+ #
83
+ # Else, today_fmt is used as the format for a strftime call.
84
+ #
85
+ # today_fmt = '%B %d, %Y'
86
+
87
+ # List of patterns, relative to source directory, that match files and
88
+ # directories to ignore when looking for source files.
89
+ # This patterns also effect to html_static_path and html_extra_path
90
+ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
91
+
92
+ # The reST default role (used for this markup: `text`) to use for all
93
+ # documents.
94
+ #
95
+ # default_role = None
96
+
97
+ # If true, '()' will be appended to :func: etc. cross-reference text.
98
+ #
99
+ # add_function_parentheses = True
100
+
101
+ # If true, the current module name will be prepended to all description
102
+ # unit titles (such as .. function::).
103
+ #
104
+ # add_module_names = True
105
+
106
+ # If true, sectionauthor and moduleauthor directives will be shown in the
107
+ # output. They are ignored by default.
108
+ #
109
+ # show_authors = False
110
+
111
+ # The name of the Pygments (syntax highlighting) style to use.
112
+ pygments_style = 'sphinx'
113
+
114
+ # A list of ignored prefixes for module index sorting.
115
+ # modindex_common_prefix = []
116
+
117
+ # If true, keep warnings as "system message" paragraphs in the built documents.
118
+ # keep_warnings = False
119
+
120
+ # If true, `todo` and `todoList` produce output, else they produce nothing.
121
+ # todo_include_todos = True
122
+
123
+
124
+ # -- Options for HTML output ----------------------------------------------
125
+
126
+ # The theme to use for HTML and HTML Help pages. See the documentation for
127
+ # a list of builtin themes.
128
+ #
129
+ html_theme = 'stormpath'
130
+
131
+ # Theme options are theme-specific and customize the look and feel of a theme
132
+ # further. For a list of options available for each theme, see the
133
+ # documentation.
134
+ #
135
+ # html_theme_options = {}
136
+
137
+ # Add any paths that contain custom themes here, relative to this directory.
138
+ html_theme_path = ['_themes']
139
+
140
+ # The name for this set of Sphinx documents.
141
+ # "<project> v<release> documentation" by default.
142
+ #
143
+ # html_title = u'Stormpath Rails Documentation v0.1'
144
+
145
+ # A shorter title for the navigation bar. Default is the same as html_title.
146
+ #
147
+ # html_short_title = None
148
+
149
+ # The name of an image file (relative to this directory) to place at the top
150
+ # of the sidebar.
151
+ #
152
+ # html_logo = None
153
+
154
+ # The name of an image file (relative to this directory) to use as a favicon of
155
+ # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
156
+ # pixels large.
157
+ #
158
+ # html_favicon = None
159
+
160
+ # Add any paths that contain custom static files (such as style sheets) here,
161
+ # relative to this directory. They are copied after the builtin static files,
162
+ # so a file named "default.css" will overwrite the builtin "default.css".
163
+ html_static_path = ['_static']
164
+
165
+ # Add any extra paths that contain custom files (such as robots.txt or
166
+ # .htaccess) here, relative to this directory. These files are copied
167
+ # directly to the root of the documentation.
168
+ #
169
+ # html_extra_path = []
170
+
171
+ # If not None, a 'Last updated on:' timestamp is inserted at every page
172
+ # bottom, using the given strftime format.
173
+ # The empty string is equivalent to '%b %d, %Y'.
174
+ #
175
+ # html_last_updated_fmt = None
176
+ highlight_language = 'javascript'
177
+
178
+ # If true, SmartyPants will be used to convert quotes and dashes to
179
+ # typographically correct entities.
180
+ #
181
+ # html_use_smartypants = True
182
+
183
+ # Custom sidebar templates, maps document names to template names.
184
+ #
185
+ html_sidebars = {}
186
+
187
+ # Additional templates that should be rendered to pages, maps page names to
188
+ # template names.
189
+ #
190
+ # html_additional_pages = {}
191
+
192
+ # If false, no module index is generated.
193
+ #
194
+ # html_domain_indices = True
195
+
196
+ # If false, no index is generated.
197
+ #
198
+ # html_use_index = True
199
+
200
+ # If true, the index is split into individual pages for each letter.
201
+ #
202
+ # html_split_index = False
203
+
204
+ # If true, links to the reST sources are added to the pages.
205
+ #
206
+ # html_show_sourcelink = True
207
+
208
+ # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
209
+ #
210
+ # html_show_sphinx = True
211
+
212
+ # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
213
+ #
214
+ # html_show_copyright = True
215
+
216
+ # If true, an OpenSearch description file will be output, and all pages will
217
+ # contain a <link> tag referring to it. The value of this option must be the
218
+ # base URL from which the finished HTML is served.
219
+ #
220
+ # html_use_opensearch = ''
221
+
222
+ # This is the file name suffix for HTML files (e.g. ".xhtml").
223
+ # html_file_suffix = None
224
+
225
+ # Language to be used for generating the HTML full-text search index.
226
+ # Sphinx supports the following languages:
227
+ # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
228
+ # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
229
+ #
230
+ # html_search_language = 'en'
231
+
232
+ # A dictionary with options for the search language support, empty by default.
233
+ # 'ja' uses this config value.
234
+ # 'zh' user can custom change `jieba` dictionary path.
235
+ #
236
+ # html_search_options = {'type': 'default'}
237
+
238
+ # The name of a javascript file (relative to the configuration directory) that
239
+ # implements a search results scorer. If empty, the default will be used.
240
+ #
241
+ # html_search_scorer = 'scorer.js'
242
+
243
+ # Output file base name for HTML help builder.
244
+ htmlhelp_basename = 'Rails-Stormpathdoc'
245
+
246
+ # -- Options for LaTeX output ---------------------------------------------
247
+
248
+ latex_elements = {
249
+ # The paper size ('letterpaper' or 'a4paper').
250
+ #
251
+ # 'papersize': 'letterpaper',
252
+
253
+ # The font size ('10pt', '11pt' or '12pt').
254
+ #
255
+ # 'pointsize': '10pt',
256
+
257
+ # Additional stuff for the LaTeX preamble.
258
+ #
259
+ # 'preamble': '',
260
+
261
+ # Latex figure (float) alignment
262
+ #
263
+ # 'figure_align': 'htbp',
264
+ }
265
+
266
+ # Grouping the document tree into LaTeX files. List of tuples
267
+ # (source start file, target name, title,
268
+ # author, documentclass [howto, manual, or own class]).
269
+ latex_documents = [
270
+ (master_doc, 'Rails-Stormpath.tex', u'Rails-Stormpath Documentation',
271
+ u'Stormpath, Inc.', 'manual'),
272
+ ]
273
+
274
+ # The name of an image file (relative to this directory) to place at the top of
275
+ # the title page.
276
+ #
277
+ # latex_logo = None
278
+
279
+ # For "manual" documents, if this is true, then toplevel headings are parts,
280
+ # not chapters.
281
+ #
282
+ # latex_use_parts = False
283
+
284
+ # If true, show page references after internal links.
285
+ #
286
+ # latex_show_pagerefs = False
287
+
288
+ # If true, show URL addresses after external links.
289
+ #
290
+ # latex_show_urls = False
291
+
292
+ # Documents to append as an appendix to all manuals.
293
+ #
294
+ # latex_appendices = []
295
+
296
+ # It false, will not define \strong, \code, itleref, \crossref ... but only
297
+ # \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
298
+ # packages.
299
+ #
300
+ # latex_keep_old_macro_names = True
301
+
302
+ # If false, no module index is generated.
303
+ #
304
+ # latex_domain_indices = True
305
+
306
+
307
+ # -- Options for manual page output ---------------------------------------
308
+
309
+ # One entry per manual page. List of tuples
310
+ # (source start file, name, description, authors, manual section).
311
+ man_pages = [
312
+ ('index', 'rails-stormpath', u'Rails-Stormpath Documentation',
313
+ [u'Stormpath, Inc.'], 1)
314
+ ]
315
+
316
+ # If true, show URL addresses after external links.
317
+ #
318
+ # man_show_urls = False
319
+
320
+
321
+ # -- Options for Texinfo output -------------------------------------------
322
+
323
+ # Grouping the document tree into Texinfo files. List of tuples
324
+ # (source start file, target name, title, author,
325
+ # dir menu entry, description, category)
326
+ texinfo_documents = [
327
+ (master_doc, 'Rails-Stormpath', u'Rails-Stormpath Documentation',
328
+ u'Stormpath, Inc.', 'Rails-Stormpath', 'One line description of project.',
329
+ 'Miscellaneous'),
330
+ ]
331
+
332
+ # Documents to append as an appendix to all manuals.
333
+ #
334
+ # texinfo_appendices = []
335
+
336
+ # If false, no module index is generated.
337
+ #
338
+ # texinfo_domain_indices = True
339
+
340
+ # How to display URL addresses: 'footnote', 'no', or 'inline'.
341
+ #
342
+ # texinfo_show_urls = 'footnote'
343
+
344
+ # If true, do not generate a @detailmenu in the "Top" node's menu.
345
+ #
346
+ # texinfo_no_detailmenu = False
@@ -0,0 +1,151 @@
1
+ .. _configuration:
2
+
3
+
4
+ Configuration
5
+ =============
6
+
7
+ This module provides several options that allow you to customize the authentication
8
+ features of your Rails application. We will cover the major options in this
9
+ section, and more specific options in later sections of this guide.
10
+
11
+ If you would like a list of all available options, please refer to the
12
+ `Web Configuration Defaults`_ file in the library. This YAML file has comments
13
+ which describe each option and the value represents the option default.
14
+
15
+
16
+ Environment Variables
17
+ ---------------------
18
+
19
+ It is a best practice to store confidential information in environment
20
+ variables (*don't hard-code it into your application*). You should store your
21
+ confidential Stormpath information in environment variables. You can do this
22
+ by running the following commands in the shell:
23
+
24
+ .. code-block:: bash
25
+
26
+ export STORMPATH_API_KEY_ID=YOUR_ID_HERE
27
+ export STORMPATH_API_KEY_SECRET=YOUR_SECRET_HERE
28
+ export STORMPATH_APPLICATION_URL=YOUR_APP_HREF
29
+
30
+ or by using any text editor and adding the environment variables to .bashrc (or .zshrc if you're using ohmyzsh)
31
+
32
+ .. note::
33
+ If you're on Windows, the command you need to use to set environment
34
+ variables is:
35
+
36
+ .. code-block:: bash
37
+
38
+ set STORMPATH_API_KEY_ID=YOUR_ID_HERE
39
+ set STORMPATH_API_KEY_SECRET=YOUR_SECRET_HERE
40
+ set STORMPATH_APPLICATION_URL=YOUR_APP_HREF
41
+
42
+ The examples above show you the 3 mandatory settings you need to configure to
43
+ make stormpath-rails work. These settings can be configured via environment
44
+ variables, or in a number of other ways.
45
+
46
+ .. note::
47
+
48
+ If you're using Heroku you don't need to specify the credentials or
49
+ your application -- these values will be automatically provided for you.
50
+
51
+ .. tip::
52
+
53
+ You might also want to check out
54
+ `autoenv <https://github.com/kennethreitz/autoenv>`_, a project that makes
55
+ working with environment variables simpler for Linux/Mac/BSD users.
56
+
57
+
58
+ Default Features
59
+ ----------------
60
+
61
+ When you add stormpath_rails_routes to your routes configuration file,
62
+ our module will automatically add the following routes to your application:
63
+
64
+ +--------------+-------------------------------------------------------------+---------------------------+
65
+ | URI | Purpose | Documentation |
66
+ +==============+=============================================================+===========================+
67
+ | /forgot | Request a password reset link. | :ref:`password_reset` |
68
+ +--------------+-------------------------------------------------------------+---------------------------+
69
+ | /login | Login to your application with username and password. | :ref:`login` |
70
+ +--------------+-------------------------------------------------------------+---------------------------+
71
+ | /logout | Accepts a POST request, and destroys the login session. | :ref:`logout` |
72
+ +--------------+-------------------------------------------------------------+---------------------------+
73
+ | /me | Returns a JSON representation of the current user. | :ref:`me_api` |
74
+ +--------------+-------------------------------------------------------------+---------------------------+
75
+ | /oauth/token | Issue OAuth2 access and refresh tokens. | :ref:`authentication` |
76
+ +--------------+-------------------------------------------------------------+---------------------------+
77
+ | /register | Create an account within your application. | :ref:`registration` |
78
+ +--------------+-------------------------------------------------------------+---------------------------+
79
+ | /reset | Reset an account password, from a password reset link. | :ref:`password_reset` |
80
+ +--------------+-------------------------------------------------------------+---------------------------+
81
+ | /verify | Verify a new account, from a email verification link. | :ref:`email_verification` |
82
+ +--------------+-------------------------------------------------------------+---------------------------+
83
+
84
+ Each feature has its own options, please refer to the documentation of each
85
+ feature. If you want to disable specific features, continue to the next
86
+ section.
87
+
88
+ Disabling Features
89
+ ------------------
90
+
91
+ We enable many features by default, but you might not want to use all of them.
92
+ For example, if you wanted to disable all the default features, you would use
93
+ this configuration:
94
+
95
+ .. code-block:: yaml
96
+
97
+ stormpath:
98
+ web:
99
+ login:
100
+ enabled: false
101
+ logout:
102
+ enabled: false
103
+ me:
104
+ enabled: false
105
+ oauth2:
106
+ enabled: false
107
+ register:
108
+ enabled: false
109
+
110
+
111
+
112
+ Stormpath Client Options
113
+ ------------------------
114
+
115
+ By using this gem you are able to instantiate a client object.
116
+ The Stormpath client is responsible for communicating with the Stormpath REST
117
+ API and is provided by the `Stormpath Ruby SDK`_. If you would like to work directly with the client in your Rails application,
118
+ you can fetch it from the app object like this:
119
+
120
+ .. code-block:: ruby
121
+
122
+ client = Stormpath::Rails::Client.client
123
+
124
+ The `client` object is also highly configurable through the use of the Ruby SDK. You can set how it is instantiated, custom caching options and the base URL for your enterprise application.
125
+ For more detail concerning the `client` object, please visit the `Ruby SDK Documentation`_.
126
+
127
+ Stormpath Application
128
+ ---------------------
129
+
130
+ When you configured Stormpath, you specified the Stormpath Application that you
131
+ want to use (you did this by providing the HREF of the application). This gem
132
+ will fetch the application and use it to perform all login, registration,
133
+ verification and password reset functions.
134
+
135
+ The Stormpath Application allows you to do a lot of other work, such as manually
136
+ creating accounts and modifying your OAuth policy - plus much more! If you want
137
+ to work with the Stormpath Application, you can reference its object like this:
138
+
139
+ .. code-block:: ruby
140
+
141
+ client = Stormpath::Rails::Client.client
142
+ application = client.applications.get(app_href)
143
+ application.accounts.create(account_attributes)
144
+
145
+ where *app_href* is your application URL from Stormpath that you stored in a environment variable.
146
+
147
+ .. _Web Configuration Defaults: https://github.com/stormpath/stormpath-rails/blob/master/lib/generators/stormpath/install/templates/default_config.yml
148
+ .. _Stormpath applications: https://api.stormpath.com/v#!applications
149
+ .. _Stormpath dashboard: https://api.stormpath.com/ui/dashboard
150
+ .. _Stormpath Ruby SDK: https://github.com/stormpath/stormpath-sdk-ruby
151
+ .. _Ruby SDK Documentation: https://docs.stormpath.com/ruby/product-guide/latest/configuration.html
@@ -0,0 +1,56 @@
1
+ .. _contributors:
2
+
3
+
4
+ Contributors
5
+ ============
6
+
7
+ This project is written by various people at `Stormpath`_, and many lovely
8
+ contributors.
9
+
10
+ Without contributors, this project would look vastly different from the glorious
11
+ project you see before you. At Stormpath, we *love* our contributors, and you
12
+ should too!
13
+
14
+ The fabulous, smart, beautiful, and absurdly intelligent people below are
15
+ directly responsible for making this project as awesome as it is today.
16
+
17
+ **NOTE**: If you are contributing code to this project, please add yourself to
18
+ the list below. Then send us `an email`_ with a link to your contribution and
19
+ your mailing address so we can ship you a swag bag! Thank you for your hard
20
+ work!
21
+
22
+
23
+ Developers
24
+ ----------
25
+
26
+ The people below have all contributed code to the project.
27
+
28
+
29
+ Nenad Nikolić
30
+ *************
31
+
32
+ Nenad worked on the project since the beginning and has contributed major features to the project.
33
+
34
+ - Github: https://github.com/nikone
35
+
36
+
37
+ Damir Svrtan
38
+ ************
39
+
40
+ Damir worked on the project since the beginning and has contributed major features to the project.
41
+
42
+ - Website: http://damir.svrtan.me/
43
+ - Github: https://github.com/DamirSvrtan
44
+ - Twitter: https://twitter.com/damirsvrtan
45
+
46
+
47
+ Marko Ćilimković
48
+ ****************
49
+
50
+ Marko has contributed major features and is currently working on the development of the project.
51
+
52
+ - Github: https://github.com/cilim
53
+ - Twitter: https://twitter.com/MarkoCilimkovic
54
+
55
+ .. _Stormpath: https://stormpath.com/
56
+ .. _an email: info@stormpath.com
@@ -0,0 +1,112 @@
1
+ .. _devise_import:
2
+
3
+
4
+ Import Data from Devise
5
+ =======================
6
+
7
+ If you already have a Rails application that uses devise and need to transfer all users, accounts, or however you named your model there's a nifty rake task that you can create in your codebase by running:
8
+
9
+ .. code-block:: sh
10
+
11
+ rails generate stormpath:migration
12
+
13
+ This will create a rake task that has the most common use cases for transferring user data into Stormpath that you can configure:
14
+
15
+ .. code-block:: sh
16
+
17
+ lib/tasks/stormpath.rake
18
+
19
+
20
+ Default Configuration
21
+ ----------------------
22
+
23
+ This configuration is for the simplest migrations, where the goal is to just transfer all account information from devise's User model into one existing directory:
24
+
25
+ .. code-block:: ruby
26
+
27
+ namespace :stormpath do
28
+ desc 'Migrate devise data to Stormpath'
29
+ task migrate: :environment do
30
+ directory_href = 'https://api.stormpath.com/v1/directories/4BjHtySIVQ8iwz96rguEE1'
31
+ directory = Stormpath::Rails::Client.client.directories.get(directory_href)
32
+
33
+ User.all.find_each do |user|
34
+ directory.accounts.create(
35
+ { username: "rex#{user.id}",
36
+ email: user.email,
37
+ given_name: 'Captain',
38
+ middle_name: '12345',
39
+ surname: 'Rex',
40
+ password: user.encrypted_password },
41
+ password_format: 'mcf'
42
+ )
43
+ puts "#{user.email} migrated to Stormpath directory: #{directory.name}"
44
+ end
45
+ end
46
+ end
47
+
48
+ This is the minimal configuration needed to execute the migration successfully. All you need to do is set your `directory_href` which you can find by logging into the `Stormpath Admin Console`_ and viewing the directory you want to transfer your users into.
49
+ Of course, make sure you use the correct name of the model for your users, accounts, members etc.
50
+
51
+
52
+ New Application and Directory
53
+ ------------------------------
54
+
55
+ You can also create a new application and directory in which you'll be storing your accounts, or, depending on account attributes, you could modify the script and migrate some accounts to one directory, and the rest to another.
56
+
57
+ .. code-block:: ruby
58
+
59
+ application = Stormpath::Rails::Client.client.applications.create(name: 'Devise import',
60
+ description: 'Devise')
61
+
62
+ directory = Stormpath::Rails::Client.client.directories.create(name: 'devise import',
63
+ description: 'devise import'
64
+
65
+ # => Map the two together
66
+ Stormpath::Rails::Client.client.account_store_mappings.create(
67
+ application: application,
68
+ account_store: directory,
69
+ list_index: 0,
70
+ is_default_account_store: true,
71
+ is_default_group_store: false
72
+ )
73
+
74
+
75
+ Custom Account Data
76
+ --------------------
77
+
78
+ If you have any custom user data that you need to keep stored on Stormpath, here's an example of how you can do that too:
79
+
80
+ .. code-block:: ruby
81
+
82
+ User.all.find_each do |user|
83
+ account = directory.accounts.create(
84
+ { username: "rex{user.id}",
85
+ email: user.email,
86
+ given_name: 'Jean-Luc',
87
+ surname: 'Picard',
88
+ password: user.encrypted_password,
89
+ custom_data: {
90
+ rank: 'Captain',
91
+ favorite_drink: 'Earl Grey Tea'
92
+ } },
93
+ password_format: 'mcf'
94
+ )
95
+ puts "#{user.email} with custom data #{account.custom_data['favorite_drink']} migrated."
96
+ end
97
+
98
+ For more information on account management, visit the `Account Management Chapter`_ or `Multitenancy Chapter`_.
99
+
100
+ Migration Process
101
+ ---------------------
102
+
103
+ When you're finished modifying the rake task execute it with:
104
+
105
+ .. code-block:: sh
106
+
107
+ rake stormpath:migrate
108
+
109
+
110
+ .. _Stormpath Admin Console: https://api.stormpath.com/login
111
+ .. _Account Management Chapter: https://docs.stormpath.com/ruby/product-guide/latest/accnt_mgmt.html
112
+ .. _Multitenancy Chapter: https://docs.stormpath.com/ruby/product-guide/latest/multitenancy.html
data/docs/help.rst ADDED
@@ -0,0 +1,24 @@
1
+ .. _help:
2
+
3
+
4
+ Getting Help
5
+ ============
6
+
7
+ Have a question you can't find an answer to? Things not working as expected?
8
+ We can help!
9
+
10
+ All of the official Stormpath client libraries (*including this one!*) are
11
+ officially supported by Stormpath's incredibly amazing-and-hip support team!
12
+
13
+ If you have a question, or need in-depth technical help, you can drop us an
14
+ email anytime: support@stormpath.com
15
+
16
+ If you visit our website (https://stormpath.com/), you can also click the "Chat
17
+ with us!" button near the bottom right of the page to chat with us live, in
18
+ real-time!
19
+
20
+ And lastly, we're always available via Twitter as well! We're `@gostormpath`_
21
+ on Twitter.
22
+
23
+
24
+ .. _@gostormpath: https://twitter.com/gostormpath