glogin 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codecov.yml +3 -2
- data/.github/workflows/pdd.yml +6 -2
- data/.github/workflows/rake.yml +1 -1
- data/.github/workflows/xcop.yml +1 -1
- data/.rultor.yml +2 -3
- data/.simplecov +1 -1
- data/Gemfile +8 -8
- data/LICENSE.txt +1 -1
- data/Rakefile +1 -1
- data/glogin.gemspec +1 -1
- data/lib/glogin/auth.rb +14 -2
- data/lib/glogin/codec.rb +2 -2
- data/lib/glogin/cookie.rb +2 -2
- data/lib/glogin/version.rb +3 -3
- data/lib/glogin.rb +2 -2
- data/test/glogin/test_auth.rb +6 -1
- data/test/glogin/test_codec.rb +1 -1
- data/test/glogin/test_cookie.rb +1 -1
- data/test/test__helper.rb +1 -1
- data/test/test_glogin.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 276e84fbfff7c015118724369f25d3d5da61fae762762cf96c5bd53fc1bbf7b0
|
4
|
+
data.tar.gz: 445af8bffcb5359e4e8170b7b9abe0596d28b538b0f07bde510245a0e03b4196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 466d1bdf480926b5b25d088560df94937adfa0c16a4156aaed125a5c37283d0ae3c2f4bcef8c0a3fc56d55802a198f43885557d528c941c1b257dec7ce7df02b
|
7
|
+
data.tar.gz: f9ffc87fc989b4969e4dcc96d10398ff7702f947f910048d56545bb6db0fb69b15f0752ad08549036e4ad8933c0fdd2c4ae6a835383d0f60edd052ba45c27cbe
|
@@ -8,13 +8,14 @@ jobs:
|
|
8
8
|
codecov:
|
9
9
|
runs-on: ubuntu-22.04
|
10
10
|
steps:
|
11
|
-
- uses: actions/checkout@
|
11
|
+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
12
12
|
- uses: ruby/setup-ruby@v1
|
13
13
|
with:
|
14
14
|
ruby-version: 2.7
|
15
15
|
- run: bundle update
|
16
16
|
- run: bundle exec rake
|
17
|
-
- uses: codecov/codecov-action@
|
17
|
+
- uses: codecov/codecov-action@v4.0.0-beta.3
|
18
18
|
with:
|
19
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
19
20
|
file: coverage/.resultset.json
|
20
21
|
fail_ci_if_error: true
|
data/.github/workflows/pdd.yml
CHANGED
@@ -2,10 +2,14 @@
|
|
2
2
|
name: pdd
|
3
3
|
on:
|
4
4
|
push:
|
5
|
+
branches:
|
6
|
+
- master
|
5
7
|
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
6
10
|
jobs:
|
7
11
|
pdd:
|
8
12
|
runs-on: ubuntu-22.04
|
9
13
|
steps:
|
10
|
-
- uses: actions/checkout@
|
11
|
-
- uses:
|
14
|
+
- uses: actions/checkout@v4
|
15
|
+
- uses: volodya-lombrozo/pdd-action@master
|
data/.github/workflows/rake.yml
CHANGED
data/.github/workflows/xcop.yml
CHANGED
data/.rultor.yml
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
docker:
|
2
|
-
image: yegor256/rultor-image:1.
|
2
|
+
image: yegor256/rultor-image:1.22.0
|
3
3
|
assets:
|
4
4
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
5
5
|
install: |
|
6
|
-
sudo gem install openssl -- --with-openssl-dir=/usr/local/rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/openssl
|
7
6
|
pdd -f /dev/null
|
8
|
-
|
7
|
+
bundle install --no-color
|
9
8
|
release:
|
10
9
|
pre: false
|
11
10
|
script: |-
|
data/.simplecov
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,11 +24,11 @@
|
|
24
24
|
source 'https://rubygems.org'
|
25
25
|
gemspec
|
26
26
|
|
27
|
-
gem 'minitest', '5.
|
28
|
-
gem 'rake', '13.0
|
29
|
-
gem 'rdoc', '6.
|
30
|
-
gem 'rspec-rails', '6.0
|
31
|
-
gem 'rubocop', '1.
|
32
|
-
gem 'rubocop-rspec', '2.
|
27
|
+
gem 'minitest', '5.20.0', require: false
|
28
|
+
gem 'rake', '13.1.0', require: false
|
29
|
+
gem 'rdoc', '6.6.1', require: false
|
30
|
+
gem 'rspec-rails', '6.1.0', require: false
|
31
|
+
gem 'rubocop', '1.60.1', require: false
|
32
|
+
gem 'rubocop-rspec', '2.26.1', require: false
|
33
33
|
gem 'simplecov', '0.22.0', require: false
|
34
|
-
gem 'webmock', '3.
|
34
|
+
gem 'webmock', '3.19.1', require: false
|
data/LICENSE.txt
CHANGED
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/glogin.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2017-
|
3
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/lib/glogin/auth.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require 'cgi'
|
|
28
28
|
|
29
29
|
# GLogin main module.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2017-
|
31
|
+
# Copyright:: Copyright (c) 2017-2024 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
module GLogin
|
34
34
|
#
|
@@ -48,7 +48,19 @@ module GLogin
|
|
48
48
|
"https://github.com/login/oauth/authorize?client_id=#{CGI.escape(@id)}&redirect_uri=#{CGI.escape(@redirect)}"
|
49
49
|
end
|
50
50
|
|
51
|
+
# Returns a hash with information about Github user,
|
52
|
+
# who just logged in with the authentication code.
|
53
|
+
#
|
54
|
+
# API: https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user
|
51
55
|
def user(code)
|
56
|
+
if @secret.empty?
|
57
|
+
return {
|
58
|
+
'id' => 526_301,
|
59
|
+
'type' => 'User',
|
60
|
+
'login' => 'yegor256',
|
61
|
+
'avatar_url' => 'https://github.com/yegor256.png'
|
62
|
+
}
|
63
|
+
end
|
52
64
|
raise 'Code can\'t be nil' if code.nil?
|
53
65
|
uri = URI.parse('https://api.github.com/user')
|
54
66
|
http = Net::HTTP.new(uri.host, uri.port)
|
data/lib/glogin/codec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -29,7 +29,7 @@ require 'base64'
|
|
29
29
|
|
30
30
|
# Codec.
|
31
31
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
-
# Copyright:: Copyright (c) 2017-
|
32
|
+
# Copyright:: Copyright (c) 2017-2024 Yegor Bugayenko
|
33
33
|
# License:: MIT
|
34
34
|
module GLogin
|
35
35
|
# The codec
|
data/lib/glogin/cookie.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative 'codec'
|
|
28
28
|
|
29
29
|
# GLogin main module.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2017-
|
31
|
+
# Copyright:: Copyright (c) 2017-2024 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
module GLogin
|
34
34
|
# Split symbol inside the cookie text
|
data/lib/glogin/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -23,8 +23,8 @@
|
|
23
23
|
|
24
24
|
# GLogin main module.
|
25
25
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
26
|
-
# Copyright:: Copyright (c) 2017-
|
26
|
+
# Copyright:: Copyright (c) 2017-2024 Yegor Bugayenko
|
27
27
|
# License:: MIT
|
28
28
|
module GLogin
|
29
|
-
VERSION = '0.
|
29
|
+
VERSION = '0.14.0'
|
30
30
|
end
|
data/lib/glogin.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -28,7 +28,7 @@ require_relative 'glogin/cookie'
|
|
28
28
|
|
29
29
|
# GLogin main module.
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
-
# Copyright:: Copyright (c) 2017-
|
31
|
+
# Copyright:: Copyright (c) 2017-2024 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
33
|
module GLogin
|
34
34
|
end
|
data/test/glogin/test_auth.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -53,4 +53,9 @@ class TestAuth < Minitest::Test
|
|
53
53
|
)
|
54
54
|
)
|
55
55
|
end
|
56
|
+
|
57
|
+
def test_get_fake_user
|
58
|
+
auth = GLogin::Auth.new('99999', '', 'http://www.example.com/github-oauth')
|
59
|
+
assert_equal('yegor256', auth.user('1234567890')['login'])
|
60
|
+
end
|
56
61
|
end
|
data/test/glogin/test_codec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/test/glogin/test_cookie.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/test/test__helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/test/test_glogin.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2017-
|
4
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -26,7 +26,7 @@ require_relative '../lib/glogin'
|
|
26
26
|
|
27
27
|
# GLogin main module test.
|
28
28
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
-
# Copyright:: Copyright (c) 2017-
|
29
|
+
# Copyright:: Copyright (c) 2017-2024 Yegor Bugayenko
|
30
30
|
# License:: MIT
|
31
31
|
class TestGLogin < Minitest::Test
|
32
32
|
def test_basic
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glogin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base58
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.4.10
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Login/logout via GitHub OAuth for your web app
|