| | |
| | | } |
| | | } |
| | | |
| | | public function getServerUrl($serverUrl) { |
| | | return $this->serverUrl; |
| | | } |
| | | public function setServerUrl($serverUrl) { |
| | | $this->serverUrl = $serverUrl; |
| | | } |
| | | |
| | | public function getServiceUrl() { |
| | | return $this->serviceUrl; |
| | | } |
| | | public function setServiceUrl($serviceUrl) { |
| | | $this->serviceUrl = $serviceUrl; |
| | | } |
| | |
| | | return $this->serverUrl.'/login?method=POST&service='.urlencode($this->serviceUrl); |
| | | } |
| | | |
| | | public function logoutUrl() { |
| | | return $this->serverUrl.'/logout'; |
| | | public function logoutUrl($returnUrl = NULL) { |
| | | return $this->serverUrl.'/logout'.($returnUrl ? '?service='.urlencode($returnUrl) : ''); |
| | | } |
| | | |
| | | public function logout() { |
| | |
| | | die(); |
| | | } |
| | | |
| | | public function isAuthenticated() { |
| | | return isset($_SESSION['uphpCAS-user']); |
| | | } |
| | | |
| | | public function authenticate() { |
| | | session_start(); |
| | | if(isset($_SESSION['uphpCAS-user'])) { |
| | | if($this->isAuthenticated()) { |
| | | return $_SESSION['uphpCAS-user']; |
| | | } elseif(isset($_REQUEST['ticket'])) { |
| | | $user = $this->verifyTicket($_REQUEST['ticket']); |