reclaim-oidc 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/reclaim_oidc.rb +22 -20
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4fb285473cd93bcf23b299b788ab1aed4ad5899a4d499565a45e22c29ce1303
4
- data.tar.gz: 744ee0e13fc6deace7ec91eea821c0d1e8256821ada5d2b37853c819c3b7108c
3
+ metadata.gz: 9b2d1d8c1538ffd6758d085e72453d9ada5ab7e9c80dc9f4c7e9e5a2c900a7e2
4
+ data.tar.gz: 18c18d0d387e63f75d0fbe721002e6ee0efdfefe280dda31a52c9fbd89805dfb
5
5
  SHA512:
6
- metadata.gz: eb4a89d88786a5ce90f6d8aa3f458e24e195cdf7315ec427b9d383235c876f66a4b7ffcc6f72de46fe55be402da8a3ba8d3fdf8ce4a0e23ff5b820acda552675
7
- data.tar.gz: e37b0f94eb61552e1e61e3808a42bd685b424bd322d01424e544ff9496f4b082f57ea9e4d03ea658b4a05475b878cfc4d061b4e58bbd7d429b9b1b434c38e161
6
+ metadata.gz: d414d535b43f089cc628cd19041130a6a115c6ab8b98e31993662ce468409e4fc3a140df1fea6f205dd79404ae81a42a0c2ece342f3d7d84139c2c27d03ad525
7
+ data.tar.gz: 16ac3e533f34471d8083608821ca591613c5874a87067339599ca02b8257afc08c6665c0409898c388d71be700a8795af0a3c45207a2d738a8cd7917661fc590
data/lib/reclaim_oidc.rb CHANGED
@@ -1,14 +1,18 @@
1
1
  require 'net/http'
2
2
  require 'json'
3
3
 
4
+ $VERSION_MAJOR = 0
5
+ $VERSION_MINOR = 0
6
+ $VERSION_MICRO = 5
7
+
4
8
  class ReclaimOidc
5
9
  def initialize(verbose=false, url='http://localhost:7776')
6
10
  @verbose = verbose
7
11
  @url = url
8
12
  @client_secret = get_client_secret()
9
13
  end
10
- def self.hello
11
- puts "Hello World!"
14
+ def self.version
15
+ return "#{$VERSION_MAJOR}.#{$VERSION_MINOR}.#{$VERSION_MICRO}"
12
16
  end
13
17
  def parse_identities_from_http(body)
14
18
  arr = JSON.parse(body)
@@ -48,25 +52,18 @@ class ReclaimOidc
48
52
  resp = http.post(uri.path, payload.to_json)
49
53
  end
50
54
  uri = URI(@url + "/namestore/#{name}")
51
- record = {'record_type' => "RECLAIM_OIDC_CLIENT",
55
+ records = {'record_name' => "@",
56
+ 'data' => []}
57
+ records["data"] << {'record_type' => "RECLAIM_OIDC_CLIENT",
52
58
  'value' => description,
53
- 'record_name' => "@",
54
- 'expiration_time' => "1d",
59
+ 'expiration_time' => "1h",
55
60
  'flag' => 8}
56
- #resp = Net::HTTP.post(uri,record.to_json)
57
- #req = Net::HTTP::Post.new(uri, record)
58
- Net::HTTP.start(uri.host, uri.port) do |http|
59
- resp = http.post(uri.path,record.to_json)
60
- end
61
- record = {'record_type' => "RECLAIM_OIDC_REDIRECT",
61
+ records["data"] << {'record_type' => "RECLAIM_OIDC_REDIRECT",
62
62
  'value' => redirect_uri,
63
- 'record_name' => "@",
64
- 'expiration_time' => "1d",
63
+ 'expiration_time' => "1h",
65
64
  'flag' => 8}
66
- #req = Net::HTTP::Post.new(uri, record)
67
- #resp = Net::HTTP.post(uri,record.to_json)
68
65
  Net::HTTP.start(uri.host, uri.port) do |http|
69
- resp = http.post(uri.path,record.to_json)
66
+ resp = http.post(uri.path,records.to_json)
70
67
  end
71
68
  end
72
69
  def delete_client(name)
@@ -105,11 +102,16 @@ class ReclaimOidc
105
102
  end
106
103
  def parse_client_info(obj)
107
104
  obj.each do |record|
108
- if (record['record_type'] == 'RECLAIM_OIDC_CLIENT')
109
- @description = record['value']
105
+ if "@" != record["record_name"]
106
+ next
110
107
  end
111
- if (record['record_type'] == 'RECLAIM_OIDC_REDIRECT')
112
- @redirect_uri = record['value']
108
+ record["data"].each do |data|
109
+ if (data['record_type'] == 'RECLAIM_OIDC_CLIENT')
110
+ @description = data['value']
111
+ end
112
+ if (data['record_type'] == 'RECLAIM_OIDC_REDIRECT')
113
+ @redirect_uri = data['value']
114
+ end
113
115
  end
114
116
  end
115
117
  end
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
4
+ version: 0.0.5
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-04-28 00:00:00.000000000 Z
11
+ date: 2019-04-30 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)