better_record 0.10.6 → 0.10.7

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: b39e6918ad1c4ee97eff12b603afbdd9e927c7054cd10aa433965214105acb48
4
- data.tar.gz: bcd0533d3562fd70d28738b9b7da3904aa7fa5ac9dc319d8f9ce9929d1067de9
3
+ metadata.gz: d4c3bb0f0f7e3fc0edc140bb4722c2077c9815212b1ab10585f9501238c81372
4
+ data.tar.gz: ee470ebb3cf647eab591ab701770b5fb662ed46b6b9a3e701b24e3bbf09618df
5
5
  SHA512:
6
- metadata.gz: e76c5c2baefeb1f9c67c842f71c637299a4881aef80472c53533a01f30bc30dc4e3d29f00e8a9591c2e1797b1a3e7da8208423b2506bbdc879731c27c9705d7a
7
- data.tar.gz: 7d0088bb38da17a07c489ca12a4cc164270bab305dc69090423bd6f87ec93ca699294343eeda34193368165efb3f495fb6911387186f184f3e7ccc0ef4695eb5
6
+ metadata.gz: dada87c0502e3d06a2cb4e413fff9cb0c76b50aa11441b46d072864b480d7b729906d72671bf451205c3fbf43c770394820bebbbe35344cdd7bf819608028de2
7
+ data.tar.gz: 249754388c67f04042035a1ae7c8895188dee40d3348277b1220a59cec3e85b378867bdd7f03ced2cee79c6c713d03f701439b8150efc8f6bb34d2470b4f5c70
data/lib/better_record.rb CHANGED
@@ -68,6 +68,7 @@ module BetterRecord
68
68
  self.session_authenticate_method = (ENV.fetch('BR_SESSION_AUTHENTICATE_METHOD') { :authenticate }).to_sym
69
69
  self.certificate_session_column = (ENV.fetch('BR_CERTIFICATE_SESSION_COLUMN') { :certificate }).to_sym
70
70
  self.certificate_session_user_method = (ENV.fetch('BR_CERTIFICATE_SESSION_USER_METHOD') { :user }).to_sym
71
+ self.certificate_header = (ENV.fetch('BR_CERTIFICATE_HEADER') { :HTTP_X_SSL_CERT }).to_sym
71
72
  end
72
73
 
73
74
  Dir.glob("#{File.expand_path(__dir__)}/better_record/*.rb").each do |d|
@@ -128,7 +128,12 @@ module BetterRecord
128
128
  end
129
129
 
130
130
  def logged_in?
131
- current_token.present?
131
+ current_token.present? ||
132
+ (
133
+ certificate_header &&
134
+ header_hash[certificate_header].present? &&
135
+ create_session_from_certificate(header_hash[certificate_header])
136
+ )
132
137
  end
133
138
 
134
139
  def current_token
@@ -155,6 +160,10 @@ module BetterRecord
155
160
  @current_token
156
161
  end
157
162
 
163
+ def header_hash
164
+ @header_hash ||= request.headers.to_h.deep_symbolize_keys
165
+ end
166
+
158
167
  def set_auth_header
159
168
  response.set_header("AUTH_TOKEN", current_token)
160
169
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BetterRecord
4
- VERSION = '0.10.6'
4
+ VERSION = '0.10.7'
5
5
  end
@@ -17,6 +17,7 @@ module BetterRecord
17
17
  # session_authenticate_method: BR_SESSION_AUTHENTICATE_METHOD #
18
18
  # certificate_session_column: BR_CERTIFICATE_SESSION_COLUMN #
19
19
  # certificate_session_user_method: BR_CERTIFICATE_SESSION_USER_METHOD #
20
+ # certificate_header: BR_CERTIFICATE_HEADER #
20
21
  ##########################################################################
21
22
 
22
23
  # uncomment the following line to disable three-state booleans in models
@@ -87,6 +88,8 @@ module BetterRecord
87
88
  # self.certificate_session_column = :cert_str
88
89
 
89
90
  # self.certificate_session_user_method = :user
91
+
92
+ # self.certificate_header = :HTTP_X_CERTIFICATE
90
93
  # end
91
94
 
92
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.6
4
+ version: 0.10.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampson Crowley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-10 00:00:00.000000000 Z
11
+ date: 2018-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -334,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
334
334
  version: '0'
335
335
  requirements: []
336
336
  rubyforge_project:
337
- rubygems_version: 2.7.6
337
+ rubygems_version: 2.7.7
338
338
  signing_key:
339
339
  specification_version: 4
340
340
  summary: Fix functions that are lacking in Active record to be compatible with multi-app