The following code snippet shows how to use CAS to authenticate to glast-ground from a JSP page.

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="cas" uri="http://www.yale.edu/its/tp/cas/version2" %> 
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
        <title>Glast System Tests: Login</title>
    </head>
    <body>
        <cas:auth var="netID" scope="session">
            <cas:loginUrl>https://glast-ground.slac.stanford.edu/cas/login</cas:loginUrl>
            <cas:validateUrl>https://glast-ground.slac.stanford.edu/cas/proxyValidate</cas:validateUrl>
            <cas:service><c:url value="${pageContext.request.requestURL}"/></cas:service>
        </cas:auth>
        <p>Welcome: ${netID}!</p>
    </bod

Note that in addition you must put the following in your web.xml

<context-param>
       <param-name>edu.yale.its.tp.cas.serverName</param-name>
       <param-value>glast-ground.slac.stanford.edu:80</param-value>  
</context-param>

More documentation can be found at http://tp.its.yale.edu/tiki/tiki-index.php?page=UsingCASWithJava

  • No labels