clonk 1.0.0alpha4 → 1.0.0alpha5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f7aa0b12c57241a41d20426c06220f03c74247ae3d685c25a1062052ed2297a
4
- data.tar.gz: 16fe259d548ca99777ca99442894377c2ef99bce191ce069af0c507afd85df78
3
+ metadata.gz: c2a1aa9eb789fdc7e343420e00615790cca1e852abf6ec6c998d37956440686d
4
+ data.tar.gz: 714b38353a4fa8597f10d4242baa6dcfe906261d1e4fa6b655ce3479d02aada1
5
5
  SHA512:
6
- metadata.gz: 794fd86cc27312327b5b4f42739d151d29dc3c489d28b215c28cca805502e35f0a87ed64447bf358e1791a5327e45fa4e8de814574206bc869d0cc1b542b67e6
7
- data.tar.gz: 7a0643e05af7c708f404194d310ab6301848fa1054f8cee66b6344bbd5613ca6015dfc9145cc9dc13bd2bbbabc0bc07c83920c77444adc80b1a1bf0639d1fc52
6
+ metadata.gz: 59bf82ad7dc991d51f3a1077d74cb1503a4029bb1ed3330f7a0e31fb5682095ecc77a79c4059adeaedc340febcaa7367dd62be6cd60666cca9bb28cf84e301e6
7
+ data.tar.gz: 6ff3b4eead6bef304e7ff61600ec7a3040b98614a6b54c98a637cc59a4bfb9e3ae87ca00212a1ba71295f62e27884a14326376123d31fff844b5e576967c7160
@@ -6,7 +6,7 @@ require 'faraday_middleware'
6
6
  require 'json'
7
7
  # require 'pp'
8
8
 
9
- BASE_URL = ENV.fetch('SSO_BASE_URL')
9
+ BASE_URL = URI.encode(ENV.fetch('SSO_BASE_URL'))
10
10
  USERNAME = ENV.fetch('SSO_USERNAME')
11
11
  PASSWORD = ENV.fetch('SSO_PASSWORD')
12
12
  REALM = ENV.fetch('SSO_REALM')
@@ -117,13 +117,14 @@ module Clonk
117
117
 
118
118
  def create_role(realm: REALM, name: nil, description: nil, scope_param_required: false)
119
119
  # TODO: Create realm roles
120
- Clonk.parsed_response(protocol: :post,
120
+ response = Clonk.response(protocol: :post,
121
121
  path: "#{url}/roles",
122
122
  data: {
123
123
  name: name,
124
124
  description: description,
125
125
  scopeParamRequired: scope_param_required
126
126
  })
127
+ Role.find_by(name: name, client: self)
127
128
  end
128
129
 
129
130
  ##
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clonk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0alpha4
4
+ version: 1.0.0alpha5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Fish
@@ -38,21 +38,26 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description:
42
56
  email:
43
57
  executables: []
44
58
  extensions: []
45
59
  extra_rdoc_files: []
46
60
  files:
47
- - ".yardoc/checksums"
48
- - ".yardoc/complete"
49
- - ".yardoc/object_types"
50
- - ".yardoc/objects/root.dat"
51
- - ".yardoc/proxy_types"
52
- - Gemfile
53
- - Gemfile.lock
54
- - README.md
55
- - clonk.gemspec
56
61
  - lib/clonk.rb
57
62
  - lib/clonk/client.rb
58
63
  - lib/clonk/group.rb
@@ -68,15 +73,7 @@ metadata:
68
73
  post_install_message:
69
74
  rdoc_options: []
70
75
  require_paths:
71
- - lib/clonk.rb
72
- - lib/clonk
73
- - lib/clonk/realm.rb
74
- - lib/clonk/group.rb
75
- - lib/clonk/policy.rb
76
- - lib/clonk/role.rb
77
- - lib/clonk/client.rb
78
- - lib/clonk/permission.rb
79
- - lib/clonk/user.rb
76
+ - lib
80
77
  required_ruby_version: !ruby/object:Gem::Requirement
81
78
  requirements:
82
79
  - - ">="
@@ -1,8 +0,0 @@
1
- lib/clonk.rb 20e9972dadb66fb1771722d9b06e3ccdad9e1022
2
- lib/clonk/role.rb 56ea266896bcb2b45cc48ee633c83639d2135296
3
- lib/clonk/user.rb a7da95bf320c5aaa7cc7708d9fe2ffd10f4eda23
4
- lib/clonk/group.rb 29edd3c17b7babce87bb544333d42455ec1a5c2e
5
- lib/clonk/realm.rb 0f933b0fd76545c049a5cb228706f13117fbcbb3
6
- lib/clonk/client.rb 41af98a3b30b4adff27b5d62c6b26559335b369f
7
- lib/clonk/policy.rb 8b8840f6763a1a320759a3c9d052758f25b17463
8
- lib/clonk/permission.rb 4466f7c1d3bef61521df03ee0b92c85f7be6cb66
File without changes
Binary file
Binary file
Binary file
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source "https://rubygems.org"
2
- # gemspec
3
- gem "clonk", path: "/Users/sfish/Code/ADBM/sso-idam-auth-application/clonk"
@@ -1,24 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- clonk (1.0.0alpha3)
5
- faraday
6
- faraday_middleware
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- faraday (0.15.3)
12
- multipart-post (>= 1.2, < 3)
13
- faraday_middleware (0.12.2)
14
- faraday (>= 0.7.4, < 1.0)
15
- multipart-post (2.0.0)
16
-
17
- PLATFORMS
18
- ruby
19
-
20
- DEPENDENCIES
21
- clonk!
22
-
23
- BUNDLED WITH
24
- 1.16.2
data/README.md DELETED
@@ -1,59 +0,0 @@
1
- # Clonk [![Gem Version](https://badge.fury.io/rb/clonk.svg)](https://badge.fury.io/rb/clonk)
2
-
3
- This is a gem that'll help you seed an instance of Red Hat SSO. Right now, it's still a work-in-progress, but it shouldn't be long before it's got everything I think it needs.
4
-
5
- It makes some assumptions about what's in your environment at the moment, using `dotenv`. While developing, I'm keeping the following variables in there.
6
-
7
- ```
8
- SSO_REALM="master"
9
- SSO_BASE_URL="http://localhost:8080/auth"
10
- SSO_USERNAME="user"
11
- SSO_PASSWORD="password"
12
- ```
13
-
14
- It's recommended to spin up an SSO instance alongside this to see what effects you're having on it. Here, it's important that the `preview` profile is used, so that we can use the `realm-management` client to take care of permissions in the realm.
15
-
16
- ```
17
- docker run --rm -p 8080:8080 -e JAVA_OPTS_APPEND="-Dkeycloak.profile=preview" -e SSO_ADMIN_USERNAME=user -e SSO_ADMIN_PASSWORD=password registry.access.redhat.com/redhat-sso-7/sso72-openshift
18
- ```
19
-
20
- ## Usage
21
-
22
- Clonk exposes SSO objects as ActiveRecord-esque models. As a short demonstration:
23
-
24
- ```
25
- 2.5.1 :003 > Clonk::Group.all
26
- => [#<Clonk::Group:0x00007fe7139ecda0 @name="another-test", @id="42b28060-7f4f-4b6d-82fd-6af031881a9e", @realm="master">, #<Clonk::Group:0x00007fe713808228 @name="chaos-chaos", @id="05af3f68-44d6-4973-8834-e957822e43ef", @realm="master">]
27
- 2.5.1 :004 > Clonk::Group.all.first.config
28
- => {"id"=>"42b28060-7f4f-4b6d-82fd-6af031881a9e", "name"=>"another-test", "path"=>"/another-test", "attributes"=>{}, "realmRoles"=>[], "clientRoles"=>{}, "subGroups"=>[], "access"=>{"view"=>true, "manage"=>true, "manageMembership"=>true}}
29
- ```
30
-
31
- `Group.all` casts all groups in the realm to `Clonk::Group` objects...
32
-
33
- ...but you can access their plain JSON config with `Group#config`.
34
-
35
- Right now, you can check the `lib` folder for details of which methods are exposed, but I'm looking to add documentation in the very near future. Think of this as a soft launch.
36
-
37
- ## Why?
38
-
39
- When developing against Red Hat SSO and Keycloak, I've personally struggled to deal with the documentation. There are a lot of assumptions that are made about what you know and what you don't. So I've made this gem...
40
-
41
- ### ...to help devs use SSO platforms with their Rails apps
42
-
43
- Sometimes, Devise just doesn't cut it, especially if you want to allow users to sign into multiple apps with the same credentials. Running a SSO instance that all your apps can call off to can make things more flexible!
44
-
45
- ### ...to document API endpoints that are documented either confusingly or not at all
46
-
47
- SSO is a huge project, so it's sort of understandable that perhaps its documentation isn't too easy to understand at first glance...especially if you've never used an SSO backend before. Some API endpoints that'll be used in this gem aren't even documented.
48
-
49
- ### ...to better integrate Ruby/Rails with SSO
50
-
51
- I guess this comes back to the first one. SSO integration with Rails apps could be really powerful. Especially if it's wrapped in that familiar ActiveRecord style.
52
-
53
- ### ...to make seeding SSO a lot more readable in future
54
-
55
- I seeded SSO with more `curl` requests than you could shake a stick at. Suffice to say, it didn't look like the prettiest piece of code...
56
-
57
- ### ...to transfer what I've learned
58
-
59
- This gem goes hand-in-hand with a blog post I'm writing, but I'm hoping it'll go further than just that tutorial. Fingers crossed this gem will have its tendrils deep in a lot of SSO instances out there...which sounds a little ominous, but...yeah, you get the gist!
@@ -1,15 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
-
4
- Gem::Specification.new do |s|
5
- s.name = %q{clonk}
6
- s.version = "1.0.0alpha4"
7
- s.authors = ["Simon Fish"]
8
- s.date = %q{2018-11-19}
9
- s.summary = %q{Keycloak/RHSSO admin API client}
10
- s.files = `git ls-files`.split("\n")
11
- s.require_paths = Dir.glob("lib/**/*")
12
- s.add_runtime_dependency 'faraday'
13
- s.add_runtime_dependency 'faraday_middleware'
14
- s.metadata["yard.run"] = "yardoc"
15
- end