Class: Atompub::Auth::Wsse
Overview
Atompub::Auth::Wsse
Class handles WSSE authentication All you have to do is create this class’s object with username and password, and pass to Atompub::Client#new
Usage:
auth = Atompub::Auth::Wsse.new :username => username, :password => password
client = Atompub::Client.new :auth => auth
Instance Method Summary collapse
-
#authorize(req) ⇒ Object
Add credential info to Net::HTTP::Request object.
-
#initialize(params) ⇒ Wsse
constructor
initializer.
Constructor Details
#initialize(params) ⇒ Wsse
initializer
Set two parameters as hash
-
username
-
password
Usage:
auth = Atompub::Auth::Wsse.new :username => name, :password => pass
1681 1682 1683 |
# File 'lib/atomutil.rb', line 1681 def initialize(params) @username, @password = params[:username], params[:password] end |
Instance Method Details
#authorize(req) ⇒ Object
Add credential info to Net::HTTP::Request object
Usaage:
req = Net::HTTP::Get.new uri.request_uri
auth.(req)
1691 1692 1693 1694 |
# File 'lib/atomutil.rb', line 1691 def (req) req['Authorization'] = 'WSSE profile="UsernameToken"' req['X-Wsse'] = gen_token end |