class SamlLoginsController < ApplicationController require "net/http" require "uri" require 'rexml/document' include REXML def index if params[:wa] == "wsignoutcleanup1.0" #logout redirect_to :root else #login @wresult = params[:wresult] @wctx = params[:wctx] @main_url = LIST[:sites][@wctx]['url'] @main_public_key = LIST[:sites][@wctx]['key'] @doc = REXML::Document.new @wresult @main_public_key = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzKawlFWAMzA/uV/kcewd\nmtj8PcqxosmnSh7ZzJ0DumG2ieeP9oDBicqbqIEaeJVvrRzYJD2a+u8x5KKMKB8J\nHbMUpCBFlIpkDMjU/oZVMcYT9pcH51QWNvCgHG7prVykSGFz1JRvjSP6cwuZKBFd\nFFneOViETqoMIO1DbRLXsGfPvMOJY9C1xDwv1dLv0Wbj7M9N6eNz06a50bu3I4gl\nMumxWnZUabXL3G62S/Si4NM7J2jOUnkEOxJWOhcAX/iiqS9T8AHu84um2+mLQpfB\nJJFFIWCIAtU78VnIN5JSWwjFU5TsiSyCFYpGXKxUFD25cFmt3SfG0gwmrFis5Pdn\nhwIDAQAB\n-----END PUBLIC KEY-----\n" public_key = OpenSSL::PKey::RSA.new(@main_public_key) encrypted_data = public_key.public_encrypt(@doc.elements["//saml:AttributeValue"].text) redirect_to "http://#{@main_url}/user_login?" + { :wresult => encrypted_data }.to_param end end end