= Ruby SAML2 Library Installation

== Prerequisites
    * Ruby
    * RubyGems
    * Rails (for the example)

== Dependencies

This library depends on the Ruby XMLC14N-r library available at http://rubyforge.org/projects/c14n-r

download the .gem file and run 
gem install XMLCanonicalizer*

* Patches
In XMLCanonicalizer-1.0.1 (WSS4R-0.4a), XmlCanonicalizer#canonicalize_element handles 'line feed (\n)' differently from Apache XML Security (c14n specification). If you want to use saml2ruby with XMLCanonicalizer-1.0.1 or before, you need to apply patches/xmlcanonicalizer.rb.patch.

Apply patch by using GNU patch:
	# cd /usr/lib/ruby/gems/1.8/gems/XMLCanonicalizer-1.0.1
	# patch -p0 -b < /path/to/saml2ruby/source/patches/xmlcanonicalizer.rb.patch

Original file is copied to /usr/lib/ruby/gems/1.8/gems/XMLCanonicalizer-1.0.1/lib/xml/utils/xmlcanonicalizer.rb.orig
 
== SAML2 library Installation

run setup.rb to install:

 ruby setup.rb

setup.rb installs the library into your system ruby.  

If don't want to add ruby-saml2 to your system ruby, 
you may instead add the *lib* directory of the extracted tarball to your RUBYLIB environment variable:
  $ export RUBYLIB=${RUBYLIB}:/path/to/ruby-saml2/lib
  
or in the case of a rails application copy the library files to your rails application's lib directory.

== Testing the Installation

At the moment you have to use the example rails application to test:
 * Edit the saml2ruby/source/examples/rails/SimpleSAMLRP/app/controllers/account_controller.rb and change the SP and IdP settings to match your environment
 * run the rails server
 * Now browse to http://myserver.mydomain.com:myport/account

