Development

Changeset 15878

You must first sign up to be able to contribute.

Changeset 15878

Show
Ignore:
Timestamp:
03/01/09 05:21:36 (4 years ago)
Author:
chrodriguez
Message:

Solved problem when SSO session change. It happends when other SSO enabled application logout and the login with other user/roles

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/crJossoPlugin/trunk/lib/crJossoSecurityFilter.class.php

    r15863 r15878  
    2727      return; 
    2828    }else{ 
    29       //Check if user authenticated is also authenticated in SSO Identity Manager 
    30       if ($this->context->getUser()->isAuthenticated()&&is_null($aSession)
     29      //Check if user authenticated  
     30      if ($this->context->getUser()->isAuthenticated()
    3131      { 
    32           // the user is not authenticated against SSO Identity Manager... 
     32        // if it is not authenticated in SSO Identity Manager then force login 
     33        // or 
     34        // if shall we relogin because SSO Session changed 
     35        if (  is_null($aSession)  || 
     36              $this->context->getUser()->haveToRelogin($aSession) 
     37            ){ 
    3338          $this->context->getUser()->setAuthenticated(false); 
    3439          // Then we need to relogin on JOSSO Server 
    3540          $this->forwardToLoginAction(); 
     41        } 
    3642      } 
    3743 
  • plugins/crJossoPlugin/trunk/lib/user/crJossoUser.class.php

    r15863 r15878  
    99class crJossoUser extends sfBasicSecurityUser { 
    1010   
    11   /** 
    12    * User instance of JossoUser 
    13    * @var JossoUser 
    14    * @access private 
    15    */ 
    16   private $user=null; 
    1711 
    1812  /** 
     
    2216  * @access public 
    2317  * 
    24   * @param    JossoUser $user 
     18  * @param    string $aSession SSO Session ID 
    2519  */ 
    26   public function signIn(JossoUser $user
     20  public function signIn($aSession
    2721  { 
     22    $this->setAttribute('crJossoPluginSessionId',$aSession); 
    2823    $this->setAuthenticated(true); 
    29     $this->user=$user; 
    3024    $this->loadJossoCredentials(); 
     25  } 
     26 
     27 
     28  /** 
     29  * Checks if the SSO Session ID has changed with our own session 
     30  * 
     31  * @return boolean 
     32  * 
     33  * @access public 
     34  */ 
     35  public function haveToRelogin($aSession) 
     36  { 
     37    return $aSession!=$this->getAttribute('crJossoPluginSessionId','-1'); 
    3138  } 
    3239 
     
    4047  public function getJossoUser() 
    4148  { 
    42     if (is_null($this->user)) 
    43     { 
    44       $agent=JossoAgent::getNewInstance(); 
    45       try{ 
    46         $this->signin($agent->getUserInSession()); 
    47       }catch(SoapFault $e){ 
    48       } 
    49       if (!$this->user) 
    50         $this->signOut(); 
     49    $agent=JossoAgent::getNewInstance(); 
     50    try{ 
     51      return $agent->getUserInSession(); 
     52    }catch(SoapFault $e){ 
     53      return null; 
    5154    } 
    52     return $this->user; 
    5355  } 
    5456 
     
    6163  { 
    6264    $this->setAuthenticated(false); 
    63     $this->user=null; 
    6465  } 
    6566 
     
    7273  protected function loadJossoCredentials() 
    7374  { 
    74     if (is_null($this->user))return; 
    75     foreach($this->user->getRoles() as $role){ 
     75    $user=$this->getJossoUser(); 
     76    if (is_null($user))return; 
     77    foreach($user->getRoles() as $role){ 
    7678      $this->addCredential($role->getName()); 
    7779    } 
  • plugins/crJossoPlugin/trunk/modules/crJossoAuth/lib/BasecrJossoAuthActions.class.php

    r15863 r15878  
    2222    $josso_user=$agent->getUserInSession(); 
    2323    if (!is_null($josso_user)){ 
    24       $this->getUser()->signIn($josso_user); 
     24      $this->getUser()->signIn($agent->accessSession()); 
    2525      $this->redirect('@homepage'); 
    2626    }else{ 
  • plugins/crJossoPlugin/trunk/package.xml

    r15864 r15878  
    2222  <active>yes</active> 
    2323 </lead> 
    24  <date>2009-02-27</date> 
    25  <time>20:54:35</time> 
     24 <date>2009-03-01</date> 
     25 <time>02:30:00</time> 
    2626 <version> 
    27   <release>0.1.1</release> 
     27  <release>0.1.2</release> 
    2828  <api>1.1.0</api> 
    2929 </version> 
     
    107107    </notes> 
    108108  </release> 
     109  <release> 
     110    <version> 
     111      <release>0.1.2</release> 
     112      <api>1.1.0</api> 
     113    </version> 
     114    <stability> 
     115     <release>beta</release> 
     116     <api>beta</api> 
     117    </stability> 
     118    <license uri="http://www.symfony-project.org/license">MIT license</license> 
     119    <date>2009-02-27</date> 
     120    <license>MIT</license> 
     121    <notes> 
     122      * Solved problem when SSO session change. It happends when other SSO enabled application logout and the login with other user/roles  
     123    </notes> 
     124  </release> 
    109125 </changelog> 
    110126</package>