From 9ee25d4ab6d0744f681206a7b1e1eb12dfc424c7 Mon Sep 17 00:00:00 2001 From: Scott Battaglia Date: Wed, 4 Oct 2006 01:33:40 +0000 Subject: [PATCH] updated examples --- .../src/main/resources/cas-client.properties | 2 + .../src/main/resources/simpleFilter.xml | 101 ++++++++++++++++ .../main/resources/simpleFilterExample.xml | 72 ------------ cas-client-core/src/main/resources/test.jsp | 109 ++++++++++++++++++ .../src/main/resources/web-simple-example.xml | 16 +-- .../resources/web-simple-proxy-example.xml | 98 ++++++++++++++++ .../properties/uPortalConfigContext.xml | 3 +- 7 files changed, 320 insertions(+), 81 deletions(-) create mode 100644 cas-client-core/src/main/resources/simpleFilter.xml delete mode 100644 cas-client-core/src/main/resources/simpleFilterExample.xml create mode 100644 cas-client-core/src/main/resources/test.jsp create mode 100644 cas-client-core/src/main/resources/web-simple-proxy-example.xml diff --git a/cas-client-core/src/main/resources/cas-client.properties b/cas-client-core/src/main/resources/cas-client.properties index d2ce241..eef3fd0 100644 --- a/cas-client-core/src/main/resources/cas-client.properties +++ b/cas-client-core/src/main/resources/cas-client.properties @@ -2,3 +2,5 @@ cas.server.gateway=false cas.server.renew=false cas.server.url=https://localhost:8443/cas/ cas.server.proxyCallbackUrl=https://localhost:8443/manager/proxy/Receptor +cas.client.serverName=https://localhost:8443 +cas.client.proxyCallbackUrl=https://localhost:8443/myClientApp/casProxyReceptor \ No newline at end of file diff --git a/cas-client-core/src/main/resources/simpleFilter.xml b/cas-client-core/src/main/resources/simpleFilter.xml new file mode 100644 index 0000000..c3532f1 --- /dev/null +++ b/cas-client-core/src/main/resources/simpleFilter.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + scott + velpi + apetro + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cas-client-core/src/main/resources/simpleFilterExample.xml b/cas-client-core/src/main/resources/simpleFilterExample.xml deleted file mode 100644 index 15b632c..0000000 --- a/cas-client-core/src/main/resources/simpleFilterExample.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - battags - - - - \ No newline at end of file diff --git a/cas-client-core/src/main/resources/test.jsp b/cas-client-core/src/main/resources/test.jsp new file mode 100644 index 0000000..72d8463 --- /dev/null +++ b/cas-client-core/src/main/resources/test.jsp @@ -0,0 +1,109 @@ + + + JA-SIG CAS client test - <%=request.getHeader("host") %> + + + + + + + +
+<% + //CAS server root + //String casServerUrl= "https://localhost/cas/"; + String casServerUrl = "https://idp.example.be/cas/"; + + //thread-safe httpclient + org.apache.commons.httpclient.HttpClient casHttpClient = new org.apache.commons.httpclient.HttpClient(); + + //name of cas assertion in session + String casAssName = "_cas_assertion_"; + + Object assObject = session.getAttribute("_cas_assertion_"); + if (assObject != null) { + org.jasig.cas.client.validation.Assertion assertion = (org.jasig.cas.client.validation.Assertion) assObject; + String principalId = assertion.getPrincipal().getId(); + String pgtId = assertion.getProxyGrantingTicketId(); + out.println("principalID: " + principalId + "
"); + out.println("PGT-ID: " + pgtId + "
"); + + out.println("--
"); + org.jasig.cas.client.proxy.Cas20ProxyRetriever ptRet = new org.jasig.cas.client.proxy.Cas20ProxyRetriever(casServerUrl, casHttpClient); + + org.jasig.cas.authentication.principal.SimpleService targetService = new org.jasig.cas.authentication.principal.SimpleService("https://testService"); + String pt = ptRet.getProxyTicketIdFor(pgtId, targetService); + out.println("retrieved PT: " + pt + "
"); + + } else { + out.println("no CAS assertion with name \"" + casAssName + "\" found in session"); + } + + +%> +
+ +<% + out.print("request.getRemoteUser: " + request.getRemoteUser() + "
"); + out.print("REMOTE_USER: " + request.getHeader("REMOTE_USER") + "
"); + out.print("HTTP_REMOTE_USER: " + request.getHeader("HTTP_REMOTE_USER") + "
"); +%> + + +
+ + +REQUEST PARAMETERS (GET/POST)
+ + <% + java.util.Enumeration eParameters = request.getParameterNames(); + while (eParameters.hasMoreElements()) { + String name = (String) eParameters.nextElement(); + Object object = request.getParameter(name); + String value = object.toString(); + out.println(""); + } + %> +
" + name + "" + value + "
+ + +
+ +ALL HEADERS
+ + <% + java.util.Enumeration eHeaders = request.getHeaderNames(); + while (eHeaders.hasMoreElements()) { + String name = (String) eHeaders.nextElement(); + Object object = request.getHeader(name); + String value = object.toString(); + out.println(""); + } + %> +
" + name + "" + value + "
+ + +
+ + +SESSION
+ + <%="SESSION_ID: " + session.getId() + "
"%> + + <% + java.util.Enumeration eSession = session.getAttributeNames(); + while (eSession.hasMoreElements()) { + String name = (String) eSession.nextElement(); + Object object = session.getAttribute(name); + String value = object.toString(); + out.println(""); + } + %> +
" + name + "" + value + "
+ + +
+ + + + diff --git a/cas-client-core/src/main/resources/web-simple-example.xml b/cas-client-core/src/main/resources/web-simple-example.xml index 6cbeb37..df1c562 100644 --- a/cas-client-core/src/main/resources/web-simple-example.xml +++ b/cas-client-core/src/main/resources/web-simple-example.xml @@ -11,12 +11,12 @@ contextConfigLocation - /WEB-INF/simpleFilterExample.xml + /WEB-INF/simpleFilter.xml - CAS Authentication Filter Proxy + CAS Authentication Filter org.springframework.web.filter.DelegatingFilterProxy targetBeanName @@ -25,7 +25,7 @@ - CAS Validation Filter Proxy + CAS Validation Filter org.springframework.web.filter.DelegatingFilterProxy targetBeanName @@ -34,7 +34,7 @@ - CAS Authorization Filter Proxy + CAS Authorization Filter org.springframework.web.filter.DelegatingFilterProxy targetBeanName @@ -43,17 +43,17 @@ - CAS Authentication Filter Proxy + CAS Authentication Filter /* - CAS Validation Filter Proxy + CAS Validation Filter /* - CAS Authorization Filter Proxy + CAS Authorization Filter /* @@ -71,7 +71,7 @@ --> casclient - org.jasig.cas.client.proxy.ProxyReceptorServlet + org.jasig.cas.client.proxy.SpringConfiguredProxyReceptorServlet 1 diff --git a/cas-client-core/src/main/resources/web-simple-proxy-example.xml b/cas-client-core/src/main/resources/web-simple-proxy-example.xml new file mode 100644 index 0000000..7c94796 --- /dev/null +++ b/cas-client-core/src/main/resources/web-simple-proxy-example.xml @@ -0,0 +1,98 @@ + + + + + Java CAS Client + + + + contextConfigLocation + + /WEB-INF/simpleFilter.xml + + + + + CAS Authentication Filter + org.springframework.web.filter.DelegatingFilterProxy + + targetBeanName + casAuthenticationFilter + + + + + CAS Validation Filter + org.springframework.web.filter.DelegatingFilterProxy + + targetBeanName + casValidationFilter + + + + + + CAS HttpServletRequestWrapperFilter + org.springframework.web.filter.DelegatingFilterProxy + + targetBeanName + casHttpServletRequestWrapperFilter + + + + + + CAS Authentication Filter + /* + + + + CAS Validation Filter + /* + + + + CAS HttpServletRequestWrapperFilter + /* + + + + + org.springframework.web.context.ContextLoaderListener + + + + + casclient + org.jasig.cas.client.proxy.SpringConfiguredProxyReceptorServlet + 1 + + + + casclient + casProxyReceptor + + \ No newline at end of file diff --git a/cas-client-uportal/src/test/resources/properties/uPortalConfigContext.xml b/cas-client-uportal/src/test/resources/properties/uPortalConfigContext.xml index 39d6bc1..dd59ed5 100644 --- a/cas-client-uportal/src/test/resources/properties/uPortalConfigContext.xml +++ b/cas-client-uportal/src/test/resources/properties/uPortalConfigContext.xml @@ -16,6 +16,7 @@ +