目前开发一个项目采用java+php的组合
使用cas作为单点登录的服务,服务端已经部署没问题
java客户端使用cas做单点登录没问题。
但是php客户端使用cas的时候,无论怎么调,总是报以下错误:
CAS Authentication failed!You were not authenticated.You may submit your request again by clicking here.If the problem persists, you may contact the administrator of this site.无解啊,求高手给力 帮忙解决
使用cas作为单点登录的服务,服务端已经部署没问题
java客户端使用cas做单点登录没问题。
但是php客户端使用cas的时候,无论怎么调,总是报以下错误:
CAS Authentication failed!You were not authenticated.You may submit your request again by clicking here.If the problem persists, you may contact the administrator of this site.无解啊,求高手给力 帮忙解决
我已经却掉了8443端口的安全认证,使用的是80端口。网上能搜的我都搜遍了!!!
千篇一律,都是一摸一样的配置,也不知道谁抄谁?
难道国内就没有人真正的遇到过这样的问题?
有没有谁真正的遇到过这样的错误?
CAS Authentication failed!
有没有?
一个名叫:example_simple.php的文件
内容如下:<?php//
// phpCAS simple client
//// import phpCAS lib
include_once('CAS.php');phpCAS::setDebug();// initialize phpCAS
phpCAS::client(CAS_VERSION_2_0,'passport.autoedu.com.cn',80,'');// no SSL validation for the CAS server
phpCAS::setNoCasServerValidation();// force CAS authentication
phpCAS::forceAuthentication();// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>phpCAS simple client</title>
</head>
<body>
<h1>Successfull Authentication!</h1>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
<p><a href="?logout=">Logout</a></p>
</body>
</html>
cas服务器已经部署好 java程序使用没问题
但是上面这个php程序使用的时候 当访问上述这个文件的时候 提示登录 登录后 就报错:
CAS Authentication failed!You were not authenticated.You may submit your request again by clicking here.If the problem persists, you may contact the administrator of this site.
6C8A .=> phpCAS::client('2.0', 'passport.autoedu.com.cn', 80, '') [example_simple.php:13]
6C8A .| => CASClient::CASClient('2.0', false, 'passport.autoedu.com.cn', 80, '', true) [CAS.php:374]
6C8A .| | Starting a new session [client.php:680]
6C8A .| <= ''
6C8A .<= ''
6C8A .=> phpCAS::setNoCasServerValidation() [example_simple.php:16]
6C8A .<= ''
6C8A .=> phpCAS::forceAuthentication() [example_simple.php:19]
6C8A .| => CASClient::forceAuthentication() [CAS.php:950]
6C8A .| | => CASClient::isAuthenticated() [client.php:952]
6C8A .| | | => CASClient::wasPreviouslyAuthenticated() [client.php:1047]
6C8A .| | | | no user found [client.php:1216]
6C8A .| | | <= false
6C8A .| | | no ticket found [client.php:1109]
6C8A .| | <= false
6C8A .| | => CASClient::redirectToCas(false) [client.php:961]
6C8A .| | | => CASClient::getServerLoginURL(false, false) [client.php:1232]
6C8A .| | | | => CASClient::getURL() [client.php:439]
6C8A .| | | | | Final URI: http://bbs.autoedu.com.cn/example_simple.php [client.php:2805]
6C8A .| | | | <= 'http://bbs.autoedu.com.cn/example_simple.php'
6C8A .| | | <= 'http://passport.autoedu.com.cn:80/login?service=http%3A%2F%2Fbbs.autoedu.com.cn%2Fexample_simple.php'
6C8A .| | | Redirect to : http://passport.autoedu.com.cn:80/login?service=http%3A%2F%2Fbbs.autoedu.com.cn%2Fexample_simple.php [client.php:1234]
6C8A .| | | exit()
6C8A .| | | -
6C8A .| | -
6C8A .| -
0EFB .START phpCAS-1.2.0RC2 ****************** [CAS.php:471]
0EFB .=> phpCAS::client('2.0', 'passport.autoedu.com.cn', 80, '') [example_simple.php:13]
0EFB .| => CASClient::CASClient('2.0', false, 'passport.autoedu.com.cn', 80, '', true) [CAS.php:374]
0EFB .| | Starting a new session [client.php:680]
0EFB .| | ST or PT 'ST-2-lifxE4vULp6tjP39T2R2-cas' found [client.php:766]
0EFB .| <= ''
0EFB .<= ''
0EFB .=> phpCAS::setNoCasServerValidation() [example_simple.php:16]
0EFB .<= ''
0EFB .=> phpCAS::forceAuthentication() [example_simple.php:19]
0EFB .| => CASClient::forceAuthentication() [CAS.php:950]
0EFB .| | => CASClient::isAuthenticated() [client.php:952]
0EFB .| | | => CASClient::wasPreviouslyAuthenticated() [client.php:1047]
0EFB .| | | | no user found [client.php:1216]
0EFB .| | | <= false
0EFB .| | | PT `ST-2-lifxE4vULp6tjP39T2R2-cas' is present [client.php:1082]
0EFB .| | | => CASClient::validatePT('', NULL, NULL) [client.php:1083]
0EFB .| | | | [client.php:2653]
0EFB .| | | | => CASClient::getURL() [client.php:550]
0EFB .| | | | | Final URI: http://bbs.autoedu.com.cn/example_simple.php [client.php:2805]
0EFB .| | | | <= 'http://bbs.autoedu.com.cn/example_simple.php'
0EFB .| | | | => CAS_CurlRequest::_sendRequest() [AbstractRequest.php:188]
0EFB .| | | | | curl_exec() failed [CurlRequest.php:124]
0EFB .| | | | <= false
0EFB .| | | | could not open URL 'http://passport.autoedu.com.cn:80/proxyValidate?service=http%3A%2F%2Fbbs.autoedu.com.cn%2Fexample_simple.php&ticket=ST-2-lifxE4vULp6tjP39T2R2-cas' to validate (CURL error #6: Couldn't resolve host 'passport.autoedu.com.cn') [client.php:2664]
0EFB .| | | | => CASClient::authError('PT not validated', 'http://passport.autoedu.com.cn:80/proxyValidate?service=http%3A%2F%2Fbbs.autoedu.com.cn%2Fexample_simple.php&ticket=ST-2-lifxE4vULp6tjP39T2R2-cas', true) [client.php:2667]
0EFB .| | | | | => CASClient::getURL() [client.php:2888]
0EFB .| | | | | <= 'http://bbs.autoedu.com.cn/example_simple.php'
0EFB .| | | | | CAS URL: http://passport.autoedu.com.cn:80/proxyValidate?service=http%3A%2F%2Fbbs.autoedu.com.cn%2Fexample_simple.php&ticket=ST-2-lifxE4vULp6tjP39T2R2-cas [client.php:2889]
0EFB .| | | | | Authentication failure: PT not validated [client.php:2890]
0EFB .| | | | | Reason: no response from the CAS server [client.php:2892]
0EFB .| | | | | exit()
0EFB .| | | | | -
0EFB .| | | | -
0EFB .| | | -
0EFB .| | -
0EFB .| -
打开C盘下windows目录中的php.ini文件,查找将下面这个语句前面分号去掉即可。
extension=php_curl.dll