SecureURI
Adds the ability for URI to generate and validate secure URLs.
Installation
sudo gem install secure_uri
Usage
Generate a secure URI
require "secure_uri"
# Set our secret key for hashing, be sure to keep this private!
SecureURI.hasher.salt = "our secret key"
url = URI.parse("http://example.com/action?some=data")
url.secure!
url.to_s # => "http://example.com/action?some=data&hash=d988eb197f2120493b4f1e01382af508ffd123dca791e011fea93d71d01690cf"
Check if a URL is secure
request_uri = URI.parse("http://example.com/action?some=data&hash=d988eb197f2120493b4f1e01382af508ffd123dca791e011fea93d71d01690cf")
request_uri.valid? # => true
Copyright
Copyright © 2009 Brightbox Systems Ltd. See LICENSE for details.