Commit 89a7cc0

mo <mo.khan@gmail.com>
2017-10-23 01:46:15
extract helper method to generate an authnrequest.
1 parent fa4a778
Changed files (2)
airport
app
saml-kit
lib
saml
airport/app/controllers/sessions_controller.rb
@@ -18,14 +18,10 @@ class SessionsController < ApplicationController
 
   def query_params
     {
-      'SAMLRequest' => Saml::Kit::Request.encode(authentication_request),
+      'SAMLRequest' => Saml::Kit::Request.authentication,
       'RelayState' => JSON.generate(inbound_path: '/'),
     }.map do |(x, y)|
       "#{x}=#{CGI.escape(y)}"
     end.join('&')
   end
-
-  def authentication_request
-    Saml::Kit::AuthenticationRequest::Builder.new
-  end
 end
saml-kit/lib/saml/kit/request.rb
@@ -5,6 +5,10 @@ module Saml
         Base64.encode64(compress(document.to_xml))
       end
 
+      def self.authentication
+        encode(AuthenticationRequest::Builder.new)
+      end
+
       def self.compress(content)
         content
         #Zlib::Deflate.deflate(xml, 9)[2..-5]