CAS-login in PHP?

Posted on 2011-05-01
Last Modified: 2012-05-11

I want to implement CAS-login.
Here is some more information: Link

Some example code (see attached): Link (specific for the CAS-server at KTH which I will use).

Can some one give me more detailed information of how I will do it?

I uploaded the attached PHP-file to my server but it doesn't show anything when I run it.


Anders Branderud

// phpCAS simple client

// import phpCAS lib

// initialize phpCAS


// force CAS authentication

// 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'])) {

Open in new window

Question by:AndersBranderud

    Accepted Solution

    I added this to the php-file and it solve the problem.:

     <title>phpCAS simple client</title>
     <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>

    Author Closing Comment

    Some minutes after that I had posted my question I found the solution myself.

    Author Comment

    Addition: The above code in my latest comment was found in a guide.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now