prx_auth-rails 4.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.git-blame-ignore-revs +2 -0
  3. data/.github/workflows/check-project-std.yml +23 -0
  4. data/Gemfile +1 -1
  5. data/Guardfile +5 -5
  6. data/Rakefile +3 -3
  7. data/app/controllers/prx_auth/rails/sessions_controller.rb +25 -14
  8. data/app/views/prx_auth/rails/sessions/auth_error.html.erb +0 -7
  9. data/app/views/prx_auth/rails/sessions/show.html.erb +4 -1
  10. data/config/initializers/assets.rb +1 -1
  11. data/config/routes.rb +3 -3
  12. data/lib/prx_auth/rails/configuration.rb +16 -14
  13. data/lib/prx_auth/rails/engine.rb +1 -1
  14. data/lib/prx_auth/rails/ext/controller.rb +23 -19
  15. data/lib/prx_auth/rails/railtie.rb +3 -3
  16. data/lib/prx_auth/rails/token.rb +17 -4
  17. data/lib/prx_auth/rails/version.rb +1 -1
  18. data/lib/prx_auth/rails.rb +3 -3
  19. data/prx_auth-rails.gemspec +25 -26
  20. data/test/dummy/app/controllers/application_controller.rb +3 -3
  21. data/test/dummy/app/mailers/application_mailer.rb +2 -2
  22. data/test/dummy/bin/rails +1 -1
  23. data/test/dummy/bin/setup +7 -7
  24. data/test/dummy/config/boot.rb +2 -2
  25. data/test/dummy/config/environments/development.rb +2 -2
  26. data/test/dummy/config/environments/production.rb +5 -5
  27. data/test/dummy/config/environments/test.rb +2 -2
  28. data/test/dummy/config/initializers/assets.rb +1 -1
  29. data/test/dummy/config/initializers/prx_auth.rb +7 -7
  30. data/test/dummy/config/routes.rb +2 -2
  31. data/test/prx_auth/rails/configuration_test.rb +15 -13
  32. data/test/prx_auth/rails/ext/controller_test.rb +87 -81
  33. data/test/prx_auth/rails/sessions_controller_test.rb +39 -39
  34. data/test/prx_auth/rails/token_test.rb +44 -16
  35. data/test/prx_auth/rails_test.rb +11 -12
  36. data/test/test_helper.rb +15 -17
  37. metadata +21 -68
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1eed8329985438f59a1adc529c8e33748cbfca9becbd285475385c16b25639e6
4
- data.tar.gz: 0a065d8fdf1e4d077fdd43da82cc37c3110ada401d31e6eadb5e154ae7001c6f
3
+ metadata.gz: 297ff153a8884223afeca8d74d809f965e297e1766acf522ef442070d35682ab
4
+ data.tar.gz: 97af5447b5a9d5449a289f055680c42b7c213503f3ba3fa4af4825f9083da479
5
5
  SHA512:
6
- metadata.gz: 9f45b17435edca7e49910164e330eea45df6c466514b700af6f04182e7df99748d3978911cd777325fb9142e4e9f0e1723bec10917eeea8c04b54b4c98c521b1
7
- data.tar.gz: 1dffecbaef3bf75a75759f6312a9acfb3442e5a6ff7b4354abc9e8b19816618f5fe57fd515317cfa03eaf7da0b231c2489b30c3a1f1aab2eca93f9a3e3b17d6b
6
+ metadata.gz: 32017811c9336ecdfc7e93196918ebbed6fa04c6616c0f36453319c3bdc2c4caa309fe47b3fc40573ab206efee375193867ca36a0466b0366a6980d0d2761e1f
7
+ data.tar.gz: 578ed2609ec2213d5bbb8397cdf2fabc82b71e43e59b26128df26bd6075a219712ecd15ec23143f4ef54903cfb02f5bd7afb8140cb8ff35323213880c5b3d95b
@@ -0,0 +1,2 @@
1
+ # 2023-04-12 Auto-fix all Ruby files with standardrb
2
+ 3da043d8a33e29223834fa3d7a05b013e490ce62
@@ -0,0 +1,23 @@
1
+ name: Check project standards
2
+
3
+ on:
4
+ push
5
+
6
+
7
+ jobs:
8
+ lint:
9
+ runs-on: ubuntu-latest
10
+ env:
11
+ RAILS_ENV: test
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v3
15
+ with:
16
+ fetch-depth: 0
17
+ - name: Install Ruby and gems
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: '3.0'
21
+ bundler-cache: true
22
+ - name: Lint Ruby files
23
+ run: bundle exec standardrb
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in prx_auth-rails.gemspec
4
4
  gemspec
data/Guardfile CHANGED
@@ -1,8 +1,8 @@
1
1
  guard :minitest, all_after_pass: true do
2
- watch(%r{^test/(.*)\/?test_(.*)\.rb})
3
- watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
4
- watch(%r{^lib/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
5
- watch(%r{^lib/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
2
+ watch(%r{^test/(.*)/?test_(.*)\.rb})
3
+ watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
4
+ watch(%r{^lib/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
5
+ watch(%r{^lib/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
6
6
  watch(%r{^test/.+_test\.rb})
7
- watch(%r{^test/test_helper\.rb}) { 'test' }
7
+ watch(%r{^test/test_helper\.rb}) { "test" }
8
8
  end
data/Rakefile CHANGED
@@ -6,12 +6,12 @@ load "rails/tasks/engine.rake"
6
6
  load "rails/tasks/statistics.rake"
7
7
 
8
8
  require "bundler/gem_tasks"
9
- require 'rake'
9
+ require "rake"
10
10
  require "rake/testtask"
11
11
 
12
12
  Rake::TestTask.new(:test) do |t|
13
- t.libs << 'test'
14
- t.pattern = 'test/**/*_test.rb'
13
+ t.libs << "test"
14
+ t.pattern = "test/**/*_test.rb"
15
15
  t.verbose = false
16
16
  end
17
17
 
@@ -9,20 +9,30 @@ module PrxAuth::Rails
9
9
  before_action :set_nonce!, only: [:new, :show]
10
10
  before_action :set_after_sign_in_path
11
11
 
12
- ID_NONCE_SESSION_KEY = 'id_prx_openid_nonce'
12
+ ID_NONCE_SESSION_KEY = "id_prx_openid_nonce"
13
+ DEFAULT_SCOPES = "openid"
13
14
 
14
15
  def new
15
16
  config = PrxAuth::Rails.configuration
16
17
 
18
+ scope =
19
+ if config.prx_scope.present?
20
+ "#{DEFAULT_SCOPES} #{config.prx_scope}"
21
+ else
22
+ DEFAULT_SCOPES
23
+ end
24
+
17
25
  id_auth_params = {
18
26
  client_id: config.prx_client_id,
19
27
  nonce: fetch_nonce,
20
- response_type: 'id_token token',
21
- scope: 'openid apps',
22
- prompt: 'necessary'
28
+ response_type: "id_token token",
29
+ scope: scope,
30
+ prompt: "necessary"
23
31
  }
24
32
 
25
- redirect_to '//' + config.id_host + '/authorize?' + id_auth_params.to_query
33
+ url = "//" + config.id_host + "/authorize?" + id_auth_params.to_query
34
+
35
+ redirect_to url, allow_other_host: true
26
36
  end
27
37
 
28
38
  def show
@@ -38,13 +48,14 @@ module PrxAuth::Rails
38
48
  end
39
49
 
40
50
  def create
41
- if valid_nonce? && users_match?
42
- clear_nonce!
51
+ valid_and_matching = valid_nonce? && users_match?
52
+ clear_nonce!
53
+
54
+ if valid_and_matching
43
55
  sign_in_user(access_token)
44
56
  redirect_to after_sign_in_path_for(current_user)
45
57
  else
46
- clear_nonce!
47
- redirect_to auth_error_sessions_path(error: 'verification_failed')
58
+ redirect_to auth_error_sessions_path(error: params[:error] || "unknown_error")
48
59
  end
49
60
  end
50
61
 
@@ -57,7 +68,7 @@ module PrxAuth::Rails
57
68
  elsif defined?(super)
58
69
  super
59
70
  else
60
- '/'
71
+ "/"
61
72
  end
62
73
  end
63
74
 
@@ -68,11 +79,11 @@ module PrxAuth::Rails
68
79
  end
69
80
 
70
81
  def id_token
71
- params.require('id_token')
82
+ params.require("id_token")
72
83
  end
73
84
 
74
85
  def access_token
75
- params.require('access_token')
86
+ params.require("access_token")
76
87
  end
77
88
 
78
89
  def id_claims
@@ -96,11 +107,11 @@ module PrxAuth::Rails
96
107
  end
97
108
 
98
109
  def valid_nonce?
99
- id_claims['nonce'].present? && id_claims['nonce'] == fetch_nonce
110
+ id_claims["nonce"].present? && id_claims["nonce"] == fetch_nonce
100
111
  end
101
112
 
102
113
  def users_match?
103
- id_claims['sub'].present? && id_claims['sub'] == access_claims['sub']
114
+ id_claims["sub"].present? && id_claims["sub"] == access_claims["sub"]
104
115
  end
105
116
 
106
117
  def validate_token(token)
@@ -1,13 +1,6 @@
1
1
  <div class='main'>
2
2
  <section>
3
3
  <h3>Not authorized for this application.</h3>
4
-
5
- <p>Message was: <pre><%= @auth_error_message %></pre>
6
- <% if @auth_error_message == 'invalid_scope' %>
7
- Did you add a row in the account_applications table on id.prx?
8
- <% end %>
9
- </p>
10
-
11
4
  <p>
12
5
  <a href="<%= new_sessions_path %>">Try logging in again</a>
13
6
  </p>
@@ -2,6 +2,7 @@
2
2
  <%= form_for(:sessions, :url => PrxAuth::Rails::Engine.routes.url_helpers.sessions_path) do |f| %>
3
3
  <%= hidden_field_tag :access_token, '', id: 'access-token-field' %>
4
4
  <%= hidden_field_tag :id_token, '', id: 'id-token-field' %>
5
+ <%= hidden_field_tag :error, '', id: 'error-field' %>
5
6
  <%= f.submit id: 'sessions-form-submit' %>
6
7
  <% end %>
7
8
  </div>
@@ -23,14 +24,16 @@
23
24
  }
24
25
 
25
26
  window.addEventListener("load", () => {
26
- var idToken = document.querySelector("#id-token-field");
27
27
  var accessToken = document.querySelector("#access-token-field");
28
+ var idToken = document.querySelector("#id-token-field");
29
+ var error = document.querySelector("#error-field");
28
30
  var submit = document.querySelector("input#sessions-form-submit[type=submit]");
29
31
 
30
32
  var hashParams = parseURLFragment();
31
33
 
32
34
  accessToken.value = hashParams['access_token'];
33
35
  idToken.value = hashParams['id_token'];
36
+ error.value = hashParams['error'];
34
37
 
35
38
  submit.click();
36
39
  });
@@ -1 +1 @@
1
- Rails.application.config.assets.precompile << %w(prx_auth-rails_manifest.js)
1
+ Rails.application.config.assets.precompile << %w[prx_auth-rails_manifest.js]
data/config/routes.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  PrxAuth::Rails::Engine.routes.draw do
2
- scope module: 'prx_auth/rails' do
3
- resource 'sessions', except: :index, :defaults => { :format => 'html' } do
4
- get 'auth_error', to: 'sessions#auth_error'
2
+ scope module: "prx_auth/rails" do
3
+ resource "sessions", except: :index, defaults: {format: "html"} do
4
+ get "auth_error", to: "sessions#auth_error"
5
5
  end
6
6
  end
7
7
  end
@@ -1,16 +1,18 @@
1
1
  class PrxAuth::Rails::Configuration
2
2
  attr_accessor :install_middleware,
3
- :namespace,
4
- :prx_client_id,
5
- :id_host,
6
- :cert_path
3
+ :namespace,
4
+ :prx_client_id,
5
+ :prx_scope,
6
+ :id_host,
7
+ :cert_path
7
8
 
8
- DEFAULT_ID_HOST = 'id.prx.org'
9
- DEFAULT_CERT_PATH = 'api/v1/certs'
9
+ DEFAULT_ID_HOST = "id.prx.org"
10
+ DEFAULT_CERT_PATH = "api/v1/certs"
10
11
 
11
12
  def initialize
12
13
  @install_middleware = true
13
14
  @prx_client_id = nil
15
+ @prx_scope = nil
14
16
  @id_host = DEFAULT_ID_HOST
15
17
  @cert_path = DEFAULT_CERT_PATH
16
18
 
@@ -19,15 +21,15 @@ class PrxAuth::Rails::Configuration
19
21
  if defined?(::Rails)
20
22
  klass = ::Rails.application.class
21
23
  parent_name = if ::Rails::VERSION::MAJOR >= 6
22
- klass.module_parent_name
23
- else
24
- klass.parent_name
25
- end
24
+ klass.module_parent_name
25
+ else
26
+ klass.parent_name
27
+ end
26
28
  klass_name = if parent_name.present?
27
- parent_name
28
- else
29
- klass.name
30
- end
29
+ parent_name
30
+ else
31
+ klass.name
32
+ end
31
33
 
32
34
  klass_name.underscore.intern
33
35
  end
@@ -5,7 +5,7 @@ module PrxAuth
5
5
  ::ApplicationController.helper_method [
6
6
  :current_user, :prx_jwt,
7
7
  :current_user_info, :current_user_name, :current_user_apps,
8
- :account_name_for, :account_for, :accounts_for,
8
+ :account_name_for, :account_for, :accounts_for
9
9
  ]
10
10
  end
11
11
  end
@@ -1,18 +1,18 @@
1
- require 'prx_auth/rails/token'
2
- require 'open-uri'
1
+ require "prx_auth/rails/token"
2
+ require "open-uri"
3
3
 
4
4
  module PrxAuth
5
5
  module Rails
6
6
  module Controller
7
7
  class SessionTokenExpiredError < RuntimeError; end
8
8
 
9
- PRX_AUTH_ENV_KEY = 'prx.auth'.freeze
10
- PRX_JWT_SESSION_KEY = 'prx.auth.jwt'.freeze
9
+ PRX_AUTH_ENV_KEY = "prx.auth".freeze
10
+ PRX_JWT_SESSION_KEY = "prx.auth.jwt".freeze
11
11
  # subtracted from the JWT ttl
12
- PRX_JWT_REFRESH_TTL = 300.freeze
13
- PRX_ACCOUNT_MAPPING_SESSION_KEY = 'prx.auth.account.mapping'.freeze
14
- PRX_USER_INFO_SESSION_KEY = 'prx.auth.info'.freeze
15
- PRX_REFRESH_BACK_KEY = 'prx.auth.back'.freeze
12
+ PRX_JWT_REFRESH_TTL = 300
13
+ PRX_ACCOUNT_MAPPING_SESSION_KEY = "prx.auth.account.mapping".freeze
14
+ PRX_USER_INFO_SESSION_KEY = "prx.auth.info".freeze
15
+ PRX_REFRESH_BACK_KEY = "prx.auth.back".freeze
16
16
 
17
17
  def prx_auth_token
18
18
  env_token || session_token
@@ -24,7 +24,7 @@ module PrxAuth
24
24
  end
25
25
 
26
26
  def set_after_sign_in_path
27
- return if self.class == PrxAuth::Rails::SessionsController
27
+ return if instance_of?(PrxAuth::Rails::SessionsController)
28
28
 
29
29
  session[PRX_REFRESH_BACK_KEY] = request.fullpath
30
30
  end
@@ -52,16 +52,19 @@ module PrxAuth
52
52
  end
53
53
 
54
54
  def current_user_info
55
- session[PRX_USER_INFO_SESSION_KEY] ||= fetch_userinfo
55
+ session[PRX_USER_INFO_SESSION_KEY] ||= begin
56
+ info = fetch_userinfo
57
+ info.slice("name", "preferred_username", "email", "image_href", "apps")
58
+ end
56
59
  end
57
60
 
58
61
  def current_user_name
59
- current_user_info['name'] || current_user_info['preferred_username'] || current_user_info['email']
62
+ current_user_info["name"] || current_user_info["preferred_username"] || current_user_info["email"]
60
63
  end
61
64
 
62
65
  def current_user_apps
63
- apps = (current_user_info.try(:[], 'apps') || []).map do |name, url|
64
- label = name.sub(/^https?:\/\//, '').sub(/\..+/, '').capitalize
66
+ apps = (current_user_info.try(:[], "apps") || []).map do |name, url|
67
+ label = name.sub(/^https?:\/\//, "").sub(/\..+/, "").capitalize
65
68
  ["PRX #{label}", url]
66
69
  end
67
70
 
@@ -87,7 +90,7 @@ module PrxAuth
87
90
  end
88
91
 
89
92
  def account_name_for(account_id)
90
- account_for(account_id).try(:[], :name)
93
+ account_for(account_id).try(:[], "name")
91
94
  end
92
95
 
93
96
  def account_for(account_id)
@@ -107,7 +110,8 @@ module PrxAuth
107
110
  missing = ids - session[PRX_ACCOUNT_MAPPING_SESSION_KEY].keys
108
111
  if missing.present?
109
112
  fetch_accounts(missing).each do |account|
110
- session[PRX_ACCOUNT_MAPPING_SESSION_KEY][account['id']] = account.with_indifferent_access
113
+ minimal = account.slice("name", "type")
114
+ session[PRX_ACCOUNT_MAPPING_SESSION_KEY][account["id"]] = minimal
111
115
  end
112
116
  end
113
117
 
@@ -115,9 +119,9 @@ module PrxAuth
115
119
  end
116
120
 
117
121
  def fetch_accounts(ids)
118
- ids_param = ids.map(&:to_s).join(',')
122
+ ids_param = ids.map(&:to_s).join(",")
119
123
  resp = fetch("/api/v1/accounts?account_ids=#{ids_param}")
120
- resp.try(:[], '_embedded').try(:[], 'prx:items') || []
124
+ resp.try(:[], "_embedded").try(:[], "prx:items") || []
121
125
  end
122
126
 
123
127
  def fetch_userinfo
@@ -128,8 +132,8 @@ module PrxAuth
128
132
  url = "https://#{PrxAuth::Rails.configuration.id_host}#{path}"
129
133
  options = {}
130
134
  options[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE if ::Rails.env.development?
131
- options['Authorization'] = "Bearer #{token}" if token
132
- JSON.parse(URI.open(url, options).read)
135
+ options["Authorization"] = "Bearer #{token}" if token
136
+ JSON.parse(URI.open(url, options).read) # standard:disable Security/Open
133
137
  end
134
138
 
135
139
  # token from data set by prx_auth rack middleware
@@ -1,6 +1,6 @@
1
- require 'rails/railtie'
2
- require 'prx_auth/rails/ext/controller'
3
- require 'rack/prx_auth'
1
+ require "rails/railtie"
2
+ require "prx_auth/rails/ext/controller"
3
+ require "rack/prx_auth"
4
4
 
5
5
  module PrxAuth::Rails
6
6
  class Railtie < ::Rails::Railtie
@@ -1,4 +1,4 @@
1
- require 'rack/prx_auth'
1
+ require "rack/prx_auth"
2
2
 
3
3
  class PrxAuth::Rails::Token
4
4
  def initialize(token_data)
@@ -6,17 +6,17 @@ class PrxAuth::Rails::Token
6
6
  @namespace = PrxAuth::Rails.configuration.namespace
7
7
  end
8
8
 
9
- def authorized?(resource, namespace=nil, scope=nil)
9
+ def authorized?(resource, namespace = nil, scope = nil)
10
10
  namespace, scope = @namespace, namespace if scope.nil? && !namespace.nil?
11
11
  @token_data.authorized?(resource, namespace, scope)
12
12
  end
13
13
 
14
- def globally_authorized?(namespace, scope=nil)
14
+ def globally_authorized?(namespace, scope = nil)
15
15
  namespace, scope = @namespace, namespace if scope.nil?
16
16
  @token_data.globally_authorized?(namespace, scope)
17
17
  end
18
18
 
19
- def resources(namespace=nil, scope=nil)
19
+ def resources(namespace = nil, scope = nil)
20
20
  namespace, scope = @namespace, namespace if scope.nil? && !namespace.nil?
21
21
  @token_data.resources(namespace, scope)
22
22
  end
@@ -32,4 +32,17 @@ class PrxAuth::Rails::Token
32
32
  def authorized_account_ids(scope)
33
33
  @token_data.authorized_account_ids(scope)
34
34
  end
35
+
36
+ def except!(*resources)
37
+ @token_data = @token_data.except(*resources)
38
+ self
39
+ end
40
+
41
+ def except(*resources)
42
+ dup.except!(*resources)
43
+ end
44
+
45
+ def empty_resources?
46
+ @token_data.empty_resources?
47
+ end
35
48
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module PrxAuth
4
4
  module Rails
5
- VERSION = '4.0.0'
5
+ VERSION = "4.2.0"
6
6
  end
7
7
  end
@@ -27,10 +27,10 @@ module PrxAuth
27
27
  host = configuration.id_host
28
28
  path = configuration.cert_path
29
29
  protocol =
30
- if host.include?('localhost') || host.include?('127.0.0.1')
31
- 'http'
30
+ if host.include?("localhost") || host.include?("127.0.0.1")
31
+ "http"
32
32
  else
33
- 'https'
33
+ "https"
34
34
  end
35
35
 
36
36
  app.middleware.insert_after Rack::Head, Rack::PrxAuth,
@@ -1,37 +1,36 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'prx_auth/rails/version'
3
+ require "prx_auth/rails/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "prx_auth-rails"
8
- spec.version = PrxAuth::Rails::VERSION
9
- spec.authors = ["Chris Rhoden"]
10
- spec.email = ["carhoden@gmail.com"]
11
- spec.description = "Rails integration for next generation PRX Authorization system."
12
- spec.summary = "Rails integration for next generation PRX Authorization system."
13
- spec.homepage = "https://github.com/PRX/prx_auth-rails"
14
- spec.license = "MIT"
6
+ spec.name = "prx_auth-rails"
7
+ spec.version = PrxAuth::Rails::VERSION
8
+ spec.authors = ["Chris Rhoden"]
9
+ spec.email = ["carhoden@gmail.com"]
10
+ spec.description = "Rails integration for next generation PRX Authorization system."
11
+ spec.summary = "Rails integration for next generation PRX Authorization system."
12
+ spec.homepage = "https://github.com/PRX/prx_auth-rails"
13
+ spec.license = "MIT"
15
14
 
16
- spec.required_ruby_version = '>= 2.3'
15
+ spec.required_ruby_version = ">= 2.3"
17
16
 
18
- spec.files = `git ls-files`.split($/)
19
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
19
  spec.require_paths = ["lib"]
22
20
 
23
- spec.add_runtime_dependency 'actionpack'
21
+ spec.add_runtime_dependency "actionpack"
24
22
 
25
- spec.add_development_dependency 'bundler'
26
- spec.add_development_dependency 'rake'
27
- spec.add_development_dependency 'coveralls', '~> 0'
28
- spec.add_development_dependency 'guard'
29
- spec.add_development_dependency 'guard-minitest'
30
- spec.add_development_dependency 'm', '~> 1.5'
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "coveralls", "~> 0"
26
+ spec.add_development_dependency "guard"
27
+ spec.add_development_dependency "guard-minitest"
28
+ spec.add_development_dependency "m", "~> 1.5"
31
29
  spec.add_development_dependency "rails", "~> 6.1.0"
32
- spec.add_development_dependency 'pry'
33
- spec.add_development_dependency 'sqlite3'
34
- spec.add_development_dependency 'webmock'
30
+ spec.add_development_dependency "pry"
31
+ spec.add_development_dependency "sqlite3"
32
+ spec.add_development_dependency "webmock"
33
+ spec.add_development_dependency "standard"
35
34
 
36
- spec.add_runtime_dependency 'prx_auth', ">= 1.7.0"
35
+ spec.add_runtime_dependency "prx_auth", ">= 1.8.0"
37
36
  end
@@ -1,10 +1,10 @@
1
1
  class ApplicationController < ActionController::Base
2
-
3
2
  before_action :authenticate!
4
3
 
5
- def index; end
4
+ def index
5
+ end
6
6
 
7
7
  def after_sign_in_path_for(_resource)
8
- '/after-sign-in-path'
8
+ "/after-sign-in-path"
9
9
  end
10
10
  end
@@ -1,4 +1,4 @@
1
1
  class ApplicationMailer < ActionMailer::Base
2
- default from: 'from@example.com'
3
- layout 'mailer'
2
+ default from: "from@example.com"
3
+ layout "mailer"
4
4
  end
data/test/dummy/bin/rails CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  load File.expand_path("spring", __dir__)
3
- APP_PATH = File.expand_path('../config/application', __dir__)
3
+ APP_PATH = File.expand_path("../config/application", __dir__)
4
4
  require_relative "../config/boot"
5
5
  require "rails/commands"
data/test/dummy/bin/setup CHANGED
@@ -2,7 +2,7 @@
2
2
  require "fileutils"
3
3
 
4
4
  # path to your application root.
5
- APP_ROOT = File.expand_path('..', __dir__)
5
+ APP_ROOT = File.expand_path("..", __dir__)
6
6
 
7
7
  def system!(*args)
8
8
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -13,9 +13,9 @@ FileUtils.chdir APP_ROOT do
13
13
  # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
14
  # Add necessary setup steps to this file.
15
15
 
16
- puts '== Installing dependencies =='
17
- system! 'gem install bundler --conservative'
18
- system('bundle check') || system!('bundle install')
16
+ puts "== Installing dependencies =="
17
+ system! "gem install bundler --conservative"
18
+ system("bundle check") || system!("bundle install")
19
19
 
20
20
  # puts "\n== Copying sample files =="
21
21
  # unless File.exist?('config/database.yml')
@@ -23,11 +23,11 @@ FileUtils.chdir APP_ROOT do
23
23
  # end
24
24
 
25
25
  puts "\n== Preparing database =="
26
- system! 'bin/rails db:prepare'
26
+ system! "bin/rails db:prepare"
27
27
 
28
28
  puts "\n== Removing old logs and tempfiles =="
29
- system! 'bin/rails log:clear tmp:clear'
29
+ system! "bin/rails log:clear tmp:clear"
30
30
 
31
31
  puts "\n== Restarting application server =="
32
- system! 'bin/rails restart'
32
+ system! "bin/rails restart"
33
33
  end
@@ -1,5 +1,5 @@
1
1
  # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
2
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
3
3
 
4
4
  require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
5
- $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
5
+ $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
@@ -16,13 +16,13 @@ Rails.application.configure do
16
16
 
17
17
  # Enable/disable caching. By default caching is disabled.
18
18
  # Run rails dev:cache to toggle caching.
19
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
19
+ if Rails.root.join("tmp", "caching-dev.txt").exist?
20
20
  config.action_controller.perform_caching = true
21
21
  config.action_controller.enable_fragment_cache_logging = true
22
22
 
23
23
  config.cache_store = :memory_store
24
24
  config.public_file_server.headers = {
25
- 'Cache-Control' => "public, max-age=#{2.days.to_i}"
25
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
26
26
  }
27
27
  else
28
28
  config.action_controller.perform_caching = false