ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Auth_OpenID_AssociateRequest Class Reference
+ Inheritance diagram for Auth_OpenID_AssociateRequest:
+ Collaboration diagram for Auth_OpenID_AssociateRequest:

Public Member Functions

 Auth_OpenID_AssociateRequest ($session, $assoc_type)
 
 answer ($assoc)
 
 answerUnsupported ($text_message, $preferred_association_type=null, $preferred_session_type=null)
 

Static Public Member Functions

static getSessionClasses ()
 
static fromMessage ($message, $server=null)
 

Data Fields

 $mode = "associate"
 
- Data Fields inherited from Auth_OpenID_Request
 $mode = null
 

Detailed Description

Definition at line 582 of file Server.php.

Member Function Documentation

◆ answer()

Auth_OpenID_AssociateRequest::answer (   $assoc)

Definition at line 652 of file Server.php.

653 {
654 $response = new Auth_OpenID_ServerResponse($this);
655 $response->fields->updateArgs(Auth_OpenID_OPENID_NS,
656 array(
657 'expires_in' => sprintf('%d', $assoc->getExpiresIn()),
658 'assoc_type' => $this->assoc_type,
659 'assoc_handle' => $assoc->handle));
660
661 $response->fields->updateArgs(Auth_OpenID_OPENID_NS,
662 $this->session->answer($assoc->secret));
663
664 if (! ($this->session->session_type == 'no-encryption'
665 && $this->message->isOpenID1())) {
666 $response->fields->setArg(Auth_OpenID_OPENID_NS,
667 'session_type',
668 $this->session->session_type);
669 }
670
671 return $response;
672 }
const Auth_OpenID_OPENID_NS
Definition: Message.php:42

References Auth_OpenID_OPENID_NS.

◆ answerUnsupported()

Auth_OpenID_AssociateRequest::answerUnsupported (   $text_message,
  $preferred_association_type = null,
  $preferred_session_type = null 
)

Definition at line 674 of file Server.php.

677 {
678 if ($this->message->isOpenID1()) {
679 return new Auth_OpenID_ServerError($this->message);
680 }
681
682 $response = new Auth_OpenID_ServerResponse($this);
683 $response->fields->setArg(Auth_OpenID_OPENID_NS,
684 'error_code', 'unsupported-type');
685 $response->fields->setArg(Auth_OpenID_OPENID_NS,
686 'error', $text_message);
687
688 if ($preferred_association_type) {
689 $response->fields->setArg(Auth_OpenID_OPENID_NS,
690 'assoc_type',
691 $preferred_association_type);
692 }
693
694 if ($preferred_session_type) {
695 $response->fields->setArg(Auth_OpenID_OPENID_NS,
696 'session_type',
697 $preferred_session_type);
698 }
699 $response->code = AUTH_OPENID_HTTP_ERROR;
700 return $response;
701 }
const AUTH_OPENID_HTTP_ERROR
Definition: Server.php:108

References AUTH_OPENID_HTTP_ERROR, and Auth_OpenID_OPENID_NS.

◆ Auth_OpenID_AssociateRequest()

Auth_OpenID_AssociateRequest::Auth_OpenID_AssociateRequest (   $session,
  $assoc_type 
)

Definition at line 593 of file Server.php.

594 {
595 $this->session = $session;
596 $this->namespace = Auth_OpenID_OPENID2_NS;
597 $this->assoc_type = $assoc_type;
598 }
const Auth_OpenID_OPENID2_NS
Definition: Message.php:35

References Auth_OpenID_OPENID2_NS.

Referenced by fromMessage().

+ Here is the caller graph for this function:

◆ fromMessage()

static Auth_OpenID_AssociateRequest::fromMessage (   $message,
  $server = null 
)
static

Definition at line 600 of file Server.php.

601 {
602 if ($message->isOpenID1()) {
603 $session_type = $message->getArg(Auth_OpenID_OPENID_NS,
604 'session_type');
605
606 if ($session_type == 'no-encryption') {
607 // oidutil.log('Received OpenID 1 request with a no-encryption '
608 // 'assocaition session type. Continuing anyway.')
609 } else if (!$session_type) {
610 $session_type = 'no-encryption';
611 }
612 } else {
613 $session_type = $message->getArg(Auth_OpenID_OPENID_NS,
614 'session_type');
615 if ($session_type === null) {
616 return new Auth_OpenID_ServerError($message,
617 "session_type missing from request");
618 }
619 }
620
621 $session_class = Auth_OpenID::arrayGet(
623 $session_type);
624
625 if ($session_class === null) {
626 return new Auth_OpenID_ServerError($message,
627 "Unknown session type " .
628 $session_type);
629 }
630
631 $session = call_user_func(array($session_class, 'fromMessage'),
632 $message);
633 if (is_a($session, 'Auth_OpenID_ServerError')) {
634 return $session;
635 }
636
637 $assoc_type = $message->getArg(Auth_OpenID_OPENID_NS,
638 'assoc_type', 'HMAC-SHA1');
639
640 if (!in_array($assoc_type, $session->allowed_assoc_types)) {
641 $fmt = "Session type %s does not support association type %s";
642 return new Auth_OpenID_ServerError($message,
643 sprintf($fmt, $session_type, $assoc_type));
644 }
645
646 $obj = new Auth_OpenID_AssociateRequest($session, $assoc_type);
647 $obj->message = $message;
648 $obj->namespace = $message->getOpenIDNamespace();
649 return $obj;
650 }
Auth_OpenID_AssociateRequest($session, $assoc_type)
Definition: Server.php:593
static arrayGet($arr, $key, $fallback=null)
Convenience function for getting array values.
Definition: OpenID.php:242

References Auth_OpenID\arrayGet(), Auth_OpenID_AssociateRequest(), Auth_OpenID_OPENID_NS, and getSessionClasses().

+ Here is the call graph for this function:

◆ getSessionClasses()

static Auth_OpenID_AssociateRequest::getSessionClasses ( )
static

Definition at line 585 of file Server.php.

586 {
587 return array(
588 'no-encryption' => 'Auth_OpenID_PlainTextServerSession',
589 'DH-SHA1' => 'Auth_OpenID_DiffieHellmanSHA1ServerSession',
590 'DH-SHA256' => 'Auth_OpenID_DiffieHellmanSHA256ServerSession');
591 }

Referenced by fromMessage().

+ Here is the caller graph for this function:

Field Documentation

◆ $mode

Auth_OpenID_AssociateRequest::$mode = "associate"

Definition at line 583 of file Server.php.


The documentation for this class was generated from the following file: