Method: OpenID::Server::AssociateRequest.from_message
- Defined in:
- lib/openid/server.rb
.from_message(message, op_endpoint = UNUSED) ⇒ Object
Construct me from an OpenID Message.
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/openid/server.rb', line 312 def self.(, op_endpoint=UNUSED) if .is_openid1() session_type = .get_arg(OPENID_NS, 'session_type') if session_type == 'no-encryption' Util.log('Received OpenID 1 request with a no-encryption ' + 'association session type. Continuing anyway.') elsif !session_type session_type = 'no-encryption' end else session_type = .get_arg(OPENID2_NS, 'session_type') if !session_type raise ProtocolError.new(, text="session_type missing from request") end end session_class = @@session_classes[session_type] if !session_class raise ProtocolError.new(, sprintf("Unknown session type %s", session_type)) end begin session = session_class.() rescue ArgumentError => why # XXX raise ProtocolError.new(, sprintf('Error parsing %s session: %s', session_type, why)) end assoc_type = .get_arg(OPENID_NS, 'assoc_type', 'HMAC-SHA1') if !session.allowed_assoc_type?(assoc_type) msg = sprintf('Session type %s does not support association type %s', session_type, assoc_type) raise ProtocolError.new(, msg) end obj = self.new(session, assoc_type) obj. = return obj end |