glogin 0.1
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.
- checksums.yaml +7 -0
- data/.0pdd.yml +5 -0
- data/.gitattributes +7 -0
- data/.gitignore +7 -0
- data/.pdd +7 -0
- data/.rubocop.yml +12 -0
- data/.rultor.yml +30 -0
- data/.simplecov +40 -0
- data/.travis.yml +13 -0
- data/Gemfile +24 -0
- data/LICENSE.txt +21 -0
- data/README.md +123 -0
- data/Rakefile +69 -0
- data/glogin.gemspec +56 -0
- data/lib/glogin.rb +33 -0
- data/lib/glogin/auth.rb +83 -0
- data/lib/glogin/cookie.rb +79 -0
- data/lib/glogin/version.rb +29 -0
- data/test/glogin/test_auth.rb +37 -0
- data/test/glogin/test_cookie.rb +54 -0
- data/test/test__helper.rb +33 -0
- data/test/test_glogin.rb +33 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a61975b7b33a2de14aff6ac64804a0d84331706d
|
4
|
+
data.tar.gz: 55e804665207f6a949990f47f37b87bee1ca5ea7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0ed68aaaaee03c326c7a6c17fd8073de6c3c63a66bce37f4b3a61e1b4134b2c4d642416f855a24c406be249b2d220d93f44c7b1c7d1359c24a3e2014558ae5bd
|
7
|
+
data.tar.gz: a88c40580a5e1cc4cb85f5d3f11b6c86fd4ed074dcf8b100323475e974ee93628f65ddb17e54148e1e7a812db9b240e22c2f5bba595e70291dc81799122f6ddd
|
data/.0pdd.yml
ADDED
data/.gitattributes
ADDED
data/.gitignore
ADDED
data/.pdd
ADDED
data/.rubocop.yml
ADDED
data/.rultor.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
assets:
|
2
|
+
rubygems.yml: zerocracy/home#assets/rubygems.yml
|
3
|
+
s3cfg: zerocracy/home#assets/s3cfg
|
4
|
+
install: |
|
5
|
+
sudo apt-get -y update
|
6
|
+
sudo gem install pdd
|
7
|
+
release:
|
8
|
+
script: |-
|
9
|
+
bundle install
|
10
|
+
rake
|
11
|
+
rm -rf *.gem
|
12
|
+
sed -i "s/1\.0\.snapshot/${tag}/g" lib/glogin/version.rb
|
13
|
+
git add lib/glogin/version.rb
|
14
|
+
git commit -m "version set to ${tag}"
|
15
|
+
gem build glogin.gemspec
|
16
|
+
chmod 0600 ../rubygems.yml
|
17
|
+
gem push *.gem --config-file ../rubygems.yml
|
18
|
+
commanders:
|
19
|
+
- yegor256
|
20
|
+
architect:
|
21
|
+
- yegor256
|
22
|
+
merge:
|
23
|
+
script: |-
|
24
|
+
bundle install
|
25
|
+
rake
|
26
|
+
pdd
|
27
|
+
deploy:
|
28
|
+
script: |-
|
29
|
+
echo "There is nothing to deploy"
|
30
|
+
exit -1
|
data/.simplecov
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
if Gem.win_platform? then
|
24
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
25
|
+
SimpleCov::Formatter::HTMLFormatter
|
26
|
+
]
|
27
|
+
SimpleCov.start do
|
28
|
+
add_filter "/test/"
|
29
|
+
add_filter "/features/"
|
30
|
+
end
|
31
|
+
else
|
32
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
33
|
+
[SimpleCov::Formatter::HTMLFormatter]
|
34
|
+
)
|
35
|
+
SimpleCov.start do
|
36
|
+
add_filter "/test/"
|
37
|
+
add_filter "/features/"
|
38
|
+
minimum_coverage 40
|
39
|
+
end
|
40
|
+
end
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
source 'https://rubygems.org'
|
24
|
+
gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
[](http://www.zerocracy.com)
|
2
|
+
[](http://www.rultor.com/p/yegor256/glogin)
|
3
|
+
[](https://www.jetbrains.com/ruby/)
|
4
|
+
|
5
|
+
[](https://travis-ci.org/yegor256/glogin)
|
6
|
+
[](http://www.0pdd.com/p?name=yegor256/glogin)
|
7
|
+
[](http://badge.fury.io/rb/glogin)
|
8
|
+
[](https://gemnasium.com/yegor256/glogin)
|
9
|
+
[](https://codeclimate.com/github/yegor256/glogin)
|
10
|
+
[](https://codecov.io/github/yegor256/glogin?branch=master)
|
11
|
+
|
12
|
+
## GitHub Login for Ruby web app
|
13
|
+
|
14
|
+
This simple gem will help you enable login/logout through
|
15
|
+
GitHub OAuth for your web application. This is how it works with
|
16
|
+
Sinatra, but you can do something similar in any framework.
|
17
|
+
|
18
|
+
First, somewhere in the global space, before the app starts:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
require 'glogin'
|
22
|
+
configure do
|
23
|
+
set :glogin, GLogin::Auth.new(
|
24
|
+
// Make sure their values are coming from a secure
|
25
|
+
// place and are not visible in the source code:
|
26
|
+
client_id, client_secret,
|
27
|
+
// This is what you will register in GitHub as a callback URL:
|
28
|
+
'http://www.example.com/github-oauth'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
Next, for all web pages we need to parse a cookie, if it exists,
|
34
|
+
and convert it into a user:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
before '/*' do
|
38
|
+
if cookies[:glogin]
|
39
|
+
begin
|
40
|
+
@user = Cookie::Closed.new(
|
41
|
+
cookies[:glogin],
|
42
|
+
// This must be some long text to be used to
|
43
|
+
// encrypt the value in the cookie.
|
44
|
+
secret
|
45
|
+
).to_user
|
46
|
+
rescue OpenSSL::Cipher::CipherError => _
|
47
|
+
@user = nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
If the `glogin` cookie is coming it and it contains a valid data,
|
54
|
+
a local variable `@user` will be set to something like this:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
{ login: 'yegor256', avatar: 'http://...' }
|
58
|
+
```
|
59
|
+
|
60
|
+
Next, we need a URL for GitHub OAuth callback:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
get '/github-oauth' do
|
64
|
+
cookies[:glogin] = Cookie::Open.new(
|
65
|
+
settings.glogin.user(params[:code]),
|
66
|
+
// The same encryption secret that we were using above:
|
67
|
+
secret
|
68
|
+
).to_s
|
69
|
+
redirect to('/')
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
Finally, we need a logout URL:
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
get '/logout' do
|
77
|
+
cookies.delete(:glogin)
|
78
|
+
redirect to('/')
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
One more thing is the login URL you will need for your front page. Here
|
83
|
+
it is:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
settings.glogin.login_uri
|
87
|
+
```
|
88
|
+
|
89
|
+
For unit testing you can just provide an empty string as a `secret` for
|
90
|
+
`Cookie::Open` and `Cookie::Closed` and the encryption will be disabled:
|
91
|
+
whatever will be coming from the cookie will be trusted.
|
92
|
+
|
93
|
+
I use this gem in [sixnines](https://github.com/yegor256/sixnines)
|
94
|
+
and [0pdd](https://github.com/yegor256/0pdd) web apps.
|
95
|
+
They both are using Sinatra.
|
96
|
+
|
97
|
+
## How to contribute?
|
98
|
+
|
99
|
+
Just submit a pull request. Make sure `rake` passes.
|
100
|
+
|
101
|
+
## License
|
102
|
+
|
103
|
+
(The MIT License)
|
104
|
+
|
105
|
+
Copyright (c) 2017 Yegor Bugayenko
|
106
|
+
|
107
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
108
|
+
of this software and associated documentation files (the 'Software'), to deal
|
109
|
+
in the Software without restriction, including without limitation the rights
|
110
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
111
|
+
copies of the Software, and to permit persons to whom the Software is
|
112
|
+
furnished to do so, subject to the following conditions:
|
113
|
+
|
114
|
+
The above copyright notice and this permission notice shall be included in all
|
115
|
+
copies or substantial portions of the Software.
|
116
|
+
|
117
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
118
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
119
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
120
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
121
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
122
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
123
|
+
SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'rubygems'
|
24
|
+
require 'rake'
|
25
|
+
require 'rdoc'
|
26
|
+
require 'rake/clean'
|
27
|
+
|
28
|
+
def name
|
29
|
+
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
30
|
+
end
|
31
|
+
|
32
|
+
def version
|
33
|
+
Gem::Specification.load(Dir['*.gemspec'].first).version
|
34
|
+
end
|
35
|
+
|
36
|
+
task default: [:clean, :test, :rubocop, :copyright]
|
37
|
+
|
38
|
+
require 'rake/testtask'
|
39
|
+
desc 'Run all unit tests'
|
40
|
+
Rake::TestTask.new(:test) do |test|
|
41
|
+
Rake::Cleaner.cleanup_files(['coverage'])
|
42
|
+
test.libs << 'lib' << 'test'
|
43
|
+
test.pattern = 'test/**/test_*.rb'
|
44
|
+
test.verbose = false
|
45
|
+
end
|
46
|
+
|
47
|
+
require 'rdoc/task'
|
48
|
+
desc 'Build RDoc documentation'
|
49
|
+
Rake::RDocTask.new do |rdoc|
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "#{name} #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
55
|
+
|
56
|
+
require 'rubocop/rake_task'
|
57
|
+
desc 'Run RuboCop on all directories'
|
58
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
59
|
+
task.fail_on_error = true
|
60
|
+
task.requires << 'rubocop-rspec'
|
61
|
+
end
|
62
|
+
|
63
|
+
task :copyright do
|
64
|
+
sh "grep -q -r '#{Date.today.strftime('%Y')}' \
|
65
|
+
--include '*.rb' \
|
66
|
+
--include '*.txt' \
|
67
|
+
--include 'Rakefile' \
|
68
|
+
."
|
69
|
+
end
|
data/glogin.gemspec
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'English'
|
24
|
+
|
25
|
+
lib = File.expand_path('../lib', __FILE__)
|
26
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
27
|
+
require_relative 'lib/glogin/version'
|
28
|
+
|
29
|
+
Gem::Specification.new do |s|
|
30
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
31
|
+
if s.respond_to? :required_rubygems_version=
|
32
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
33
|
+
end
|
34
|
+
s.rubygems_version = '2.2.2'
|
35
|
+
s.required_ruby_version = '>= 1.9.3'
|
36
|
+
s.name = 'glogin'
|
37
|
+
s.version = GLogin::VERSION
|
38
|
+
s.license = 'MIT'
|
39
|
+
s.summary = 'Login/logout via GitHub OAuth for your web app'
|
40
|
+
s.description = 'Enables login/logout functionality for a Ruby web app'
|
41
|
+
s.authors = ['Yegor Bugayenko']
|
42
|
+
s.email = 'yegor256@gmail.com'
|
43
|
+
s.homepage = 'http://github.com/yegor256/glogin'
|
44
|
+
s.files = `git ls-files`.split($RS)
|
45
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
46
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
47
|
+
s.rdoc_options = ['--charset=UTF-8']
|
48
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
49
|
+
s.add_development_dependency 'rake', '12.0.0'
|
50
|
+
s.add_development_dependency 'codecov', '0.1.10'
|
51
|
+
s.add_development_dependency 'rdoc', '4.2.0'
|
52
|
+
s.add_development_dependency 'minitest', '5.5.0'
|
53
|
+
s.add_development_dependency 'rubocop', '0.41.2'
|
54
|
+
s.add_development_dependency 'rubocop-rspec', '1.5.1'
|
55
|
+
s.add_development_dependency 'rspec-rails', '3.1.0'
|
56
|
+
end
|
data/lib/glogin.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'nokogiri'
|
24
|
+
require_relative 'glogin/version'
|
25
|
+
require_relative 'glogin/auth'
|
26
|
+
require_relative 'glogin/cookie'
|
27
|
+
|
28
|
+
# GLogin main module.
|
29
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
+
# Copyright:: Copyright (c) 2017 Yegor Bugayenko
|
31
|
+
# License:: MIT
|
32
|
+
module GLogin
|
33
|
+
end
|
data/lib/glogin/auth.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'net/http'
|
24
|
+
require 'uri'
|
25
|
+
require 'yaml'
|
26
|
+
require 'json'
|
27
|
+
require 'cgi'
|
28
|
+
|
29
|
+
# GLogin main module.
|
30
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
+
# Copyright:: Copyright (c) 2017 Yegor Bugayenko
|
32
|
+
# License:: MIT
|
33
|
+
module GLogin
|
34
|
+
#
|
35
|
+
# GitHub auth mechanism
|
36
|
+
#
|
37
|
+
class Auth
|
38
|
+
def initialize(id, secret, redirect)
|
39
|
+
@id = id
|
40
|
+
@secret = secret
|
41
|
+
@redirect = redirect
|
42
|
+
end
|
43
|
+
|
44
|
+
def login_uri
|
45
|
+
'https://github.com/login/oauth/authorize?client_id=' +
|
46
|
+
CGI.escape(@id) +
|
47
|
+
'&redirect_uri=' +
|
48
|
+
CGI.escape(@redirect)
|
49
|
+
end
|
50
|
+
|
51
|
+
def user(code)
|
52
|
+
uri = URI.parse('https://api.github.com/user')
|
53
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
54
|
+
http.use_ssl = true
|
55
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
56
|
+
req = Net::HTTP::Get.new(uri.request_uri)
|
57
|
+
req['Accept-Header'] = 'application/json'
|
58
|
+
req['Authorization'] = "token #{access_token(code)}"
|
59
|
+
res = http.request(req)
|
60
|
+
JSON.parse(res.body)
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def access_token(code)
|
66
|
+
uri = URI.parse('https://github.com/login/oauth/access_token')
|
67
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
68
|
+
http.use_ssl = true
|
69
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
70
|
+
req = Net::HTTP::Post.new(uri.request_uri)
|
71
|
+
req.set_form_data(
|
72
|
+
'code' => code,
|
73
|
+
'client_id' => @id,
|
74
|
+
'client_secret' => @secret
|
75
|
+
)
|
76
|
+
req['Accept'] = 'application/json'
|
77
|
+
res = http.request(req)
|
78
|
+
raise "Error (#{res.code}): #{res.body}" unless res.code == '200'
|
79
|
+
puts res.body
|
80
|
+
JSON.parse(res.body)['access_token']
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'openssl'
|
24
|
+
require 'digest/sha1'
|
25
|
+
require 'base64'
|
26
|
+
|
27
|
+
# GLogin main module.
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2017 Yegor Bugayenko
|
30
|
+
# License:: MIT
|
31
|
+
module GLogin
|
32
|
+
#
|
33
|
+
# Secure cookie
|
34
|
+
#
|
35
|
+
class Cookie
|
36
|
+
# Closed
|
37
|
+
class Closed
|
38
|
+
def initialize(text, secret)
|
39
|
+
@text = text
|
40
|
+
@secret = secret
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_user
|
44
|
+
if @secret.empty?
|
45
|
+
@text
|
46
|
+
else
|
47
|
+
cpr = Cookie.cipher
|
48
|
+
cpr.decrypt
|
49
|
+
cpr.key = Digest::SHA1.hexdigest(@secret)
|
50
|
+
decrypted = cpr.update(Base64.decode64(@text))
|
51
|
+
decrypted << cpr.final
|
52
|
+
parts = decrypted.to_s.split('|')
|
53
|
+
{ login: parts[0], avatar: parts[1] }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Open
|
59
|
+
class Open
|
60
|
+
def initialize(json, secret)
|
61
|
+
@json = json
|
62
|
+
@secret = secret
|
63
|
+
end
|
64
|
+
|
65
|
+
def to_s
|
66
|
+
cpr = Cookie.cipher
|
67
|
+
cpr.encrypt
|
68
|
+
cpr.key = Digest::SHA1.hexdigest(@secret)
|
69
|
+
encrypted = cpr.update("#{@json['login']}|#{@json['avatar']}")
|
70
|
+
encrypted << cpr.final
|
71
|
+
Base64.encode64(encrypted.to_s)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.cipher
|
76
|
+
OpenSSL::Cipher::Cipher.new('aes-256-cbc')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
# GLogin main module.
|
24
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
25
|
+
# Copyright:: Copyright (c) 2017 Yegor Bugayenko
|
26
|
+
# License:: MIT
|
27
|
+
module GLogin
|
28
|
+
VERSION = '0.1'.freeze
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'minitest/autorun'
|
24
|
+
require_relative '../../lib/glogin/cookie'
|
25
|
+
|
26
|
+
class TestAuth < Minitest::Test
|
27
|
+
def test_login_uri
|
28
|
+
auth = GLogin::Auth.new(
|
29
|
+
'client_id', 'client_secret', 'http://www.example.com/github-oauth'
|
30
|
+
)
|
31
|
+
assert(
|
32
|
+
auth.login_uri.start_with?(
|
33
|
+
'https://github.com/login/oauth/authorize'
|
34
|
+
)
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'minitest/autorun'
|
24
|
+
require_relative '../../lib/glogin/cookie'
|
25
|
+
|
26
|
+
class TestCookie < Minitest::Test
|
27
|
+
def test_encrypts_and_decrypts
|
28
|
+
secret = 'this&84-- (832=_'
|
29
|
+
user = GLogin::Cookie::Closed.new(
|
30
|
+
GLogin::Cookie::Open.new(
|
31
|
+
JSON.parse(
|
32
|
+
"{\"login\":\"yegor256\",\
|
33
|
+
\"avatar\":\"https://avatars1.githubusercontent.com/u/526301\"}"
|
34
|
+
),
|
35
|
+
secret
|
36
|
+
).to_s,
|
37
|
+
secret
|
38
|
+
).to_user
|
39
|
+
assert(user[:login] == 'yegor256')
|
40
|
+
assert(user[:avatar] == 'https://avatars1.githubusercontent.com/u/526301')
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_fails_on_broken_text
|
44
|
+
assert_raises OpenSSL::Cipher::CipherError do
|
45
|
+
GLogin::Cookie::Closed.new(
|
46
|
+
GLogin::Cookie::Open.new(
|
47
|
+
JSON.parse('{"login":"x","avatar":"x"}'),
|
48
|
+
'secret-1'
|
49
|
+
).to_s,
|
50
|
+
'secret-2'
|
51
|
+
).to_user
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
STDOUT.sync = true
|
24
|
+
|
25
|
+
require 'simplecov'
|
26
|
+
SimpleCov.start
|
27
|
+
if ENV['CI'] == 'true'
|
28
|
+
require 'codecov'
|
29
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
30
|
+
end
|
31
|
+
|
32
|
+
require 'minitest/autorun'
|
33
|
+
require_relative '../lib/glogin'
|
data/test/test_glogin.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'minitest/autorun'
|
24
|
+
require_relative '../lib/glogin'
|
25
|
+
|
26
|
+
# GLogin main module test.
|
27
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
28
|
+
# Copyright:: Copyright (c) 2017 Yegor Bugayenko
|
29
|
+
# License:: MIT
|
30
|
+
class TestGLogin < Minitest::Test
|
31
|
+
def test_basic
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: glogin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yegor Bugayenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 12.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 12.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: codecov
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.10
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.10
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.2.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.2.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 5.5.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 5.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.41.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.41.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.5.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.5.1
|
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: 3.1.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.1.0
|
111
|
+
description: Enables login/logout functionality for a Ruby web app
|
112
|
+
email: yegor256@gmail.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files:
|
116
|
+
- README.md
|
117
|
+
- LICENSE.txt
|
118
|
+
files:
|
119
|
+
- ".0pdd.yml"
|
120
|
+
- ".gitattributes"
|
121
|
+
- ".gitignore"
|
122
|
+
- ".pdd"
|
123
|
+
- ".rubocop.yml"
|
124
|
+
- ".rultor.yml"
|
125
|
+
- ".simplecov"
|
126
|
+
- ".travis.yml"
|
127
|
+
- Gemfile
|
128
|
+
- LICENSE.txt
|
129
|
+
- README.md
|
130
|
+
- Rakefile
|
131
|
+
- glogin.gemspec
|
132
|
+
- lib/glogin.rb
|
133
|
+
- lib/glogin/auth.rb
|
134
|
+
- lib/glogin/cookie.rb
|
135
|
+
- lib/glogin/version.rb
|
136
|
+
- test/glogin/test_auth.rb
|
137
|
+
- test/glogin/test_cookie.rb
|
138
|
+
- test/test__helper.rb
|
139
|
+
- test/test_glogin.rb
|
140
|
+
homepage: http://github.com/yegor256/glogin
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options:
|
146
|
+
- "--charset=UTF-8"
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 1.9.3
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
requirements: []
|
160
|
+
rubyforge_project:
|
161
|
+
rubygems_version: 2.6.8
|
162
|
+
signing_key:
|
163
|
+
specification_version: 2
|
164
|
+
summary: Login/logout via GitHub OAuth for your web app
|
165
|
+
test_files:
|
166
|
+
- test/glogin/test_auth.rb
|
167
|
+
- test/glogin/test_cookie.rb
|
168
|
+
- test/test__helper.rb
|
169
|
+
- test/test_glogin.rb
|