### Home Classes Methods

### In Files

- lib/xmpp4r/pubsub/helper/oauth_service_helper.rb

### Parent

Jabber::PubSub::ServiceHelper

### Methods

- ::create_oauth_node
- ::new

### Files

- CHANGELOG
- COPYING
- LICENSE
- README.rdoc
- README_ruby19.txt

### Class/Module Index

Quicksearch

- Jabber
- Jabber::ArgumentError
- Jabber::Bytestreams
- Jabber::Bytestreams::IBB
- Jabber::Bytestreams::IBBInitiator
- Jabber::Bytestreams::IBBQueueItem
- Jabber::Bytestreams::IBBTarget
- Jabber::Bytestreams::IqQueryBytestreams
- Jabber::Bytestreams::IqSi
- Jabber::Bytestreams::IqSiFile
- Jabber::Bytestreams::IqSiFileRange
- Jabber::Bytestreams::SOCKS5Bytestreams
- Jabber::Bytestreams::SOCKS5BytestreamsInitiator
- Jabber::Bytestreams::SOCKS5BytestreamsPeer
- Jabber::Bytestreams::SOCKS5BytestreamsServer
- Jabber::Bytestreams::SOCKS5BytestreamsServerStreamHost
- Jabber::Bytestreams::SOCKS5BytestreamsTarget
- Jabber::Bytestreams::SOCKS5Socket
- Jabber::Bytestreams::StreamHost
- Jabber::Bytestreams::StreamHostUsed
- Jabber::Callback
- Jabber::CallbackList
- Jabber::Caps
- Jabber::Caps::C
- Jabber::Caps::Helper
- Jabber::Client
- Jabber::ClientAuthenticationFailure
- Jabber::Command
- Jabber::Command::IqCommand
- Jabber::Command::Responder
- Jabber::Component
- Jabber::ComponentAuthenticationFailure
- Jabber::Connection
- Jabber::Connection::SSLSocketUTF8
- Jabber::Dataforms
- Jabber::Dataforms::XData
- Jabber::Dataforms::XDataField
- Jabber::Dataforms::XDataInstructions
- Jabber::Dataforms::XDataReported
- Jabber::Dataforms::XDataTitle
- Jabber::Delay
- Jabber::Delay::XDelay
- Jabber::Discovery
- Jabber::Discovery::Feature
- Jabber::Discovery::Helper
- Jabber::Discovery::Identity
- Jabber::Discovery::IqQueryDiscoInfo
- Jabber::Discovery::IqQueryDiscoItems
- Jabber::Discovery::Item
- Jabber::Discovery::Responder
- Jabber::EntityTime
- Jabber::EntityTime::IqTime
- Jabber::EntityTime::Responder
- Jabber::ErrorResponse
- Jabber::FeatureNegotiation
- Jabber::FeatureNegotiation::IqFeature
- Jabber::FileTransfer
- Jabber::FileTransfer::FileSource
- Jabber::FileTransfer::Helper
- Jabber::FileTransfer::TransferSource
- Jabber::Framework
- Jabber::Framework::Base
- Jabber::Framework::Bot
- Jabber::HTTPBinding
- Jabber::HTTPBinding::Client
- Jabber::IdGenerator
- Jabber::InvalidChatState
- Jabber::Iq
- Jabber::IqQuery
- Jabber::JID
- Jabber::JabberError
- Jabber::LastActivity
- Jabber::LastActivity::Helper
- Jabber::LastActivity::IqQueryLastActivity
- Jabber::MUC
- Jabber::MUC::IqQueryMUCAdmin
- Jabber::MUC::IqQueryMUCAdminItem
- Jabber::MUC::IqQueryMUCOwner
- Jabber::MUC::MUCBrowser
- Jabber::MUC::MUCClient
- Jabber::MUC::SimpleMUCClient
- Jabber::MUC::UserItem
- Jabber::MUC::XMUC
- Jabber::MUC::XMUCUser
- Jabber::MUC::XMUCUserInvite
- Jabber::MUC::XMUCUserItem
- Jabber::Message
- Jabber::NoNameXmlnsRegistered
- Jabber::NotConnected
- Jabber::Observable
- Jabber::Observable::Contact
- Jabber::Observable::PubSub
- Jabber::Observable::PubSub::AlreadySet
- Jabber::Observable::PubSub::NoService
- Jabber::Observable::Subscriptions
- Jabber::Presence
- Jabber::PubSub
- Jabber::PubSub::Configuration
- Jabber::PubSub::Event
- Jabber::PubSub::EventItem
- Jabber::PubSub::EventItems
- Jabber::PubSub::IqPubSub
- Jabber::PubSub::IqPubSubOwner
- Jabber::PubSub::Item
- Jabber::PubSub::Items
- Jabber::PubSub::NodeBrowser
- Jabber::PubSub::NodeConfig
- Jabber::PubSub::NodeHelper
- Jabber::PubSub::OAuthPubSubStreamHelper
- Jabber::PubSub::OAuthServiceHelper
- Jabber::PubSub::OwnerNodeConfig
- Jabber::PubSub::Publish
- Jabber::PubSub::Retract
- Jabber::PubSub::ServiceHelper
- Jabber::PubSub::Subscription
- Jabber::PubSub::SubscriptionConfig
- Jabber::PubSub::Unsubscribe
- Jabber::RPC
- Jabber::RPC::Client
- Jabber::RPC::IqQueryRPC
- Jabber::RPC::Server
- Jabber::Reliable
- Jabber::Reliable::Connection
- Jabber::Reliable::Listener
- Jabber::Roster
- Jabber::Roster::Helper
- Jabber::Roster::Helper::RosterItem
- Jabber::Roster::IqQueryRoster
- Jabber::Roster::RosterItem
- Jabber::Roster::RosterX
- Jabber::Roster::RosterXItem
- Jabber::Roster::XRoster
- Jabber::Roster::XRosterItem
- Jabber::SASL
- Jabber::SASL::Anonymous
- Jabber::SASL::Base
- Jabber::SASL::DigestMD5
- Jabber::SASL::Plain
- Jabber::SOCKS5Error
- Jabber::Semaphore
- Jabber::ServerDisconnected
- Jabber::Stream
- Jabber::Stream::ThreadBlock
- Jabber::StreamParser
- Jabber::Test
- Jabber::Test::ListenerMocker
- Jabber::UserLocation
- Jabber::UserLocation::Helper
- Jabber::UserLocation::Location
- Jabber::UserTune
- Jabber::UserTune::Helper
- Jabber::UserTune::Tune
- Jabber::Vcard
- Jabber::Vcard::Helper
- Jabber::Vcard::IqVcard
- Jabber::Version
- Jabber::Version::IqQueryVersion
- Jabber::Version::Responder
- Jabber::Version::SimpleResponder
- Jabber::X
- Jabber::XHTML
- Jabber::XHTML::Body
- Jabber::XHTML::HTML
- Jabber::XMPPElement
- Jabber::XMPPStanza
- Jabber::XParent
- REXML
- REXML::Element
- REXML::IOSource
- XMLRPC
- XMLRPC::Create
- Base64
- ObservableThing
- QObserver
- ThreadStore

No matching classes.

# Jabber::PubSub::OAuthServiceHelper

PubSub service helper for use with OAuth-authenticated nodes

### Public Class Methods

create_oauth_node(jid, pubsubjid, oauth_consumer, oauth_token, options = {}) click to toggle source

add the OAuth sauce (XEP-0235) The `options` hash may contain the following parameters:

    :oauth_nonce            => nonce (one will be generated otherwise)
    :oauth_timestamp        => timestamp (one will be generated otherwise)
    :oauth_signature_method => signature method (defaults to HMAC-SHA1)
    :oauth_version          => OAuth version (defaults to "1.0")

    # File lib/xmpp4r/pubsub/helper/oauth_service_helper.rb, line 37
    def self.create_oauth_node(jid, pubsubjid, oauth_consumer, oauth_token, options = {})
      require 'oauth'

      request = OAuth::RequestProxy.proxy            "method" => "iq",
        "uri"    => [jid.strip.to_s, pubsubjid.strip.to_s] * "&",
        "parameters" => {
          "oauth_consumer_key"     => oauth_consumer.key,
          "oauth_nonce"            => options[:oauth_nonce] || OAuth::Helper.generate_nonce,
          "oauth_timestamp"        => options[:oauth_timestamp] || OAuth::Helper.generate_timestamp,
          "oauth_token"            => oauth_token.token,
          "oauth_signature_method" => options[:oauth_signature_method] || "HMAC-SHA1",
          "oauth_version"          => options[:oauth_version] || "1.0"
        }

      request.sign!(:consumer => oauth_consumer, :token => oauth_token)

      # TODO create XMPPElements for OAuth elements
      oauth = REXML::Element.new("oauth")
      oauth.attributes['xmlns'] = 'urn:xmpp:oauth:0'

      oauth_consumer_key = REXML::Element.new("oauth_consumer_key")
      oauth_consumer_key.text = request.oauth_consumer_key
      oauth.add(oauth_consumer_key)

      oauth_token_node = REXML::Element.new("oauth_token")
      oauth_token_node.text = request.oauth_token
      oauth.add(oauth_token_node)

      oauth_signature_method = REXML::Element.new("oauth_signature_method")
      oauth_signature_method.text = request.oauth_signature_method
      oauth.add(oauth_signature_method)

      oauth_signature = REXML::Element.new("oauth_signature")
      oauth_signature.text = request.oauth_signature
      oauth.add(oauth_signature)

      oauth_timestamp = REXML::Element.new("oauth_timestamp")
      oauth_timestamp.text = request.oauth_timestamp
      oauth.add(oauth_timestamp)

      oauth_nonce = REXML::Element.new("oauth_nonce")
      oauth_nonce.text = request.oauth_nonce
      oauth.add(oauth_nonce)

      oauth_version = REXML::Element.new("oauth_version")
      oauth_version.text = request.oauth_version
      oauth.add(oauth_version)

      oauth
    end

new(stream, pubsubjid, oauth_consumer, oauth_token, options = {}) click to toggle source

    # File lib/xmpp4r/pubsub/helper/oauth_service_helper.rb, line 20
    def initialize(stream, pubsubjid, oauth_consumer, oauth_token, options = {})
      # imbue the stream with magical OAuth signing powers
      stream.extend(OAuthPubSubStreamHelper)
      stream.oauth_consumer = oauth_consumer
      stream.oauth_token = oauth_token
      stream.oauth_options = options
      stream.pubsubjid = pubsubjid

      super(stream, pubsubjid)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.