##// END OF EJS Templates
Link to watched issues list on my page....
Link to watched issues list on my page. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2457 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r2376:f70be197e0ae
r2396:5bdd4291624c
Show More
extension.rb
39 lines | 1.1 KiB | text/x-ruby | RubyLexer
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