Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: removed SVN references since no longer using SVN

...

The examples below show a variety of ways to utilize the phpCAS library. All examples can be found in the distribution packes and can be downloaded from theĀ  SVN examples page Examples directory in source control

Table of Contents

A simple CAS client

phpCAS can be used the simplest way, as a CAS client

SVN simple example source code

Run-time behaviour configuration

...

Setting the language for error pages or notifications

SVN language Language example source code

HTML output

Changing the html style of error pages and notifications

SVN html HTML example source code

A CAS proxy

phpCAS can also make a PHP script act as a cas proxy client. The phpcas client get a proxy ticket from the cas server and uses it to access external services in your name. (calling external services). The proxy client has support for cookies and can be used for sessions etc.

A CAS proxy using serviceWeb()

SVN example Example proxy serviceWeb source code

A CAS proxied service

An example service (also CAS client) to be called from the example_proxy_serviceWeb. This example also uses the session for a simple counter.

SVN example service source code

CAS proxies can be chained

A CAS proxy client can also be a proxied itself

SVN example Example chained proxy source code

The ProxiedService system

...

The HTTP GET Proxied Service is equivalent to serviceWeb(), but provides an exception-based API.

SVN example_proxy_GET source code

SVN example service source code

CAS_ProxiedService_Http_Post

The HTTP POST Proxied Service allows clients to make proxy-authenticated POST requests.

SVN example_proxy_POST source code

SVN example_service_POST source code

CAS_ProxiedService_Imap

The IMAP Proxied Service is equivalent to serviceMail(), but provides an exception-based API.

...

The necessary storing of Proxy Granting Tickets PGT for proxy functionality can be configured

Onto the filesystem

SVN example file storage source code

Advanced features

Only check authentication (gateway)

The possibility of using the CAS gateway feature (see http://www.ja-sig.org/wiki/display/CAS/gateway)

SVN example gateway source code

Handle logout requests from the CAS server

...

Code Block
phpCAS::handleLogoutRequests(true, array("server1.domain.edu", "server2.domain.edu"));

SVN example single sign out source code

SAML Protocol with Attribute Release

An advanced exmaple using the SAML protocol with attribute release and single logout.

SVN example advanced SAML source code

Custom validation URLs

The following example shows how to configure a non-standard url for ticket validation. This feature is supported in phpcas since version 1.1.0RC2. The validation urls can be set for service, proxy and saml validation.

SVN example custom url source code