CAS-SSO with Moodle 2.0.3

CAS-SSO with Moodle 2.0.3

by Steffen Fahl -
Number of replies: 7

I tried what ever seemed to be possible in the CAS-authentication settings. Meanwhile I was able to setup a working CAS-SSO of a Drupalsite with my CAS-Server on a diffrent webspace, Moodle doesn't seem to react at all on entering the CAS-Serverdata in the Moodle-CAS Auth-Plugin.

I have tried both: https://myCAS-serverdomain.de

and: http://myCAS-serverdomain.de

and: myCAS-serverdomain.de

port 443

URI: "cas"    (and also: "cas/login")

But I could not see any attempt of Moodle to connect with the CAS-Server at all.

If anyone here successfully setup a CAS-SSO with Moodle 2.0 I would be quite happy to learn how I could do this to.

best

fahl5

Average of ratings: -
In reply to Steffen Fahl

Re: CAS-SSO with Moodle 2.0.3

by Jerald Fernando -

Steffen,

I was able to setup the CAS 2.0 in my local machine. 

Hostname : myCAS-serverdomain.de

Base URI : cas/

Port : 443

Version :  CAS 2.0

These are the settings that I made and it was taking me to the CAS server to login. But when I enter my credentials and I come back I am getting the following error

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.


phpCAS 1.1.3 using server https://login.nxp.com/cas/ (CAS 2.0)
 
I am stuck here... smile. Any help will be really great.
 
regards.... Jerald
In reply to Jerald Fernando

Re: CAS-SSO with Moodle 2.0.3

by Jerald Fernando -

Adding to my previous post, I traced to the error and I ended up landing in 

function validatePT(&$validate_url,&$text_response,&$tree_response)

when I printed the $error_msg variable from

if ( !$this->readURL($validate_url,''/*cookies*/,$headers,$text_response,$err_msg) ) {

echo $err_msg;

I got the below error

CURL error #6: Could not resolve host: login.mycas-server.com; Host not found

Could it be a proxy problem. If so what are the configurations that has to be done, where it has to be done, Is there any proxy configurations available in CAS-SSO Moodle plugin

In reply to Jerald Fernando

Re: CAS-SSO with Moodle 2.0.3

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi Jerald,

It looks like your Moodle server is not able to resolve the name of your CAS server. It's either a DNS configuration problem on your Moodle server, or some network/security issue that prevents the DNS traffic from working.

Saludos.
Iñaki.
In reply to Steffen Fahl

Re: CAS-SSO with Moodle 2.0.3

by edward kim -

this error will be cause from curl ssl version. phpCAS library using curl.

This curl works well in Apache2 + openssl's SSL but not work at Tomcat SSL.

You cant test curl function as like following:

 curl --url 'http://lms.example.com/login/index.php?authCAS=CAS'  --cacert /etc/ssl/certs/ca-cert.pem --sslv3

As your site, omit option --sslv3 will be not work.

So, You have to setting curl SSL Version Option!

my configuration is :

openLDAP + CAS 3.4.11 +  moodle 2.2.1 + phpCAS1.2.2

 First of All, I'd change phpCAS bundle to phpCAS1.2.2.

you can download phpCAS1.2.2 from https://wiki.jasig.org/display/CASC/phpCAS.

and tar xvzf CAS-1.2.2.tgz. After unzip, you have to backup original phpCAS at moodle/auth/cas/CAS to CAS-org.

After that, move CAS-1.2.2 directory to moodle/auth/cas/CAS .

And then, go to the directory moodle/auth/cas/CAS/CAS/Request

And then edit the CurlRequest.php file.  go to 78 line and add following line:

if ($this->caCertPath) {
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
 curl_setopt($ch, CURLOPT_CAINFO, $this->caCertPath);
 curl_setopt($ch, CURLOPT_SSLVERSION, 3);  // -- Add this line for SSL Version Setting to 3
 phpCAS::trace('CURL: Set CURLOPT_CAINFO');

 

save change and then login test plz... You will be Login successfully!

Note: If user Account already exists in moodle, You have to change user's authentication method to CAS(SSO).

 

In reply to edward kim

Re: CAS-SSO with Moodle 2.0.3

by Sha Arah -

Help me.. we have the same issue with yours.. but.. unfortunately it doesn't work for me. sad 

My environment : phpCAS 1.2.2 + tomcat 7+ moodle 2.5.3 + php 5.5.5

I've also change curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); become 2 as it is recommended.

"Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead "

Anything that you can suggest to me so I can troubleshoot my problem.. 

Please do help me... 

In reply to Steffen Fahl

Re: CAS-SSO with Moodle 2.0.3

by edward kim -

this error will be cause from curl ssl version. phpCAS library using curl.

This curl works well in Apache2 + openssl's SSL but not work at Tomcat SSL.

You cant test curl function as like following:

 curl --url 'http://lms.example.com/login/index.php?authCAS=CAS'  --cacert /etc/ssl/certs/ca-cert.pem --sslv3

As your site, omit option --sslv3 will be not work.

So, You have to setting curl SSL Version Option!

my configuration is :

openLDAP + CAS 3.4.11 +  moodle 2.2.1 + phpCAS1.2.2

 First of All, I'd change phpCAS bundle to phpCAS1.2.2.

you can download phpCAS1.2.2 from https://wiki.jasig.org/display/CASC/phpCAS.

and tar xvzf CAS-1.2.2.tgz. After unzip, you have to backup original phpCAS at moodle/auth/cas/CAS to CAS-org.

After that, move CAS-1.2.2 directory to moodle/auth/cas/CAS .

And then, go to the directory moodle/auth/cas/CAS/CAS/Request

And then edit the CurlRequest.php file.  go to 78 line and add following line:

if ($this->caCertPath) {
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
 curl_setopt($ch, CURLOPT_CAINFO, $this->caCertPath);
 curl_setopt($ch, CURLOPT_SSLVERSION, 3);  // -- Add this line for SSL Version Setting to 3
 phpCAS::trace('CURL: Set CURLOPT_CAINFO');

 

save change and then login test plz... You will be Login successfully!

Note: If user Account already exists in moodle, You have to change user's authentication method to CAS(SSO).

 

In reply to edward kim

回复: Re: CAS-SSO with Moodle 2.0.3

by 安 王 -

MR.Kim:

my configuration is  

   openLDAP + CAS 3.4.8 +  moodle 2.2.3

When I click LOGIN ,it shows: 

  phpCAS error: phpCAS::client(): this version of CAS (`cas-server-3.4.8') is not supported by phpCAS 1.1.3 in D:\xampp\htdocs\moodle\auth\cas\auth.php on line 193

how to slove this problem?