oauth2-cli 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +21 -0
  3. data/README.md +3 -2
  4. data/bin/oauth2-cli +17 -4
  5. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9097f026f5b1eca0dc1801e3c316c240bb768b7d
4
- data.tar.gz: a2cf31e5ad4845a37034efe503da7cd78e06da87
3
+ metadata.gz: f8e0080dbb653ef4ca24e7a82631b2541431dfe4
4
+ data.tar.gz: 456e59e1a1d24ae66eb0a4c6061076e5b2184c48
5
5
  SHA512:
6
- metadata.gz: 06bda1c71bcb161c6baeaab5ddc208312fc60c05346aef2bbd60e952dfa36210f1db0c1462dd6bb39d44d01ac181051374a895449fe74cbdc5b76ebc99d96c4b
7
- data.tar.gz: 267d37799a50d6d48fcc5bb2c46ffe9d8f4d198bc7b561ea69e2d64b5a4bc0f6e07c4372bc5e5f692c2a3ba5c64169b3ea1640dbfd1ffe1bf41f509280880c7c
6
+ metadata.gz: 951b2ca852d17019034adfa391c4119dc951c25e917570bdda9cd2b6b581512711db9a9b9e844f1a4487c7fdb5dc7f367dc5547057295b56f8b555e0549fc72a
7
+ data.tar.gz: e98b46e4646642651df00c01e1132f8d3edf522388d5b401aa14987648b271b5edd258aee4c728d08ca7e6803524a978cdf5f085df96fb9986ca175302f33d7e
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019, Stefan Rusu
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -27,10 +27,11 @@ Usage: oauth2-cli --auth AUTHORISATION_URL --token TOKEN_URL --id CLIENT_ID --se
27
27
  -i, --id CLIENT_ID Client ID (required)
28
28
  -s, --secret CLIENT_SECRET Client secret (required)
29
29
  -o, --scope SCOPE1,SCOPE2,etc OAuth2 scope to authorise (not used if not specified)
30
- -e, --separator OAuth2 scope separator character (defaults to space) n.b the scope arg is always passed as array and joined with the separator char for the request
30
+ -e, --separator SEPARATOR OAuth2 scope separator character (defaults to space) n.b the scope arg is always passed as array and joined with the separator char for the request
31
31
  -h, --host 127.0.0.1 Callback host (defaults to 127.0.0.1) n.b this allows you to run this tool on a remote machine and have the authorisation code go there; the callback HTTP server always binds to all available network interfaces irrespective of this value
32
32
  -p, --port 8000 Callback port (defaults to 8000)
33
- -w, --write Write the returned token as JSON using TOKEN_URL as filename with the current working directory being the destination
33
+ -w, --write Write the returned token as JSON using TOKEN_URL host as filename with the current working directory being the destination
34
+ -u, --audience AUDIENCE The token audience, not used if unspecified (optional)
34
35
  -d, --debug Turn on OAuth2 library debug and WEBrick log
35
36
  ```
36
37
 
@@ -49,7 +49,7 @@ optp = OptionParser.new do |opts|
49
49
  desc_separator = 'OAuth2 scope separator character (defaults to space) n.b '\
50
50
  'the scope arg is always passed as array and joined with the separator '\
51
51
  'char for the request'
52
- opts.on('-e', '--separator', desc_separator) do |opt|
52
+ opts.on('-e', '--separator SEPARATOR', desc_separator) do |opt|
53
53
  options[:separator] = opt
54
54
  end
55
55
 
@@ -69,12 +69,18 @@ optp = OptionParser.new do |opts|
69
69
  end
70
70
 
71
71
  options[:write] = false
72
- desc_write = 'Write the returned token as JSON using TOKEN_URL as filename '\
73
- 'with the current working directory being the destination'
72
+ desc_write = 'Write the returned token as JSON using TOKEN_URL host as '\
73
+ 'filename with the current working directory being the destination'
74
74
  opts.on('-w', '--write', desc_write) do
75
75
  options[:write] = true
76
76
  end
77
77
 
78
+ options[:audience] = nil
79
+ desc_audience = 'The token audience, not used if unspecified (optional)'
80
+ opts.on('-u', '--audience AUDIENCE', desc_audience) do |opt|
81
+ options[:audience] = opt
82
+ end
83
+
78
84
  options[:debug] = false
79
85
  opts.on('-d', '--debug', 'Turn on OAuth2 library debug and WEBrick log') do
80
86
  ENV['OAUTH_DEBUG'] = 'true'
@@ -82,7 +88,12 @@ optp = OptionParser.new do |opts|
82
88
  end
83
89
  end
84
90
 
85
- optp.parse!
91
+ begin
92
+ optp.parse!
93
+ rescue OptionParser::MissingArgument => err
94
+ STDERR.puts err
95
+ exit 1
96
+ end
86
97
 
87
98
  required.each do |arg|
88
99
  next unless options[arg].nil?
@@ -111,6 +122,8 @@ unless options[:scope].empty?
111
122
  code_args[:scope] = options[:scope].join(options[:separator])
112
123
  end
113
124
 
125
+ code_args[:audience] = options[:audience] unless options[:audience].nil?
126
+
114
127
  url = client.auth_code.authorize_url(code_args)
115
128
 
116
129
  puts ''
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth2-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ștefan Rusu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-18 00:00:00.000000000 Z
11
+ date: 2019-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -58,8 +58,10 @@ executables:
58
58
  - oauth2-cli
59
59
  extensions: []
60
60
  extra_rdoc_files:
61
+ - LICENSE.md
61
62
  - README.md
62
63
  files:
64
+ - LICENSE.md
63
65
  - README.md
64
66
  - bin/oauth2-cli
65
67
  homepage: https://github.com/SaltwaterC/oauth2-cli
@@ -82,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
84
  version: '0'
83
85
  requirements: []
84
86
  rubyforge_project:
85
- rubygems_version: 2.6.14
87
+ rubygems_version: 2.5.2.3
86
88
  signing_key:
87
89
  specification_version: 4
88
90
  summary: CLI utility to get OAuth token