Sha256: 5c22f84d2bc8e5ddaec03d65826485b6c641a1f96180c8edf432d7f4450c90a6

Contents?: true

Size: 1.12 KB

Versions: 22

Compression:

Stored size: 1.12 KB

Contents

require 'openid/message'

module OpenID
  # An interface for OpenID extensions.
  class Extension < Object

    def initialize
      @ns_uri = nil
      @ns_alias = nil
    end

    # Get the string arguments that should be added to an OpenID
    # message for this extension.
    def get_extension_args
      raise NotImplementedError
    end

    # Add the arguments from this extension to the provided
    # message, or create a new message containing only those
    # arguments.  Returns the message with added extension args.
    def to_message(message = nil)
      if message.nil?
#         warnings.warn('Passing None to Extension.toMessage is deprecated. '
#                       'Creating a message assuming you want OpenID 2.',
#                       DeprecationWarning, stacklevel=2)
        Message.new(OPENID2_NS)
      end
      message = Message.new if message.nil?

      implicit = message.is_openid1()

      message.namespaces.add_alias(@ns_uri, @ns_alias, implicit)
      # XXX python ignores keyerror if m.ns.getAlias(uri) == alias

      message.update_args(@ns_uri, get_extension_args)
      return message
    end
  end
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
ruby-openid-2.9.2 lib/openid/extension.rb
ruby-openid-2.9.1 lib/openid/extension.rb
ruby-openid-2.8.0 lib/openid/extension.rb
ruby-openid-2.7.0 lib/openid/extension.rb
ruby-openid-2.6.0 lib/openid/extension.rb
pelle-ruby-openid-2.1.8 lib/openid/extension.rb
ruby-openid-2.5.0 lib/openid/extension.rb
ruby-openid-2.4.0 lib/openid/extension.rb
ruby-openid-2.3.0 lib/openid/extension.rb
ruby-openid-2.2.3 lib/openid/extension.rb
ruby-openid-2.2.2 lib/openid/extension.rb
ruby-openid-2.2.1 lib/openid/extension.rb
ruby-openid-2.2.0 lib/openid/extension.rb
entp-ruby-openid-2.2 lib/openid/extension.rb
nov-ruby-openid-2.1.9 lib/openid/extension.rb
ruby-openid-2.1.8 lib/openid/extension.rb
pelle-ruby-openid-2.1.9 lib/openid/extension.rb
ruby-openid-2.1.7 lib/openid/extension.rb
ruby-openid-2.1.5 lib/openid/extension.rb
ruby-openid-2.1.2 lib/openid/extension.rb