devise_pkcs12_authenticatable 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.overcommit.yml +53 -0
- data/.rubocop.yml +10 -0
- data/.rubocop_todo.yml +17 -0
- data/Gemfile +2 -0
- data/Rakefile +3 -1
- data/devise_pkcs12_authenticatable.gemspec +15 -8
- data/lib/devise_pkcs12_authenticatable.rb +8 -14
- data/lib/devise_pkcs12_authenticatable/model.rb +4 -3
- data/lib/devise_pkcs12_authenticatable/{engine.rb → railtie.rb} +3 -1
- data/lib/devise_pkcs12_authenticatable/strategy.rb +8 -3
- data/lib/devise_pkcs12_authenticatable/version.rb +3 -1
- metadata +65 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25fd843f86a6f5abe1b4363328ceb226cf1e20c4
|
4
|
+
data.tar.gz: 5794ebc69d8afc19c45e7706d42dc01545604157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1a824ae809892ac4f2b30acaa3f226a0c27ee26caccad6799fb0cdbead9b3f9df91982e8626a3e62b7fa9b16ca25f39cb92600d6446042bfaa1c9764202e0b3
|
7
|
+
data.tar.gz: c230eb441dce35670c1cfb462c54caa54b935acd73d4d3c1a74db5300f6a137056345788acd46602df7164180cd37cf3d66a767c531d40b9b13a814b8c4dd513
|
data/.overcommit.yml
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Use this file to configure the Overcommit hooks you wish to use. This will
|
2
|
+
# extend the default configuration defined in:
|
3
|
+
# https://github.com/brigade/overcommit/blob/master/config/default.yml
|
4
|
+
#
|
5
|
+
# At the topmost level of this YAML file is a key representing type of hook
|
6
|
+
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
|
7
|
+
# customize each hook, such as whether to only run it on certain files (via
|
8
|
+
# `include`), whether to only display output if it fails (via `quiet`), etc.
|
9
|
+
#
|
10
|
+
# For a complete list of hooks, see:
|
11
|
+
# https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
|
12
|
+
#
|
13
|
+
# For a complete list of options that you can use to customize hooks, see:
|
14
|
+
# https://github.com/brigade/overcommit#configuration
|
15
|
+
|
16
|
+
gemfile: Gemfile
|
17
|
+
|
18
|
+
CommitMsg:
|
19
|
+
HardTabs:
|
20
|
+
enabled: true
|
21
|
+
|
22
|
+
RussianNovel:
|
23
|
+
enabled: true
|
24
|
+
|
25
|
+
PreCommit:
|
26
|
+
BundleAudit:
|
27
|
+
enabled: true
|
28
|
+
flags:
|
29
|
+
# Update the ruby-advisory-db and check Gemfile.lock
|
30
|
+
- '--update'
|
31
|
+
|
32
|
+
BundleCheck:
|
33
|
+
enabled: true
|
34
|
+
|
35
|
+
ExecutePermissions:
|
36
|
+
enabled: true
|
37
|
+
|
38
|
+
Fasterer:
|
39
|
+
enabled: true
|
40
|
+
|
41
|
+
ForbiddenBranches:
|
42
|
+
enabled: true
|
43
|
+
branch_patterns:
|
44
|
+
- 'master'
|
45
|
+
|
46
|
+
HardTabs:
|
47
|
+
enabled: true
|
48
|
+
|
49
|
+
RuboCop:
|
50
|
+
enabled: true
|
51
|
+
|
52
|
+
TrailingWhitespace:
|
53
|
+
enabled: true
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-12-27 10:25:15 +0700 using RuboCop version 0.51.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 5
|
10
|
+
Style/Documentation:
|
11
|
+
Exclude:
|
12
|
+
- 'spec/**/*'
|
13
|
+
- 'test/**/*'
|
14
|
+
- 'lib/devise_pkcs12_authenticatable.rb'
|
15
|
+
- 'lib/devise_pkcs12_authenticatable/model.rb'
|
16
|
+
- 'lib/devise_pkcs12_authenticatable/railtie.rb'
|
17
|
+
- 'lib/devise_pkcs12_authenticatable/strategy.rb'
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
|
3
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
+
|
4
7
|
require 'devise_pkcs12_authenticatable/version'
|
5
8
|
|
6
9
|
Gem::Specification.new do |spec|
|
@@ -14,17 +17,21 @@ Gem::Specification.new do |spec|
|
|
14
17
|
spec.homepage = 'https://github.com/vill/devise_pkcs12_authenticatable'
|
15
18
|
spec.license = 'MIT'
|
16
19
|
|
17
|
-
spec.
|
20
|
+
spec.require_paths = ['lib']
|
18
21
|
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
spec.
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
f.match(%r{^(test|spec|features)/})
|
24
|
+
end
|
20
25
|
|
21
26
|
spec.required_ruby_version = '>= 1.9.3'
|
22
27
|
spec.required_rubygems_version = '>= 2.2.0'
|
23
28
|
|
24
|
-
spec.add_dependency 'devise',
|
25
|
-
spec.add_dependency 'activesupport', '~> 4.1.8'
|
26
|
-
spec.add_dependency 'railties', '~> 4.1.8'
|
29
|
+
spec.add_dependency 'devise', '>= 3.4.1', '< 5.0'
|
27
30
|
|
28
|
-
spec.add_development_dependency 'bundler',
|
29
|
-
spec.add_development_dependency '
|
31
|
+
spec.add_development_dependency 'bundler', '~> 1.9'
|
32
|
+
spec.add_development_dependency 'bundler-audit', '~> 0.6.0'
|
33
|
+
spec.add_development_dependency 'fasterer', '~> 0.3.2'
|
34
|
+
spec.add_development_dependency 'overcommit', '~> 0.41.0'
|
35
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
36
|
+
spec.add_development_dependency 'rubocop', '~> 0.51.0'
|
30
37
|
end
|
@@ -1,22 +1,16 @@
|
|
1
|
-
|
2
|
-
require 'active_support'
|
3
|
-
require 'active_support/inflector'
|
4
|
-
require 'active_support/concern'
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
require '
|
3
|
+
require 'devise'
|
7
4
|
|
8
|
-
|
9
|
-
end
|
5
|
+
require 'devise_pkcs12_authenticatable/railtie' if defined?(::Rails::Railtie)
|
10
6
|
|
11
7
|
module Devise
|
12
8
|
# Name of the field for 'commonName'
|
13
9
|
mattr_accessor :pkcs12_common_name_field
|
14
|
-
@@pkcs12_common_name_field = :cn
|
10
|
+
@@pkcs12_common_name_field = :cn # rubocop:disable Style/ClassVars
|
15
11
|
end
|
16
12
|
|
17
|
-
Devise.add_module(:pkcs12_authenticatable,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
model: 'devise_pkcs12_authenticatable/model'
|
22
|
-
)
|
13
|
+
Devise.add_module(:pkcs12_authenticatable, route: :session,
|
14
|
+
controller: :sessions,
|
15
|
+
strategy: true,
|
16
|
+
model: 'devise_pkcs12_authenticatable/model')
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/concern'
|
1
4
|
require 'devise_pkcs12_authenticatable/strategy'
|
2
5
|
|
3
6
|
module Devise
|
@@ -11,8 +14,6 @@ module Devise
|
|
11
14
|
self[::Devise.pkcs12_common_name_field] == common_name
|
12
15
|
end
|
13
16
|
|
14
|
-
protected
|
15
|
-
|
16
17
|
module ClassMethods
|
17
18
|
def find_for_pkcs12_authentication(conditions)
|
18
19
|
find_for_authentication(conditions)
|
@@ -20,4 +21,4 @@ module Devise
|
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
23
|
-
end
|
24
|
+
end
|
@@ -1,22 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'devise/strategies/database_authenticatable'
|
2
4
|
|
3
5
|
module Devise
|
4
6
|
module Strategies
|
5
7
|
class PKCS12Authenticatable < DatabaseAuthenticatable
|
8
|
+
# rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Lint/AssignmentInCondition,Style/Semicolon,Metrics/LineLength
|
6
9
|
def authenticate!
|
7
|
-
opts
|
10
|
+
opts = authentication_hash.merge(Hash[::Devise.pkcs12_common_name_field, common_name])
|
8
11
|
resource = password.present? && mapping.to.find_for_pkcs12_authentication(opts)
|
9
12
|
encrypted = false
|
10
13
|
|
11
|
-
if validate(resource){ encrypted = true; resource.valid_password?(password) } && resource.valid_common_name?(common_name)
|
14
|
+
if validate(resource) { encrypted = true; resource.valid_password?(password) } && resource.valid_common_name?(common_name)
|
12
15
|
remember_me(resource)
|
13
16
|
resource.after_database_authentication
|
14
17
|
success!(resource)
|
15
18
|
end
|
16
19
|
|
17
20
|
mapping.to.new.password = password if !encrypted && Devise.paranoid
|
21
|
+
|
18
22
|
fail!(:not_found_in_database) unless resource
|
19
23
|
end
|
24
|
+
# rubocop:enable Metrics/AbcSize,Metrics/CyclomaticComplexity,Lint/AssignmentInCondition,Style/Semicolon,Metrics/LineLength
|
20
25
|
|
21
26
|
def valid?
|
22
27
|
super && client_verify?
|
@@ -40,4 +45,4 @@ module Devise
|
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
43
|
-
Warden::Strategies.add(:pkcs12_authenticatable, Devise::Strategies::PKCS12Authenticatable)
|
48
|
+
Warden::Strategies.add(:pkcs12_authenticatable, Devise::Strategies::PKCS12Authenticatable)
|
metadata
CHANGED
@@ -1,92 +1,129 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_pkcs12_authenticatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Grigoriev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.4.1
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 3.4.1
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
34
|
+
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - ~>
|
37
|
+
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
39
|
+
version: '1.9'
|
40
|
+
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - ~>
|
44
|
+
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: '1.9'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: bundler-audit
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - ~>
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
type: :
|
53
|
+
version: 0.6.0
|
54
|
+
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - ~>
|
58
|
+
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
60
|
+
version: 0.6.0
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: fasterer
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - ~>
|
65
|
+
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
67
|
+
version: 0.3.2
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - ~>
|
72
|
+
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
74
|
+
version: 0.3.2
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: overcommit
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 0.41.0
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.41.0
|
69
89
|
- !ruby/object:Gem::Dependency
|
70
90
|
name: rake
|
71
91
|
requirement: !ruby/object:Gem::Requirement
|
72
92
|
requirements:
|
73
|
-
- - ~>
|
93
|
+
- - "~>"
|
74
94
|
- !ruby/object:Gem::Version
|
75
95
|
version: '10.0'
|
76
96
|
type: :development
|
77
97
|
prerelease: false
|
78
98
|
version_requirements: !ruby/object:Gem::Requirement
|
79
99
|
requirements:
|
80
|
-
- - ~>
|
100
|
+
- - "~>"
|
81
101
|
- !ruby/object:Gem::Version
|
82
102
|
version: '10.0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: rubocop
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.51.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.51.0
|
83
117
|
description: 'PKCS #12 authentication for Devise.'
|
84
118
|
email: a.grigorev007@gmail.com
|
85
119
|
executables: []
|
86
120
|
extensions: []
|
87
121
|
extra_rdoc_files: []
|
88
122
|
files:
|
89
|
-
- .gitignore
|
123
|
+
- ".gitignore"
|
124
|
+
- ".overcommit.yml"
|
125
|
+
- ".rubocop.yml"
|
126
|
+
- ".rubocop_todo.yml"
|
90
127
|
- CHANGELOG.md
|
91
128
|
- Gemfile
|
92
129
|
- LICENSE
|
@@ -94,8 +131,8 @@ files:
|
|
94
131
|
- Rakefile
|
95
132
|
- devise_pkcs12_authenticatable.gemspec
|
96
133
|
- lib/devise_pkcs12_authenticatable.rb
|
97
|
-
- lib/devise_pkcs12_authenticatable/engine.rb
|
98
134
|
- lib/devise_pkcs12_authenticatable/model.rb
|
135
|
+
- lib/devise_pkcs12_authenticatable/railtie.rb
|
99
136
|
- lib/devise_pkcs12_authenticatable/strategy.rb
|
100
137
|
- lib/devise_pkcs12_authenticatable/version.rb
|
101
138
|
homepage: https://github.com/vill/devise_pkcs12_authenticatable
|
@@ -108,17 +145,17 @@ require_paths:
|
|
108
145
|
- lib
|
109
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
147
|
requirements:
|
111
|
-
- -
|
148
|
+
- - ">="
|
112
149
|
- !ruby/object:Gem::Version
|
113
150
|
version: 1.9.3
|
114
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
152
|
requirements:
|
116
|
-
- -
|
153
|
+
- - ">="
|
117
154
|
- !ruby/object:Gem::Version
|
118
155
|
version: 2.2.0
|
119
156
|
requirements: []
|
120
157
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
158
|
+
rubygems_version: 2.6.10
|
122
159
|
signing_key:
|
123
160
|
specification_version: 4
|
124
161
|
summary: 'PKCS #12 authentication for Devise.'
|