glogin 0.14.2 → 0.16.0
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 +4 -4
- data/.0pdd.yml +20 -0
- data/.github/workflows/actionlint.yml +41 -0
- data/.github/workflows/codecov.yml +20 -1
- data/.github/workflows/copyrights.yml +30 -0
- data/.github/workflows/markdown-lint.yml +38 -0
- data/.github/workflows/pdd.yml +19 -0
- data/.github/workflows/rake.yml +23 -4
- data/.github/workflows/xcop.yml +20 -1
- data/.rubocop.yml +20 -0
- data/.rultor.yml +21 -1
- data/Gemfile +7 -7
- data/README.md +16 -11
- data/glogin.gemspec +2 -2
- data/lib/glogin/auth.rb +18 -5
- data/lib/glogin/cookie.rb +9 -5
- data/lib/glogin/version.rb +1 -1
- data/test/glogin/test_cookie.rb +15 -15
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f95b5783be06871b3fcc570c2c931aa4805df8d9eba5fd3e56efdc324b828947
|
4
|
+
data.tar.gz: 59bad949654ddf467ee7c3c7e520cb885682227fd2b19e2f52131a299d69e0ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22863efe1b00bb8fb9da9727d173e2b884986496f50be8d1c4f7fead6f16383ac0be0f2ee5c2acb66834d558e67e290a6855b622e94738f86c729e371abe609d
|
7
|
+
data.tar.gz: 822e2f1c55dada3a6cb2dd5cfc15f77ebb6762bab9f7ad23d270612d94e6489c3352f92973c6491e009d02af955a9522a734419dc6dac1d26b7da9edc9e88c2f
|
data/.0pdd.yml
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
1
21
|
errors:
|
2
22
|
- yegor256@gmail.com
|
3
23
|
# alerts:
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: actionlint
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
branches:
|
25
|
+
- master
|
26
|
+
pull_request:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
jobs:
|
30
|
+
actionlint:
|
31
|
+
runs-on: ubuntu-22.04
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v4
|
34
|
+
- name: Download actionlint
|
35
|
+
id: get_actionlint
|
36
|
+
# yamllint disable-line rule:line-length
|
37
|
+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
38
|
+
shell: bash
|
39
|
+
- name: Check workflow files
|
40
|
+
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
41
|
+
shell: bash
|
@@ -1,3 +1,22 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
1
20
|
---
|
2
21
|
name: codecov
|
3
22
|
on:
|
@@ -8,7 +27,7 @@ jobs:
|
|
8
27
|
codecov:
|
9
28
|
runs-on: ubuntu-22.04
|
10
29
|
steps:
|
11
|
-
- uses: actions/checkout@
|
30
|
+
- uses: actions/checkout@v4
|
12
31
|
- uses: ruby/setup-ruby@v1
|
13
32
|
with:
|
14
33
|
ruby-version: 2.7
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: copyrights
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
pull_request:
|
25
|
+
jobs:
|
26
|
+
copyrights:
|
27
|
+
runs-on: ubuntu-22.04
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v4
|
30
|
+
- uses: yegor256/copyrights-action@0.0.4
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
21
|
+
name: markdown-lint
|
22
|
+
'on':
|
23
|
+
push:
|
24
|
+
branches:
|
25
|
+
- master
|
26
|
+
pull_request:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
paths-ignore: ['paper/**', 'sandbox/**']
|
30
|
+
concurrency:
|
31
|
+
group: markdown-lint-${{ github.ref }}
|
32
|
+
cancel-in-progress: true
|
33
|
+
jobs:
|
34
|
+
markdown-lint:
|
35
|
+
runs-on: ubuntu-22.04
|
36
|
+
steps:
|
37
|
+
- uses: actions/checkout@v4
|
38
|
+
- uses: articulate/actions-markdownlint@v1
|
data/.github/workflows/pdd.yml
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
1
20
|
---
|
2
21
|
name: pdd
|
3
22
|
on:
|
data/.github/workflows/rake.yml
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
1
20
|
---
|
2
21
|
name: rake
|
3
22
|
on:
|
@@ -8,15 +27,15 @@ on:
|
|
8
27
|
branches:
|
9
28
|
- master
|
10
29
|
jobs:
|
11
|
-
|
30
|
+
rake:
|
12
31
|
name: test
|
13
32
|
strategy:
|
14
33
|
matrix:
|
15
|
-
os: [ubuntu-
|
16
|
-
ruby: [2.7, 3.
|
34
|
+
os: [ubuntu-22.04, macos-12]
|
35
|
+
ruby: [2.7, 3.3]
|
17
36
|
runs-on: ${{ matrix.os }}
|
18
37
|
steps:
|
19
|
-
- uses: actions/checkout@
|
38
|
+
- uses: actions/checkout@v4
|
20
39
|
- uses: ruby/setup-ruby@v1
|
21
40
|
with:
|
22
41
|
ruby-version: ${{ matrix.ruby }}
|
data/.github/workflows/xcop.yml
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
1
20
|
---
|
2
21
|
name: xcop
|
3
22
|
on:
|
@@ -7,5 +26,5 @@ jobs:
|
|
7
26
|
xcop:
|
8
27
|
runs-on: ubuntu-22.04
|
9
28
|
steps:
|
10
|
-
- uses: actions/checkout@
|
29
|
+
- uses: actions/checkout@v4
|
11
30
|
- uses: g4s8/xcop-action@master
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
1
21
|
AllCops:
|
2
22
|
Exclude:
|
3
23
|
- 'bin/**/*'
|
data/.rultor.yml
CHANGED
@@ -1,5 +1,25 @@
|
|
1
|
+
# Copyright (c) 2017-2024 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
---
|
1
21
|
docker:
|
2
|
-
image: yegor256/rultor-image:1.
|
22
|
+
image: yegor256/rultor-image:1.23.1
|
3
23
|
assets:
|
4
24
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
5
25
|
install: |
|
data/Gemfile
CHANGED
@@ -24,11 +24,11 @@
|
|
24
24
|
source 'https://rubygems.org'
|
25
25
|
gemspec
|
26
26
|
|
27
|
-
gem 'minitest', '5.
|
28
|
-
gem 'rake', '13.1
|
29
|
-
gem 'rdoc', '6.
|
30
|
-
gem 'rspec-rails', '6.1.
|
31
|
-
gem 'rubocop', '1.
|
32
|
-
gem 'rubocop-rspec', '
|
27
|
+
gem 'minitest', '5.24.1', require: false
|
28
|
+
gem 'rake', '13.2.1', require: false
|
29
|
+
gem 'rdoc', '6.7.0', require: false
|
30
|
+
gem 'rspec-rails', '6.1.3', require: false
|
31
|
+
gem 'rubocop', '1.65.0', require: false
|
32
|
+
gem 'rubocop-rspec', '3.0.2', require: false
|
33
33
|
gem 'simplecov', '0.22.0', require: false
|
34
|
-
gem 'webmock', '3.
|
34
|
+
gem 'webmock', '3.23.1', require: false
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# OAuth Login via GitHub Made Simple
|
2
2
|
|
3
3
|
[](http://www.rultor.com/p/yegor256/glogin)
|
4
4
|
[](https://www.jetbrains.com/ruby/)
|
@@ -9,18 +9,17 @@
|
|
9
9
|
[](https://codeclimate.com/github/yegor256/glogin/maintainability)
|
10
10
|
[](https://codecov.io/github/yegor256/glogin?branch=master)
|
11
11
|
[](http://rubydoc.info/github/yegor256/glogin/master/frames)
|
12
|
-

|
13
12
|
[](https://hitsofcode.com/view/github/yegor256/glogin)
|
14
13
|
[](https://github.com/yegor256/glogin/blob/master/LICENSE.txt)
|
15
14
|
|
16
15
|
This simple gem will help you enable login/logout through
|
17
|
-
[GitHub OAuth]
|
16
|
+
[GitHub OAuth][doc]
|
18
17
|
for your web application. This is how it works with
|
19
18
|
[Sinatra](http://www.sinatrarb.com/),
|
20
19
|
but you can do something similar in any framework.
|
21
20
|
|
22
21
|
Read this blog post to get the idea:
|
23
|
-
[_Simplified GitHub Login for a Ruby Web App_]
|
22
|
+
[_Simplified GitHub Login for a Ruby Web App_][blog]
|
24
23
|
|
25
24
|
First, somewhere in the global space, before the app starts:
|
26
25
|
|
@@ -105,11 +104,12 @@ settings.glogin.login_uri
|
|
105
104
|
```
|
106
105
|
|
107
106
|
For unit testing you can just provide an empty string as a `secret` for
|
108
|
-
`GLogin::Cookie::Open` and `GLogin::Cookie::Closed`
|
107
|
+
`GLogin::Cookie::Open` and `GLogin::Cookie::Closed`
|
108
|
+
and the encryption will be disabled:
|
109
109
|
whatever will be coming from the cookie will be trusted. For testing
|
110
110
|
it will be convenient to provide a user name in a query string, like:
|
111
111
|
|
112
|
-
```
|
112
|
+
```text
|
113
113
|
http://localhost:9292/?glogin=tester
|
114
114
|
```
|
115
115
|
|
@@ -141,14 +141,19 @@ decrypted = codec.decrypt(encrypted)
|
|
141
141
|
|
142
142
|
## How to contribute
|
143
143
|
|
144
|
-
Read
|
144
|
+
Read
|
145
|
+
[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
145
146
|
Make sure you build is green before you contribute
|
146
|
-
your pull request. You will need to have
|
147
|
+
your pull request. You will need to have
|
148
|
+
[Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
147
149
|
[Bundler](https://bundler.io/) installed. Then:
|
148
150
|
|
149
|
-
```
|
150
|
-
|
151
|
-
|
151
|
+
```bash
|
152
|
+
bundle update
|
153
|
+
bundle exec rake
|
152
154
|
```
|
153
155
|
|
154
156
|
If it's clean and you don't see any error messages, submit your pull request.
|
157
|
+
|
158
|
+
[blog]: https://www.yegor256.com/2018/06/19/glogin.html
|
159
|
+
[doc]: https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/
|
data/glogin.gemspec
CHANGED
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
42
42
|
s.rdoc_options = ['--charset=UTF-8']
|
43
43
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
44
|
-
s.
|
45
|
-
s.
|
44
|
+
s.add_dependency 'base58', '>= 0.2'
|
45
|
+
s.add_dependency 'openssl', '>= 2.0'
|
46
46
|
s.metadata['rubygems_mfa_required'] = 'true'
|
47
47
|
end
|
data/lib/glogin/auth.rb
CHANGED
@@ -41,6 +41,7 @@ module GLogin
|
|
41
41
|
raise "GitHub client secret can't be nil" if secret.nil?
|
42
42
|
@secret = secret
|
43
43
|
raise "Redirect URL can't be nil" if redirect.nil?
|
44
|
+
raise "Redirect URL can't be empty" if redirect.empty?
|
44
45
|
@redirect = redirect
|
45
46
|
end
|
46
47
|
|
@@ -57,20 +58,21 @@ module GLogin
|
|
57
58
|
return {
|
58
59
|
'id' => 526_301,
|
59
60
|
'login' => 'yegor256',
|
60
|
-
'avatar_url' => 'https://github.com/yegor256.png'
|
61
|
-
'bearer' => ''
|
61
|
+
'avatar_url' => 'https://github.com/yegor256.png'
|
62
62
|
}
|
63
63
|
end
|
64
64
|
raise 'Code can\'t be nil' if code.nil?
|
65
|
+
raise 'Code can\'t be empty' if code.empty?
|
65
66
|
uri = URI.parse('https://api.github.com/user')
|
66
67
|
http = Net::HTTP.new(uri.host, uri.port)
|
67
68
|
http.use_ssl = true
|
68
69
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
69
70
|
req = Net::HTTP::Get.new(uri.request_uri)
|
70
71
|
req['Accept-Header'] = 'application/json'
|
71
|
-
|
72
|
+
token = access_token(code)
|
73
|
+
req['Authorization'] = "token #{token}"
|
72
74
|
res = http.request(req)
|
73
|
-
raise "
|
75
|
+
raise "HTTP error ##{res.code} with token #{escape(token)}: #{res.body}" unless res.code == '200'
|
74
76
|
JSON.parse(res.body)
|
75
77
|
end
|
76
78
|
|
@@ -78,6 +80,7 @@ module GLogin
|
|
78
80
|
|
79
81
|
def access_token(code)
|
80
82
|
raise 'Code can\'t be nil' if code.nil?
|
83
|
+
raise 'Code can\'t be empty' if code.empty?
|
81
84
|
uri = URI.parse('https://github.com/login/oauth/access_token')
|
82
85
|
http = Net::HTTP.new(uri.host, uri.port)
|
83
86
|
http.use_ssl = true
|
@@ -90,8 +93,18 @@ module GLogin
|
|
90
93
|
)
|
91
94
|
req['Accept'] = 'application/json'
|
92
95
|
res = http.request(req)
|
93
|
-
raise "
|
96
|
+
raise "HTTP error ##{res.code} with code #{escape(code)}: #{res.body}" unless res.code == '200'
|
94
97
|
JSON.parse(res.body)['access_token']
|
95
98
|
end
|
99
|
+
|
100
|
+
def escape(txt)
|
101
|
+
prefix = 4
|
102
|
+
[
|
103
|
+
'"',
|
104
|
+
txt[0..prefix],
|
105
|
+
'*' * (token.length - prefix),
|
106
|
+
'"'
|
107
|
+
].join
|
108
|
+
end
|
96
109
|
end
|
97
110
|
end
|
data/lib/glogin/cookie.rb
CHANGED
@@ -55,7 +55,7 @@ module GLogin
|
|
55
55
|
@context = context.to_s
|
56
56
|
end
|
57
57
|
|
58
|
-
# Returns a hash with four elements: `id`, `login`,
|
58
|
+
# Returns a hash with four elements: `id`, `login`, and `avatar_url`.
|
59
59
|
#
|
60
60
|
# If the `secret` is empty, the text will not be decrypted, but used
|
61
61
|
# "as is". This may be helpful during testing.
|
@@ -65,20 +65,20 @@ module GLogin
|
|
65
65
|
# to catch in your applicaiton and ignore the login attempt.
|
66
66
|
def to_user
|
67
67
|
plain = Codec.new(@secret).decrypt(@text)
|
68
|
-
id, login,
|
68
|
+
id, login, avatar_url, ctx = plain.split(GLogin::SPLIT, 5)
|
69
69
|
if !@secret.empty? && ctx.to_s != @context
|
70
70
|
raise(
|
71
71
|
GLogin::Codec::DecodingError,
|
72
72
|
"Context '#{@context}' expected, but '#{ctx}' found"
|
73
73
|
)
|
74
74
|
end
|
75
|
-
{ id
|
75
|
+
{ 'id' => id, 'login' => login, 'avatar_url' => avatar_url }
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
# Open
|
80
80
|
class Open
|
81
|
-
attr_reader :id, :login, :avatar_url
|
81
|
+
attr_reader :id, :login, :avatar_url
|
82
82
|
|
83
83
|
# Here comes the JSON you receive from Auth.user().
|
84
84
|
#
|
@@ -91,6 +91,11 @@ module GLogin
|
|
91
91
|
def initialize(json, secret, context = '')
|
92
92
|
raise 'JSON can\'t be nil' if json.nil?
|
93
93
|
raise 'JSON must contain "id" key' if json['id'].nil?
|
94
|
+
json.each do |k, v|
|
95
|
+
raise "Key #{k} is not a string" unless k.is_a?(String)
|
96
|
+
raise "Key #{k} is not allowed" unless %w[id login avatar_url bearer].include?(k)
|
97
|
+
raise "Value #{v} is not a string" unless v.is_a?(String)
|
98
|
+
end
|
94
99
|
@id = json['id']
|
95
100
|
@login = json['login'] || ''
|
96
101
|
@avatar_url = json['avatar_url'] || ''
|
@@ -108,7 +113,6 @@ module GLogin
|
|
108
113
|
@id,
|
109
114
|
@login,
|
110
115
|
@avatar_url,
|
111
|
-
@bearer,
|
112
116
|
@context
|
113
117
|
].join(GLogin::SPLIT)
|
114
118
|
)
|
data/lib/glogin/version.rb
CHANGED
data/test/glogin/test_cookie.rb
CHANGED
@@ -31,15 +31,15 @@ class TestCookie < Minitest::Test
|
|
31
31
|
GLogin::Cookie::Open.new(
|
32
32
|
JSON.parse(
|
33
33
|
"{\"id\":\"123\",
|
34
|
-
\"login\":\"yegor256\"
|
34
|
+
\"login\":\"yegor256\",
|
35
35
|
\"avatar_url\":\"https://avatars1.githubusercontent.com/u/526301\"}"
|
36
36
|
),
|
37
37
|
secret
|
38
38
|
).to_s,
|
39
39
|
secret
|
40
40
|
).to_user
|
41
|
-
assert_equal(user[
|
42
|
-
assert_equal(user[
|
41
|
+
assert_equal(user['login'], 'yegor256')
|
42
|
+
assert_equal(user['avatar_url'], 'https://avatars1.githubusercontent.com/u/526301')
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_encrypts_and_decrypts_with_context
|
@@ -47,41 +47,41 @@ class TestCookie < Minitest::Test
|
|
47
47
|
context = '127.0.0.1'
|
48
48
|
user = GLogin::Cookie::Closed.new(
|
49
49
|
GLogin::Cookie::Open.new(
|
50
|
-
JSON.parse('{"id":"123","login":"jeffrey","avatar_url":"#"
|
50
|
+
JSON.parse('{"id":"123","login":"jeffrey","avatar_url":"#"}'),
|
51
51
|
secret,
|
52
52
|
context
|
53
53
|
).to_s,
|
54
54
|
secret,
|
55
55
|
context
|
56
56
|
).to_user
|
57
|
-
assert_equal(user[
|
58
|
-
assert_equal(user[
|
59
|
-
assert_equal(user[
|
57
|
+
assert_equal(user['id'], '123')
|
58
|
+
assert_equal(user['login'], 'jeffrey')
|
59
|
+
assert_equal(user['avatar_url'], '#')
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_decrypts_in_test_mode
|
63
63
|
user = GLogin::Cookie::Closed.new(
|
64
64
|
'123|test|http://example.com', ''
|
65
65
|
).to_user
|
66
|
-
assert_equal(user[
|
67
|
-
assert_equal(user[
|
68
|
-
assert_equal(user[
|
66
|
+
assert_equal(user['id'], '123')
|
67
|
+
assert_equal(user['login'], 'test')
|
68
|
+
assert_equal(user['avatar_url'], 'http://example.com')
|
69
69
|
end
|
70
70
|
|
71
71
|
def test_decrypts_in_test_mode_with_context
|
72
72
|
user = GLogin::Cookie::Closed.new(
|
73
73
|
'123', '', 'some context'
|
74
74
|
).to_user
|
75
|
-
assert_equal('123', user[
|
76
|
-
assert_nil(user[
|
77
|
-
assert_nil(user[
|
75
|
+
assert_equal('123', user['id'])
|
76
|
+
assert_nil(user['login'])
|
77
|
+
assert_nil(user['avatar_url'])
|
78
78
|
end
|
79
79
|
|
80
80
|
def test_fails_on_broken_text
|
81
81
|
assert_raises GLogin::Codec::DecodingError do
|
82
82
|
GLogin::Cookie::Closed.new(
|
83
83
|
GLogin::Cookie::Open.new(
|
84
|
-
JSON.parse('{"login":"x","avatar_url":"x","id":"1"
|
84
|
+
JSON.parse('{"login":"x","avatar_url":"x","id":"1"}'),
|
85
85
|
'secret-1'
|
86
86
|
).to_s,
|
87
87
|
'secret-2'
|
@@ -94,7 +94,7 @@ class TestCookie < Minitest::Test
|
|
94
94
|
assert_raises GLogin::Codec::DecodingError do
|
95
95
|
GLogin::Cookie::Closed.new(
|
96
96
|
GLogin::Cookie::Open.new(
|
97
|
-
JSON.parse('{"login":"x","avatar_url":"x","id":""
|
97
|
+
JSON.parse('{"login":"x","avatar_url":"x","id":""}'),
|
98
98
|
secret,
|
99
99
|
'context-1'
|
100
100
|
).to_s,
|
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.16.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: 2024-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base58
|
@@ -48,7 +48,10 @@ extra_rdoc_files:
|
|
48
48
|
files:
|
49
49
|
- ".0pdd.yml"
|
50
50
|
- ".gitattributes"
|
51
|
+
- ".github/workflows/actionlint.yml"
|
51
52
|
- ".github/workflows/codecov.yml"
|
53
|
+
- ".github/workflows/copyrights.yml"
|
54
|
+
- ".github/workflows/markdown-lint.yml"
|
52
55
|
- ".github/workflows/pdd.yml"
|
53
56
|
- ".github/workflows/rake.yml"
|
54
57
|
- ".github/workflows/xcop.yml"
|