Commit 8f1c1fc

mo <mo.khan@gmail.com>
2017-12-24 23:58:28
display each registered service provider on the dashboard.
1 parent de5ea12
Changed files (5)
app/controllers/dashboards_controller.rb
@@ -1,4 +1,5 @@
 class DashboardsController < ApplicationController
   def show
+    @metadatum = Saml::Kit.registry.to_a
   end
 end
app/views/dashboards/show.html.erb
@@ -2,6 +2,18 @@
   <div class="row">
     <div class="col">
       <h1>Dashboard</h1>
+      <table class="table">
+        <thead>
+          <th>Entity ID</th>
+        </thead>
+        <tbody>
+        <% @metadatum.each do |metadata| %>
+          <tr>
+            <td><%= metadata.entity_id %></td>
+          </tr>
+        <% end %>
+        </tbody>
+      </table>
     </div>
   </div>
 </div>
config/initializers/saml_kit.rb
@@ -1,16 +1,12 @@
 $next_key_pair_index = 0
 
-class OnDemandRegistry
-  def initialize(original)
-    @original = original
-  end
-
+class OnDemandRegistry < SimpleDelegator
   def metadata_for(entity_id)
-    found = @original.metadata_for(entity_id)
+    found = __getobj__.metadata_for(entity_id)
     return found if found
 
-    @original.register_url(entity_id, verify_ssl: Rails.env.production?)
-    @original.metadata_for(entity_id)
+    __getobj__.register_url(entity_id, verify_ssl: Rails.env.production?)
+    __getobj__.metadata_for(entity_id)
   end
 end
 
Gemfile
@@ -61,7 +61,7 @@ end
 # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
 gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
 gem 'dotenv-rails'
-gem 'saml-kit', '0.2.18'
+gem 'saml-kit', '0.3.0'
 gem 'rails-assets-jquery', source: 'https://rails-assets.org'
 gem 'rails-assets-bootstrap', source: 'https://rails-assets.org'
 gem 'jwt'
Gemfile.lock
@@ -179,7 +179,7 @@ GEM
     ruby_dep (1.5.0)
     rubyzip (1.2.1)
     safe_yaml (1.0.4)
-    saml-kit (0.2.18)
+    saml-kit (0.3.0)
       activemodel (>= 4.2.0)
       builder (~> 3.2)
       nokogiri (~> 1.8)
@@ -265,7 +265,7 @@ DEPENDENCIES
   rails-controller-testing
   rails_12factor
   rspec-rails (~> 3.6)
-  saml-kit (= 0.2.18)
+  saml-kit (= 0.3.0)
   sass-rails (~> 5.0)
   selenium-webdriver
   spring