Created
April 10, 2014 19:36
-
-
Save plukevdh/10415368 to your computer and use it in GitHub Desktop.
halogen redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'pry' | |
USERNAME = 'BFGIT' | |
SALT = "mytestsalt" | |
def generate_hash(str) | |
Digest::SHA256.new.digest str | |
end | |
def hash_session(session_id) | |
hash = generate_hash([USERNAME, session_id, SALT].join("")) | |
hex = hash.unpack("H*").first | |
puts hex.length | |
hex | |
end | |
get "/" do | |
hash = hash_session(params[:sessionID]) | |
redirect "https://ondemand.halogensoftware.com/bfgcom/signonServlet?username=#{USERNAME}&dkey=#{hash}" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment