stormpath-rails 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +31 -2
- data/CHANGELOG.md +12 -1
- data/Gemfile +1 -0
- data/README.md +25 -3
- data/app/controllers/stormpath/rails/id_site_login/new_controller.rb +57 -0
- data/app/controllers/stormpath/rails/id_site_logout/new_controller.rb +19 -0
- data/app/controllers/stormpath/rails/login/new_controller.rb +10 -1
- data/app/controllers/stormpath/rails/logout/create_controller.rb +1 -20
- data/app/controllers/stormpath/rails/register/new_controller.rb +10 -1
- data/app/services/stormpath/rails/token_and_cookies_cleaner.rb +36 -0
- data/app/views/stormpath/rails/forgot_password/new.html.erb +3 -1
- data/app/views/stormpath/rails/login/_form.html.erb +6 -1
- data/app/views/stormpath/rails/register/_form.html.erb +1 -1
- data/app/views/stormpath/rails/register/new.html.erb +3 -1
- data/app/views/stormpath/rails/verify_email/new.html.erb +3 -1
- data/keypair.enc +0 -0
- data/lib/generators/stormpath/migration/migration_generator.rb +14 -0
- data/lib/generators/stormpath/migration/templates/stormpath.rake +75 -0
- data/lib/generators/stormpath/views/USAGE +0 -0
- data/lib/stormpath/rails/config/dynamic_configuration.rb +10 -0
- data/lib/stormpath/rails/configuration.rb +1 -0
- data/lib/stormpath/rails/router.rb +10 -2
- data/lib/stormpath/rails/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db6a4d230306b6c5faf0906c6bdb1f7369ce5a57
|
4
|
+
data.tar.gz: 6c392883dcfb9608965a6e5866b5a291be4d26b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5e85671ba7ab1768a3d88abb6bc2d1d2d33645389323ba49bb84c686fad51fc768ad5131ae3a8f8280d0e47bc4a3704335648fc17c6a1a2408b745d3a54e363
|
7
|
+
data.tar.gz: 32f1cc547828bbf8212fc8f92eea53e7ead58732d112d79e100537cfec5359ad1a5c06c26a6c26af258d916d953cda07f8b9ad8dc2088ee866fe89dc287e3f4d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,8 +1,37 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
3
|
+
- 2.1.5
|
4
4
|
before_install:
|
5
|
-
|
5
|
+
- openssl aes-256-cbc -K $encrypted_57ed81c5c9ab_key -iv $encrypted_57ed81c5c9ab_iv
|
6
|
+
-in keypair.enc -out ~/.ssh/id_rsa -d
|
7
|
+
- chmod 600 ~/.ssh/id_rsa
|
8
|
+
- git config --global user.email "evangelists@stormpath.com"
|
9
|
+
- git config --global user.name "stormpath-rails documentation"
|
10
|
+
install:
|
11
|
+
- gem install bundler
|
12
|
+
- bundle install --jobs=3 --retry=3
|
13
|
+
- pip install --user sphinx
|
14
|
+
script:
|
15
|
+
- travis_retry rake
|
16
|
+
# - cd docs
|
17
|
+
# - make html
|
18
|
+
# - cd ..
|
19
|
+
after_success:
|
20
|
+
- CURRENT_HASH=`git rev-parse HEAD`
|
21
|
+
- RELEASE_VERSION=`git tag | xargs -I@ git log --format=format:"%ai @%n" -1 @ | sort | awk '{print $4}' | tail -n 1`
|
22
|
+
- RELEASE_HASH=`git rev-list $RELEASE_VERSION -n 1`
|
23
|
+
- if [ "$CURRENT_HASH" = "$RELEASE_HASH" ]; then DEPLOY_DOCS=true; fi
|
24
|
+
#- test -z "$DEPLOY_DOCS" || git clone git@github.com:stormpath/stormpath.github.io.git
|
25
|
+
#- test -z "$DEPLOY_DOCS" || cd stormpath.github.io
|
26
|
+
#- test -z "$DEPLOY_DOCS" || git fetch origin source:source
|
27
|
+
#- test -z "$DEPLOY_DOCS" || git checkout source
|
28
|
+
#- test -z "$DEPLOY_DOCS" || mkdir -p source/ruby/rails
|
29
|
+
#- test -z "$DEPLOY_DOCS" || rm -rf source/ruby/rails/latest
|
30
|
+
#- test -z "$DEPLOY_DOCS" || cp -r ../docs/_build/html source/ruby/rails/latest
|
31
|
+
#- test -z "$DEPLOY_DOCS" || cp -r ../docs/_build/html source/ruby/rails/$RELEASE_VERSION
|
32
|
+
#- test -z "$DEPLOY_DOCS" || git add --all
|
33
|
+
#- test -z "$DEPLOY_DOCS" || git commit -m "stormpath-rails release $RELEASE_VERSION"
|
34
|
+
#- test -z "$DEPLOY_DOCS" || git push origin source
|
6
35
|
env:
|
7
36
|
global:
|
8
37
|
- STORMPATH_APPLICATION_URL=https://api.stormpath.com/v1/applications/3nZlLKVMIOPu71YC7TFR0o
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
Stormpath Rails Changelog
|
2
2
|
============================
|
3
3
|
|
4
|
-
Version 2.0
|
4
|
+
Version 2.1.0
|
5
5
|
-------------
|
6
|
+
Released on Nov 02, 2016
|
7
|
+
- Create script for generating a rake task responsible for transferring users from devise to Stormpath
|
8
|
+
- Implement ID Site Authentication
|
9
|
+
|
10
|
+
|
11
|
+
Version 2.0.2
|
12
|
+
-------------
|
13
|
+
Released on Aug 29, 2016
|
14
|
+
- Render path links depending on the configuration
|
15
|
+
- Use Faker to generate random test data
|
16
|
+
- Rename all user instances to account
|
6
17
|
|
7
18
|
Released on Aug 22, 2016
|
8
19
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Add the stormpath-rails integration gem to your Gemfile.
|
|
17
17
|
Stormpath is currently in beta so it is necessary to include the gem version:
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
gem 'stormpath-rails', '~> 2.
|
20
|
+
gem 'stormpath-rails', '~> 2.1.0'
|
21
21
|
```
|
22
22
|
|
23
23
|
Bundle the Gemfile
|
@@ -101,7 +101,7 @@ stormpath:
|
|
101
101
|
|
102
102
|
Stormpath Rails responds to two formats: HTML & JSON. You can use it both as an API for building SPA's, mobile applications and as a standalone Rails application that renders HTML.
|
103
103
|
|
104
|
-
By default the Stormpath integration will respond to JSON and HTML requests.
|
104
|
+
By default the Stormpath integration will respond to JSON and HTML requests.
|
105
105
|
If a requested type isn't any of the two, the Stormpath integration will pass on the request, and allow the developer or Rails defaults to handle the response.
|
106
106
|
|
107
107
|
However if you want use only one of those, modify the configuration file:
|
@@ -146,7 +146,7 @@ and update the routes to point to your new controller:
|
|
146
146
|
|
147
147
|
```ruby
|
148
148
|
Rails.application.routes.draw do
|
149
|
-
stormpath_rails_routes(actions: {
|
149
|
+
stormpath_rails_routes(actions: {
|
150
150
|
'register#create' => 'create_account#call'
|
151
151
|
})
|
152
152
|
end
|
@@ -206,6 +206,28 @@ stormpath/rails/shared/_input.html.erb
|
|
206
206
|
stormpath/rails/verify_email/new.html.erb
|
207
207
|
```
|
208
208
|
|
209
|
+
## Migrate Devise Account information to Stormpath
|
210
|
+
|
211
|
+
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
|
212
|
+
rake task that you can create in your codebase by running:
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
rails generate stormpath:migration
|
216
|
+
```
|
217
|
+
|
218
|
+
This will create a rake task that has the most common use cases for transferring user data into Stormpath:
|
219
|
+
|
220
|
+
```
|
221
|
+
lib/tasks/stormpath.rake
|
222
|
+
```
|
223
|
+
|
224
|
+
When you're finished modifying the rake task (minimum required modification: `directory href` and `devise model` that holds the data)
|
225
|
+
execute it with:
|
226
|
+
|
227
|
+
```ruby
|
228
|
+
rake stormpath:migrate
|
229
|
+
```
|
230
|
+
|
209
231
|
## Development
|
210
232
|
|
211
233
|
### Prerequisites
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Stormpath
|
2
|
+
module Rails
|
3
|
+
module IdSiteLogin
|
4
|
+
class NewController < BaseController
|
5
|
+
before_action :require_no_authentication!
|
6
|
+
|
7
|
+
def call
|
8
|
+
begin
|
9
|
+
result = Stormpath::Rails::Client.application.handle_id_site_callback(request.url)
|
10
|
+
account = Stormpath::Rails::Client.client.accounts.get(result.account_href)
|
11
|
+
login_the_account(account)
|
12
|
+
respond_with_success(account)
|
13
|
+
rescue Stormpath::Error, JWT::VerificationError => error
|
14
|
+
respond_with_error(error)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def login_the_account(account)
|
21
|
+
AccountLoginWithStormpathToken.new(
|
22
|
+
cookies, account,
|
23
|
+
Stormpath::Rails::Client.application,
|
24
|
+
Stormpath::Rails::Client.client.data_store.api_key
|
25
|
+
).call
|
26
|
+
end
|
27
|
+
|
28
|
+
def respond_with_success(account)
|
29
|
+
respond_to do |format|
|
30
|
+
format.html { redirect_to login_redirect_route, notice: 'Successfully signed in' }
|
31
|
+
format.json { render json: AccountSerializer.to_h(account) }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def respond_with_error(error)
|
36
|
+
respond_to do |format|
|
37
|
+
format.html do
|
38
|
+
flash.now[:error] = error.message
|
39
|
+
render stormpath_config.web.login.view
|
40
|
+
end
|
41
|
+
format.json do
|
42
|
+
render json: { message: error.message }, status: error.try(:status)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def login_redirect_route
|
48
|
+
if params[:next]
|
49
|
+
URI(params[:next]).path
|
50
|
+
else
|
51
|
+
stormpath_config.web.login.next_uri
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Stormpath
|
2
|
+
module Rails
|
3
|
+
module IdSiteLogout
|
4
|
+
class NewController < BaseController
|
5
|
+
def call
|
6
|
+
TokenAndCookiesCleaner.new(cookies).remove
|
7
|
+
redirect_to callback_url
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def callback_url
|
13
|
+
Stormpath::Rails::Client.application.create_id_site_url(callback_uri: root_url,
|
14
|
+
logout: true)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -6,7 +6,7 @@ module Stormpath
|
|
6
6
|
|
7
7
|
def call
|
8
8
|
if stormpath_config.web.id_site.enabled
|
9
|
-
redirect_to
|
9
|
+
redirect_to callback_url
|
10
10
|
else
|
11
11
|
respond_to do |format|
|
12
12
|
format.json { render json: LoginNewSerializer.to_h }
|
@@ -14,6 +14,15 @@ module Stormpath
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def callback_url
|
21
|
+
Stormpath::Rails::Client.application.create_id_site_url(
|
22
|
+
callback_uri: id_site_result_url,
|
23
|
+
path: Stormpath::Rails.config.web.id_site.login_uri
|
24
|
+
)
|
25
|
+
end
|
17
26
|
end
|
18
27
|
end
|
19
28
|
end
|
@@ -8,8 +8,7 @@ module Stormpath
|
|
8
8
|
if bearer_authorization_header?
|
9
9
|
DeleteAccessToken.call(bearer_access_token)
|
10
10
|
else
|
11
|
-
|
12
|
-
delete_cookies
|
11
|
+
TokenAndCookiesCleaner.new(cookies).remove
|
13
12
|
end
|
14
13
|
respond_with_success
|
15
14
|
end
|
@@ -28,24 +27,6 @@ module Stormpath
|
|
28
27
|
request.headers['Authorization']
|
29
28
|
end
|
30
29
|
|
31
|
-
def delete_tokens
|
32
|
-
DeleteAccessToken.call(cookies[access_token_cookie_name])
|
33
|
-
DeleteRefreshToken.call(cookies[refresh_token_cookie_name])
|
34
|
-
end
|
35
|
-
|
36
|
-
def delete_cookies
|
37
|
-
cookies.delete(access_token_cookie_name)
|
38
|
-
cookies.delete(refresh_token_cookie_name)
|
39
|
-
end
|
40
|
-
|
41
|
-
def access_token_cookie_name
|
42
|
-
stormpath_config.web.access_token_cookie.name
|
43
|
-
end
|
44
|
-
|
45
|
-
def refresh_token_cookie_name
|
46
|
-
stormpath_config.web.refresh_token_cookie.name
|
47
|
-
end
|
48
|
-
|
49
30
|
def respond_with_success
|
50
31
|
respond_to do |format|
|
51
32
|
format.html do
|
@@ -4,7 +4,7 @@ module Stormpath
|
|
4
4
|
class NewController < BaseController
|
5
5
|
def call
|
6
6
|
if stormpath_config.web.id_site.enabled
|
7
|
-
redirect_to
|
7
|
+
redirect_to callback_url
|
8
8
|
elsif signed_in?
|
9
9
|
redirect_to root_path
|
10
10
|
else
|
@@ -14,6 +14,15 @@ module Stormpath
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def callback_url
|
21
|
+
Stormpath::Rails::Client.application.create_id_site_url(
|
22
|
+
callback_uri: id_site_result_url,
|
23
|
+
path: Stormpath::Rails.config.web.id_site.register_uri
|
24
|
+
)
|
25
|
+
end
|
17
26
|
end
|
18
27
|
end
|
19
28
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Stormpath
|
2
|
+
module Rails
|
3
|
+
class TokenAndCookiesCleaner
|
4
|
+
attr_reader :cookies
|
5
|
+
|
6
|
+
def initialize(cookies)
|
7
|
+
@cookies = cookies
|
8
|
+
end
|
9
|
+
|
10
|
+
def remove
|
11
|
+
delete_tokens
|
12
|
+
delete_cookies
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def delete_tokens
|
18
|
+
DeleteAccessToken.call(cookies[access_token_cookie_name])
|
19
|
+
DeleteRefreshToken.call(cookies[refresh_token_cookie_name])
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete_cookies
|
23
|
+
cookies.delete(access_token_cookie_name)
|
24
|
+
cookies.delete(refresh_token_cookie_name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def access_token_cookie_name
|
28
|
+
Stormpath::Rails.config.web.access_token_cookie.name
|
29
|
+
end
|
30
|
+
|
31
|
+
def refresh_token_cookie_name
|
32
|
+
Stormpath::Rails.config.web.refresh_token_cookie.name
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -37,7 +37,9 @@
|
|
37
37
|
<% end %>
|
38
38
|
</div>
|
39
39
|
</div>
|
40
|
-
|
40
|
+
<% if Stormpath::Rails.config.web.login.enabled %>
|
41
|
+
<%= link_to "Back to Log In", new_login_path, class: "forgot" %>
|
42
|
+
<% end %>
|
41
43
|
</div>
|
42
44
|
</div>
|
43
45
|
</div>
|
@@ -17,7 +17,12 @@
|
|
17
17
|
<% case params[:status] %>
|
18
18
|
<% when 'unverified' %>
|
19
19
|
<div class="alert alert-success">
|
20
|
-
|
20
|
+
<% if Stormpath::Rails.config.web.verify_email.enabled %>
|
21
|
+
<p>
|
22
|
+
Your account verification email has been sent! Before you can log into your account, you need to activate your account by clicking the link we sent to your inbox. Didn't get the email?
|
23
|
+
<%= link_to "Click Here", new_verify_email_path %>
|
24
|
+
</p>
|
25
|
+
<% end %>
|
21
26
|
</div>
|
22
27
|
<% when 'verified' %>
|
23
28
|
<div class="alert alert-success">
|
@@ -14,6 +14,6 @@
|
|
14
14
|
<%= render 'stormpath/rails/shared/input', form: form, input_config: Stormpath::Rails.config.web.register.form.fields.send(field), input_name: field.to_s.camelize(:lower), value: params[field.to_s.camelize(:lower)] %>
|
15
15
|
<% end %>
|
16
16
|
|
17
|
-
<%= button_tag "Create Account", :
|
17
|
+
<%= button_tag "Create Account", class: "btn btn-register btn-sp-green", type: "submit" %>
|
18
18
|
<% end %>
|
19
19
|
</div>
|
@@ -4,7 +4,9 @@
|
|
4
4
|
<div class="box row">
|
5
5
|
<%= render partial: 'stormpath/rails/register/form' %>
|
6
6
|
</div>
|
7
|
-
|
7
|
+
<% if Stormpath::Rails.config.web.login.enabled %>
|
8
|
+
<%= link_to "Back to Log In", new_login_path, class: "to-login" %>
|
9
|
+
<% end %>
|
8
10
|
</div>
|
9
11
|
</div>
|
10
12
|
</div>
|
@@ -43,7 +43,9 @@
|
|
43
43
|
<% end %>
|
44
44
|
</div>
|
45
45
|
</div>
|
46
|
-
|
46
|
+
<% if Stormpath::Rails.config.web.login.enabled %>
|
47
|
+
<%= link_to "Back to Log In", new_login_path, class: "forgot" %>
|
48
|
+
<% end %>
|
47
49
|
</div>
|
48
50
|
</div>
|
49
51
|
</div>
|
data/keypair.enc
ADDED
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module Stormpath
|
4
|
+
module Generators
|
5
|
+
class MigrationGenerator < ::Rails::Generators::Base
|
6
|
+
include ::Rails::Generators::Migration
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
def create_migration_script
|
10
|
+
copy_file 'stormpath.rake', 'lib/tasks/stormpath.rake'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
namespace :stormpath do
|
2
|
+
desc 'Migrate devise data to Stormpath'
|
3
|
+
task migrate: :environment do
|
4
|
+
# This is the migration script used for transferring users from your database to Stormpath.
|
5
|
+
# You can tailor it by your needs from the examples below.
|
6
|
+
# If you need different or additional specifications you can read our documentation:
|
7
|
+
# https://docs.stormpath.com/ruby/product-guide/latest/accnt_mgmt.html
|
8
|
+
|
9
|
+
# ==============================================================
|
10
|
+
# Use an exhisting directory for storing your users
|
11
|
+
# Paste your directory href below.
|
12
|
+
# ==============================================================
|
13
|
+
|
14
|
+
directory_href = 'https://api.stormpath.com/v1/directories/4BjHtySIVQ8iwz96rguEE1'
|
15
|
+
directory = Stormpath::Rails::Client.client.directories.get(directory_href)
|
16
|
+
|
17
|
+
# ==============================================================
|
18
|
+
# Migrate the users - this is the default approach (DEVISE) to migrating users from your db
|
19
|
+
# to Stormpath without the registration workflow.
|
20
|
+
# Hovewer, you can change it depending on your needs.
|
21
|
+
# https://docs.stormpath.com/ruby/product-guide/latest/accnt_mgmt.html#importing-accounts
|
22
|
+
# ==============================================================
|
23
|
+
|
24
|
+
User.all.find_each do |user|
|
25
|
+
directory.accounts.create(
|
26
|
+
{ username: "rex#{user.id}",
|
27
|
+
email: user.email,
|
28
|
+
given_name: 'Captain',
|
29
|
+
middle_name: '12345',
|
30
|
+
surname: 'Rex',
|
31
|
+
password: user.encrypted_password },
|
32
|
+
password_format: 'mcf'
|
33
|
+
)
|
34
|
+
puts "#{user.email} migrated to Stormpath directory: #{directory.name}"
|
35
|
+
end
|
36
|
+
|
37
|
+
# ==============================================================
|
38
|
+
# Create a new application in which you'll be storing your users
|
39
|
+
# ==============================================================
|
40
|
+
|
41
|
+
# application = Stormpath::Rails::Client.client.applications.create(name: 'Devise import',
|
42
|
+
# description: 'Devise')
|
43
|
+
# directory = Stormpath::Rails::Client.client.directories.create(name: 'devise import',
|
44
|
+
# description: 'devise import'
|
45
|
+
# => Map the two together
|
46
|
+
# Stormpath::Rails::Client.client.account_store_mappings.create(
|
47
|
+
# application: application,
|
48
|
+
# account_store: directory,
|
49
|
+
# list_index: 0,
|
50
|
+
# is_default_account_store: true,
|
51
|
+
# is_default_group_store: false
|
52
|
+
# )
|
53
|
+
|
54
|
+
# ==============================================================
|
55
|
+
# Store Additional User Information as Custom Data
|
56
|
+
# https://docs.stormpath.com/ruby/product-guide/latest/accnt_mgmt.html#how-to-store-additional-user-information-as-custom-data
|
57
|
+
# ==============================================================
|
58
|
+
|
59
|
+
# User.all.find_each do |user|
|
60
|
+
# account = directory.accounts.create(
|
61
|
+
# { username: "rex#{user.id}",
|
62
|
+
# email: user.email,
|
63
|
+
# given_name: 'Jean-Luc',
|
64
|
+
# surname: 'Picard',
|
65
|
+
# password: user.encrypted_password,
|
66
|
+
# custom_data: {
|
67
|
+
# rank: 'Captain',
|
68
|
+
# favorite_drink: 'Earl Grey Tea'
|
69
|
+
# } },
|
70
|
+
# password_format: 'mcf'
|
71
|
+
# )
|
72
|
+
# puts "#{user.email} with custom data #{account.custom_data['favorite_drink']} migrated."
|
73
|
+
# end
|
74
|
+
end
|
75
|
+
end
|
File without changes
|
@@ -26,6 +26,11 @@ module Stormpath
|
|
26
26
|
password_reset_enabled?
|
27
27
|
end
|
28
28
|
|
29
|
+
def verify_email_enabled?
|
30
|
+
return false if static_config.stormpath.web.verify_email.enabled == false
|
31
|
+
email_verification_enabled?
|
32
|
+
end
|
33
|
+
|
29
34
|
private
|
30
35
|
|
31
36
|
def password_reset_enabled?
|
@@ -33,6 +38,11 @@ module Stormpath
|
|
33
38
|
default_account_store.password_policy.reset_email_status == 'ENABLED'
|
34
39
|
end
|
35
40
|
|
41
|
+
def email_verification_enabled?
|
42
|
+
return false if default_account_store.nil?
|
43
|
+
default_account_store.account_creation_policy.verification_email_status == 'ENABLED'
|
44
|
+
end
|
45
|
+
|
36
46
|
def default_account_store
|
37
47
|
@default_account_store ||=
|
38
48
|
app.default_account_store_mapping && app.default_account_store_mapping.account_store
|
@@ -26,6 +26,7 @@ module Stormpath
|
|
26
26
|
config.stormpath.application.href = dynamic_config.app.href
|
27
27
|
config.stormpath.web.forgot_password.enabled = dynamic_config.forgot_password_enabled?
|
28
28
|
config.stormpath.web.change_password.enabled = dynamic_config.change_password_enabled?
|
29
|
+
config.stormpath.web.verify_email.enabled = dynamic_config.verify_email_enabled?
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
@@ -15,7 +15,9 @@ module Stormpath
|
|
15
15
|
'oauth2#new' => 'stormpath/rails/oauth2/new#call',
|
16
16
|
'oauth2#create' => 'stormpath/rails/oauth2/create#call',
|
17
17
|
'verify_email#show' => 'stormpath/rails/verify_email/show#call',
|
18
|
-
'verify_email#create' => 'stormpath/rails/verify_email/create#call'
|
18
|
+
'verify_email#create' => 'stormpath/rails/verify_email/create#call',
|
19
|
+
'id_site_login#new' => 'stormpath/rails/id_site_login/new#call',
|
20
|
+
'id_site_logout#new' => 'stormpath/rails/id_site_logout/new#call'
|
19
21
|
}.freeze
|
20
22
|
|
21
23
|
def stormpath_rails_routes(actions: {})
|
@@ -63,9 +65,15 @@ module Stormpath
|
|
63
65
|
|
64
66
|
# VERIFY EMAIL
|
65
67
|
if Stormpath::Rails.config.web.verify_email.enabled
|
66
|
-
get Stormpath::Rails.config.web.verify_email.uri => actions['verify_email#show']
|
68
|
+
get Stormpath::Rails.config.web.verify_email.uri => actions['verify_email#show'], as: :new_verify_email
|
67
69
|
post Stormpath::Rails.config.web.verify_email.uri => actions['verify_email#create'], as: :verify_email
|
68
70
|
end
|
71
|
+
|
72
|
+
# ID SITE LOGIN
|
73
|
+
if Stormpath::Rails.config.web.id_site.enabled
|
74
|
+
get '/id_site_result' => actions['id_site_login#new'], as: :id_site_result
|
75
|
+
get '/logout_id_site' => actions['id_site_logout#new'], as: :logout_id_site
|
76
|
+
end
|
69
77
|
end
|
70
78
|
end
|
71
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stormpath-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nenad Nikolic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stormpath-sdk
|
@@ -115,6 +115,8 @@ files:
|
|
115
115
|
- app/controllers/stormpath/rails/change_password/new_controller.rb
|
116
116
|
- app/controllers/stormpath/rails/forgot_password/create_controller.rb
|
117
117
|
- app/controllers/stormpath/rails/forgot_password/new_controller.rb
|
118
|
+
- app/controllers/stormpath/rails/id_site_login/new_controller.rb
|
119
|
+
- app/controllers/stormpath/rails/id_site_logout/new_controller.rb
|
118
120
|
- app/controllers/stormpath/rails/login/create_controller.rb
|
119
121
|
- app/controllers/stormpath/rails/login/new_controller.rb
|
120
122
|
- app/controllers/stormpath/rails/logout/create_controller.rb
|
@@ -151,6 +153,7 @@ files:
|
|
151
153
|
- app/services/stormpath/rails/refresh_token_authentication.rb
|
152
154
|
- app/services/stormpath/rails/resend_email_verification.rb
|
153
155
|
- app/services/stormpath/rails/send_password_reset_email.rb
|
156
|
+
- app/services/stormpath/rails/token_and_cookies_cleaner.rb
|
154
157
|
- app/services/stormpath/rails/token_cookie_setter.rb
|
155
158
|
- app/services/stormpath/rails/verify_email_token.rb
|
156
159
|
- app/views/stormpath/rails/change_password/new.html.erb
|
@@ -168,8 +171,11 @@ files:
|
|
168
171
|
- bin/rspec
|
169
172
|
- bin/setup
|
170
173
|
- config/initializers/assets.rb
|
174
|
+
- keypair.enc
|
171
175
|
- lib/generators/stormpath/install/install_generator.rb
|
172
176
|
- lib/generators/stormpath/install/templates/default_config.yml
|
177
|
+
- lib/generators/stormpath/migration/migration_generator.rb
|
178
|
+
- lib/generators/stormpath/migration/templates/stormpath.rake
|
173
179
|
- lib/generators/stormpath/views/USAGE
|
174
180
|
- lib/generators/stormpath/views/views_generator.rb
|
175
181
|
- lib/stormpath-rails.rb
|
@@ -209,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
215
|
version: '0'
|
210
216
|
requirements: []
|
211
217
|
rubyforge_project:
|
212
|
-
rubygems_version: 2.
|
218
|
+
rubygems_version: 2.6.6
|
213
219
|
signing_key:
|
214
220
|
specification_version: 4
|
215
221
|
summary: Stormpath Rails integration
|