strongmind-auth 1.0.15 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1a86df146b5b48ff39388a216c4c6f04c64af68d805d181a406dbb50166c141
4
- data.tar.gz: c4993a26e025d3de3bfc756fe3e1d845a1ae802a0ed3231e112f0c43b2a922d4
3
+ metadata.gz: 75836642566646ba7a5100a9daedb353288906cf4fbfe229ff73d3217cc12797
4
+ data.tar.gz: 7907e3c46d657c5776edfd4fd4540b8643309607bee7a5dd616412f72f424e12
5
5
  SHA512:
6
- metadata.gz: f5eebbdeea7157d04ab238a5978a2a5ba443d7527521f7321bbf8cc5dfef3561a7f23f2918284896af902ab0191dc7666249f49b987d4b919b90977b32bf7d60
7
- data.tar.gz: 840b288e4be11809e7f528a1df36a803e5c108a2375ba6ac8d85a3740f8faa49e88b0f78b6d16d5dac8ef3abb06bb8baba558174b71b056a6f7e42e53282c8ae
6
+ metadata.gz: 21b444fbafe788e90b97da758d4bd6f0214764cf3910e1ec5b2765a8ac6a93422a92df009513231b6d1905b52a580b2d528eb47f06026b2b08400b35107bcfb8
7
+ data.tar.gz: 9fd3e496c494fa37c1a1602b7890c28f744e9510b3e4c74990df8b09a46e90e3cfcf90fa8b807e6e0c3299ba141b682926c10dfc2d58b9fe52469cd777c55583
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "bundler/setup"
2
2
 
3
- APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
3
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
4
  load "rails/tasks/engine.rake"
5
5
 
6
6
  load "rails/tasks/statistics.rake"
@@ -14,8 +14,8 @@ module StrongMindNav
14
14
  rescue Strongmind::Exceptions::TokenNotFoundError, Strongmind::Exceptions::UserNotFoundError => e
15
15
  Sentry.capture_exception(e)
16
16
  Rails.logger.error(e)
17
- flash[:alert] = e.inspect if Rails.env.development?
18
- @stop_redirect = true if Rails.env.development?
17
+ flash[:alert] = e.inspect if Rails.env.development? || Rails.env.test?
18
+ @stop_redirect = true if Rails.env.development? || Rails.env.test?
19
19
  render 'logins/index'
20
20
  rescue Exception => e
21
21
  Sentry.capture_exception(e)
@@ -1,18 +1,10 @@
1
1
  class UserBase < ApplicationRecord
2
- devise :database_authenticatable, :registerable,
3
- :recoverable, :rememberable, :validatable,
4
- :omniauthable, :omniauth_providers => %i[strongmind]
2
+ devise :database_authenticatable, :omniauthable, :omniauth_providers => %i[strongmind]
5
3
 
6
4
  self.table_name = 'users'
7
5
 
8
6
  def self.with_credentials(auth)
9
- email = auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress']
10
- user = User.where(uid: auth.uid).first
11
- if user.nil?
12
- user ||= User.create!(uid: auth.uid, email: email, password: Devise.friendly_token[0, 20])
13
- end
14
-
15
- user
7
+ User.find_or_create_by(uid: auth.uid)
16
8
  end
17
9
 
18
10
  def self.auth_token_cache=(auth)
@@ -28,7 +20,7 @@ class UserBase < ApplicationRecord
28
20
  def auth_token_cache
29
21
  Rails.cache.read(uid)
30
22
  end
31
-
23
+
32
24
  def authenticatable_salt
33
25
  return super unless session_token
34
26
 
@@ -16,16 +16,11 @@
16
16
  </style>
17
17
  <%= button_to 'Sign in with StrongMind', '/users/auth/strongmind', style: 'display:none' %>
18
18
  <script type="text/javascript">
19
- function submitForm() {
20
- document.forms[0].submit();
21
- }
22
-
23
19
  // Submit the form on load
24
20
  window.addEventListener("load", (event) => {
25
- <% if @stop_redirect %>
26
- return;
21
+ <% unless @stop_redirect %>
22
+ document.forms[0].submit();
27
23
  <% end %>
28
- submitForm();
29
24
  });
30
25
 
31
26
  </script>
@@ -1,6 +1,11 @@
1
1
  module Strongmind
2
2
  module Auth
3
3
  class Engine < ::Rails::Engine
4
+ config.generators do |g|
5
+ g.test_framework :rspec
6
+ g.fixture_replacement :factory_bot
7
+ g.factory_bot dir: 'spec/factories'
8
+ end
4
9
  end
5
10
  end
6
11
  end
@@ -1,5 +1,5 @@
1
1
  module Strongmind
2
2
  module Auth
3
- VERSION = "1.0.15"
3
+ VERSION = "1.0.17"
4
4
  end
5
5
  end
@@ -12,6 +12,9 @@ module Strongmind
12
12
  def initialize(user, request)
13
13
  raise Strongmind::Exceptions::UserNotFoundError, 'User not found' unless user.present?
14
14
  raise ArgumentError, 'Request not found' unless request.present?
15
+ raise ArgumentError, 'Identity base URL not found at IDENTITY_BASE_URL in environment' unless ENV['IDENTITY_BASE_URL'].present?
16
+ raise ArgumentError, 'Identity client ID not found at IDENTITY_CLIENT_ID in environment' unless ENV['IDENTITY_CLIENT_ID'].present?
17
+ raise ArgumentError, 'Identity client secret not found at IDENTITY_CLIENT_SECRET in environment' unless ENV['IDENTITY_CLIENT_SECRET'].present?
15
18
 
16
19
  @user = user
17
20
  @request = request
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Belding
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: factory_bot_rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description: Ruby gem for StrongMind authentication in a strongmind app
98
126
  email:
99
127
  - teambelding@strongmind.com