cow_auth 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +4 -3
- data/CODE_OF_CONDUCT.md +4 -4
- data/Gemfile +3 -2
- data/Gemfile.lock +20 -14
- data/LICENSE.txt +1 -1
- data/README.md +13 -12
- data/cow_auth.gemspec +13 -14
- data/lib/cow_auth/user.rb +9 -12
- data/lib/cow_auth/version.rb +1 -1
- metadata +15 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0e869b68884793590a26fb92fa2071936551cd02d12c711ad6c26442ed40004
|
4
|
+
data.tar.gz: a6460389351e4f70e079b63c8c0f946415579213a14c2ad2a0895e6602c84afa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d8324716f594328482fea1dcf04d7330d4ff20ecf325eb7e51b68e399598975e1294901cfae4b221adc7e679d101368da355d6d56620540da032cdb81b4c1ca
|
7
|
+
data.tar.gz: 834d84c38351ea0a066beed3fbff1723542996f81a10d305c6c69295a23c33af38ef86bf17869b7b351e93ecd6f8f9196417b8fd5a480867e2248445ed91c9ec
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at mickey@
|
58
|
+
reported by contacting the project team at mickey@cowden.tech. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
@@ -68,7 +68,7 @@ members of the project's leadership.
|
|
68
68
|
## Attribution
|
69
69
|
|
70
70
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
72
|
|
73
|
-
[homepage]:
|
74
|
-
[version]:
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,41 +1,47 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cow_auth (0.
|
5
|
-
|
4
|
+
cow_auth (0.7.0)
|
5
|
+
activerecord (~> 6.0)
|
6
6
|
scrypt (~> 3.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
11
|
+
activemodel (6.0.3.2)
|
12
|
+
activesupport (= 6.0.3.2)
|
13
|
+
activerecord (6.0.3.2)
|
14
|
+
activemodel (= 6.0.3.2)
|
15
|
+
activesupport (= 6.0.3.2)
|
16
|
+
activesupport (6.0.3.2)
|
12
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
18
|
i18n (>= 0.7, < 2)
|
14
19
|
minitest (~> 5.1)
|
15
20
|
tzinfo (~> 1.1)
|
16
|
-
|
17
|
-
|
21
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
22
|
+
concurrent-ruby (1.1.6)
|
23
|
+
ffi (1.13.1)
|
18
24
|
ffi-compiler (1.0.1)
|
19
25
|
ffi (>= 1.0.0)
|
20
26
|
rake
|
21
|
-
i18n (1.
|
27
|
+
i18n (1.8.5)
|
22
28
|
concurrent-ruby (~> 1.0)
|
23
|
-
minitest (5.
|
24
|
-
rake (12.3.
|
25
|
-
scrypt (3.0.
|
29
|
+
minitest (5.14.1)
|
30
|
+
rake (12.3.3)
|
31
|
+
scrypt (3.0.7)
|
26
32
|
ffi-compiler (>= 1.0, < 2.0)
|
27
33
|
thread_safe (0.3.6)
|
28
|
-
tzinfo (1.2.
|
34
|
+
tzinfo (1.2.7)
|
29
35
|
thread_safe (~> 0.1)
|
36
|
+
zeitwerk (2.4.0)
|
30
37
|
|
31
38
|
PLATFORMS
|
32
39
|
ruby
|
33
40
|
|
34
41
|
DEPENDENCIES
|
35
|
-
bundler (~> 1.16)
|
36
42
|
cow_auth!
|
37
|
-
minitest (~> 5.
|
38
|
-
rake (~> 12.
|
43
|
+
minitest (~> 5.0)
|
44
|
+
rake (~> 12.0)
|
39
45
|
|
40
46
|
BUNDLED WITH
|
41
|
-
1.
|
47
|
+
2.1.4
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# CowAuth
|
2
2
|
|
3
|
-
The
|
3
|
+
The goal of this gem is to provide token-based authentication for Rails (or Rails-like) web applications.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -12,7 +12,7 @@ gem 'cow_auth'
|
|
12
12
|
|
13
13
|
And then execute:
|
14
14
|
|
15
|
-
$ bundle
|
15
|
+
$ bundle install
|
16
16
|
|
17
17
|
Or install it yourself as:
|
18
18
|
|
@@ -31,31 +31,32 @@ Configure your user model to add the authentication mechanism.
|
|
31
31
|
#### Migration (Example)
|
32
32
|
|
33
33
|
# Modified migration; includes indexes and other stuff you might not want.
|
34
|
-
class CreateUsers < ActiveRecord::Migration[
|
34
|
+
class CreateUsers < ActiveRecord::Migration[6.0]
|
35
35
|
def change
|
36
36
|
create_table :users do |t|
|
37
37
|
t.string :uuid, null: false
|
38
38
|
t.string :email, null: false
|
39
39
|
t.string :sid, null: false
|
40
|
-
t.string :encrypted_password, null: false
|
41
40
|
t.string :locale, null: false
|
41
|
+
t.string :encrypted_password, null: false
|
42
|
+
t.string :auth_token
|
42
43
|
t.string :first_name
|
43
44
|
t.string :last_name
|
44
45
|
t.integer :sign_in_count, default: 0, null: false
|
45
46
|
t.boolean :is_enabled, default: false, null: false
|
46
47
|
t.boolean :is_deleted, default: false, null: false
|
48
|
+
t.timestamp :expires_at
|
47
49
|
t.timestamps
|
48
|
-
t.index [:uuid], unique: true
|
49
|
-
t.index [:email], unique: true
|
50
|
-
t.index [:sid], unique: true
|
51
50
|
end
|
51
|
+
add_index :users, :uuid, unique: true
|
52
|
+
add_index :users, :email, unique: true
|
53
|
+
add_index :users, :sid, unique: true
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
55
|
-
#### Model
|
57
|
+
#### Model Inheritance
|
56
58
|
|
57
|
-
class User <
|
58
|
-
include CowAuth::User
|
59
|
+
class User < CowAuth::User
|
59
60
|
end
|
60
61
|
|
61
62
|
#### Create User
|
@@ -165,7 +166,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
165
166
|
|
166
167
|
## Contributing
|
167
168
|
|
168
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/mickey13/
|
169
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mickey13/cow-auth. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/mickey13/cow-auth/blob/master/CODE_OF_CONDUCT.md).
|
169
170
|
|
170
171
|
## License
|
171
172
|
|
@@ -173,4 +174,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
173
174
|
|
174
175
|
## Code of Conduct
|
175
176
|
|
176
|
-
Everyone interacting in the CowAuth project
|
177
|
+
Everyone interacting in the CowAuth project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mickey13/cow-auth/blob/master/CODE_OF_CONDUCT.md).
|
data/cow_auth.gemspec
CHANGED
@@ -1,31 +1,30 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'cow_auth/version'
|
1
|
+
require_relative 'lib/cow_auth/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
4
|
spec.name = 'cow_auth'
|
8
5
|
spec.version = CowAuth::VERSION
|
9
6
|
spec.authors = ['Mickey Cowden']
|
10
|
-
spec.email = ['mickey@
|
7
|
+
spec.email = ['mickey@cowden.tech']
|
11
8
|
|
12
9
|
spec.summary = 'Authentication gem'
|
13
|
-
spec.description = 'The
|
10
|
+
spec.description = 'The goal of this gem is to provide token-based authentication for Rails (or Rails-like) web applications.'
|
14
11
|
spec.homepage = 'https://github.com/mickey13/cow-auth'
|
15
12
|
spec.license = 'MIT'
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
14
|
+
|
15
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
16
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
17
|
+
spec.metadata['changelog_uri'] = spec.homepage
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
23
|
end
|
20
24
|
spec.bindir = 'exe'
|
21
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
26
|
spec.require_paths = ['lib']
|
23
27
|
|
24
|
-
spec.
|
25
|
-
|
26
|
-
spec.add_development_dependency 'bundler', '~> 1.16'
|
27
|
-
spec.add_development_dependency 'rake', '~> 12.3'
|
28
|
-
spec.add_development_dependency 'minitest', '~> 5.11'
|
29
|
-
spec.add_runtime_dependency 'activesupport', '~> 5.1'
|
28
|
+
spec.add_runtime_dependency 'activerecord', '~> 6.0'
|
30
29
|
spec.add_runtime_dependency 'scrypt', '~> 3.0'
|
31
30
|
end
|
data/lib/cow_auth/user.rb
CHANGED
@@ -1,19 +1,16 @@
|
|
1
|
+
require 'active_record'
|
1
2
|
require 'scrypt'
|
2
3
|
|
3
4
|
module CowAuth
|
4
|
-
|
5
|
-
|
5
|
+
class User < ActiveRecord::Base
|
6
|
+
after_initialize :generate_sid_if_necessary
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
validates :sid, presence: true
|
14
|
-
validates :sid, uniqueness: true
|
15
|
-
validates :sid, format: { with: /\AC[a-z0-9]{32}\z/ }
|
16
|
-
end
|
8
|
+
validates :email, presence: true
|
9
|
+
validates :email, uniqueness: true
|
10
|
+
validates :encrypted_password, presence: true
|
11
|
+
validates :sid, presence: true
|
12
|
+
validates :sid, uniqueness: true
|
13
|
+
validates :sid, format: { with: /\AC[a-z0-9]{32}\z/ }
|
17
14
|
|
18
15
|
def authenticate_with_password(password)
|
19
16
|
return false if self.encrypted_password.blank?
|
data/lib/cow_auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cow_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickey Cowden
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.16'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '12.3'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '12.3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '5.11'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '5.11'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: activesupport
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '5.1'
|
19
|
+
version: '6.0'
|
62
20
|
type: :runtime
|
63
21
|
prerelease: false
|
64
22
|
version_requirements: !ruby/object:Gem::Requirement
|
65
23
|
requirements:
|
66
24
|
- - "~>"
|
67
25
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
26
|
+
version: '6.0'
|
69
27
|
- !ruby/object:Gem::Dependency
|
70
28
|
name: scrypt
|
71
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,10 +38,10 @@ dependencies:
|
|
80
38
|
- - "~>"
|
81
39
|
- !ruby/object:Gem::Version
|
82
40
|
version: '3.0'
|
83
|
-
description: The
|
84
|
-
|
41
|
+
description: The goal of this gem is to provide token-based authentication for Rails
|
42
|
+
(or Rails-like) web applications.
|
85
43
|
email:
|
86
|
-
- mickey@
|
44
|
+
- mickey@cowden.tech
|
87
45
|
executables: []
|
88
46
|
extensions: []
|
89
47
|
extra_rdoc_files: []
|
@@ -110,24 +68,26 @@ files:
|
|
110
68
|
homepage: https://github.com/mickey13/cow-auth
|
111
69
|
licenses:
|
112
70
|
- MIT
|
113
|
-
metadata:
|
71
|
+
metadata:
|
72
|
+
homepage_uri: https://github.com/mickey13/cow-auth
|
73
|
+
source_code_uri: https://github.com/mickey13/cow-auth
|
74
|
+
changelog_uri: https://github.com/mickey13/cow-auth
|
114
75
|
post_install_message:
|
115
76
|
rdoc_options: []
|
116
77
|
require_paths:
|
117
78
|
- lib
|
118
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
80
|
requirements:
|
120
|
-
- - "
|
81
|
+
- - ">="
|
121
82
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
83
|
+
version: 2.3.0
|
123
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
85
|
requirements:
|
125
86
|
- - ">="
|
126
87
|
- !ruby/object:Gem::Version
|
127
88
|
version: '0'
|
128
89
|
requirements: []
|
129
|
-
|
130
|
-
rubygems_version: 2.7.7
|
90
|
+
rubygems_version: 3.1.4
|
131
91
|
signing_key:
|
132
92
|
specification_version: 4
|
133
93
|
summary: Authentication gem
|