reclaim-oidc 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/reclaim-oidc +18 -3
- data/lib/reclaim_oidc.rb +15 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9aec1964879322ffd4e1032524300dc0f7d6e9e8d419a738b2c007c1457d3ca
|
4
|
+
data.tar.gz: 95d01f7b7192bbf1593da3aa50253d29578f1013aabd3f24e968d449c72241e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e168437759c26b5438e8311a389c8f40517e1f3cb152a69fc143e4dba0547a50a4cd47a27b10e998b99e14ade227f9be4565943c845659e14077701520935bf
|
7
|
+
data.tar.gz: 924ec6b95fce649f206d5fc7b7f34f88276d1e413c013183d93eb7aedf0550167aec27ac552ab86b7a8cead8ecb8354d85d450248fe020f722e008d3f2387224
|
data/bin/reclaim-oidc
CHANGED
@@ -5,13 +5,14 @@ require 'reclaim_oidc'
|
|
5
5
|
class OptParser
|
6
6
|
class ScriptOptions
|
7
7
|
attr_accessor :name, :add, :delete, :list, :description, :redirect_uri,
|
8
|
-
:verbose
|
8
|
+
:verbose, :jwt_secret
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
self.delete = false
|
12
12
|
self.add = false
|
13
13
|
self.list = false
|
14
14
|
self.verbose = false
|
15
|
+
self.jwt_secret = false
|
15
16
|
end
|
16
17
|
|
17
18
|
def define_options(parser)
|
@@ -27,6 +28,7 @@ class OptParser
|
|
27
28
|
client_redirect_option(parser)
|
28
29
|
client_description_option(parser)
|
29
30
|
boolean_verbose_option(parser)
|
31
|
+
jwt_secret_option(parser)
|
30
32
|
|
31
33
|
parser.separator ""
|
32
34
|
parser.separator "Common options:"
|
@@ -87,6 +89,12 @@ class OptParser
|
|
87
89
|
self.verbose = v
|
88
90
|
end
|
89
91
|
end
|
92
|
+
|
93
|
+
def jwt_secret_option(parser)
|
94
|
+
parser.on("-j", "--jwt-secret [JWT-SECRET]", "Set JWT secret") do |v|
|
95
|
+
self.jwt_secret = v
|
96
|
+
end
|
97
|
+
end
|
90
98
|
end
|
91
99
|
|
92
100
|
#
|
@@ -99,7 +107,11 @@ class OptParser
|
|
99
107
|
@options = ScriptOptions.new
|
100
108
|
@args = OptionParser.new do |parser|
|
101
109
|
@options.define_options(parser)
|
102
|
-
|
110
|
+
begin
|
111
|
+
parser.parse!(args)
|
112
|
+
rescue OptionParser::InvalidOption => e
|
113
|
+
puts "ERROR: Invalid option"
|
114
|
+
end
|
103
115
|
end
|
104
116
|
@options
|
105
117
|
end
|
@@ -152,4 +164,7 @@ if (options.delete)
|
|
152
164
|
roidc.delete_client(options.name)
|
153
165
|
puts "OK"
|
154
166
|
end
|
155
|
-
|
167
|
+
if (options.jwt_secret)
|
168
|
+
roidc.set_jwt_secret(options.jwt_secret)
|
169
|
+
puts "JWT secret has been changed"
|
170
|
+
end
|
data/lib/reclaim_oidc.rb
CHANGED
@@ -26,8 +26,13 @@ class ReclaimOidc
|
|
26
26
|
|
27
27
|
def get_client_secret
|
28
28
|
uri = URI(@url + '/config/reclaim-rest-plugin')
|
29
|
-
|
30
|
-
|
29
|
+
begin
|
30
|
+
resp = JSON.parse Net::HTTP.get(uri)
|
31
|
+
return resp["OIDC_CLIENT_SECRET"]
|
32
|
+
rescue Errno::ECONNREFUSED => e
|
33
|
+
puts "ERROR: REST service is not running"
|
34
|
+
exit
|
35
|
+
end
|
31
36
|
end
|
32
37
|
|
33
38
|
def get_clients
|
@@ -85,9 +90,14 @@ class ReclaimOidc
|
|
85
90
|
op['token_endpoint'] = host + '/openid/token'
|
86
91
|
op['userinfo_endpoint'] = host + '/openid/userinfo'
|
87
92
|
op
|
88
|
-
end
|
89
|
-
def set_jwt_secret
|
90
|
-
|
93
|
+
end
|
94
|
+
def set_jwt_secret(jwt_secret)
|
95
|
+
uri = URI(@url + '/config/reclaim-rest-plugin')
|
96
|
+
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
|
97
|
+
request.body = {"JWT_SECRET": jwt_secret}.to_json
|
98
|
+
resp = Net::HTTP.start(uri.host, uri.port) do |http|
|
99
|
+
http.request request
|
100
|
+
end
|
91
101
|
end
|
92
102
|
|
93
103
|
class Client
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reclaim-oidc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Schanzenbach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Used to manage re:claimID OpenID Connect clients and OpenID Connect Provider
|
14
14
|
configuration(s)
|