Author: sohil.shah(a)jboss.com
Date: 2011-03-03 13:46:53 -0500 (Thu, 03 Mar 2011)
New Revision: 5963
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/GenericSSOAgent.java
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/cas/CASAgent.java
Log:
externalizing the CAS service url value
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/GenericSSOAgent.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/GenericSSOAgent.java 2011-03-03
17:48:13 UTC (rev 5962)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/GenericSSOAgent.java 2011-03-03
18:46:53 UTC (rev 5963)
@@ -47,6 +47,7 @@
private String ssoServerUrl;
private String ssoCookieName;
private boolean casRenewTicket;
+ private String casServiceUrl;
@Override
@@ -62,6 +63,12 @@
{
this.casRenewTicket = Boolean.parseBoolean(casRenewTicketConfig);
}
+
+ String casServiceUrlConfig =
this.getServletConfig().getInitParameter("casServiceUrl");
+ if(casServiceUrlConfig != null && casServiceUrlConfig.trim().length()>0)
+ {
+ casServiceUrl = casServiceUrlConfig;
+ }
}
@Override
@@ -103,7 +110,7 @@
if (ticket != null && ticket.trim().length() > 0)
{
- CASAgent casagent = CASAgent.getInstance(this.ssoServerUrl);
+ CASAgent casagent = CASAgent.getInstance(this.ssoServerUrl,this.casServiceUrl);
casagent.setRenewTicket(this.casRenewTicket);
casagent.validateTicket(httpRequest, ticket);
}
Modified: components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/cas/CASAgent.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/cas/CASAgent.java 2011-03-03
17:48:13 UTC (rev 5962)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/cas/CASAgent.java 2011-03-03
18:46:53 UTC (rev 5963)
@@ -42,13 +42,15 @@
private String casServerUrl;
private boolean renewTicket;
+ private String casServiceUrl;
- private CASAgent(String casServerUrl)
+ private CASAgent(String casServerUrl, String casServiceUrl)
{
this.casServerUrl = casServerUrl;
+ this.casServiceUrl = casServiceUrl;
}
- public static CASAgent getInstance(String casServerUrl)
+ public static CASAgent getInstance(String casServerUrl,String casServiceUrl)
{
if(CASAgent.singleton == null)
{
@@ -56,7 +58,7 @@
{
if(CASAgent.singleton == null)
{
- CASAgent.singleton = new CASAgent(casServerUrl);
+ CASAgent.singleton = new CASAgent(casServerUrl,casServiceUrl);
}
}
}
@@ -79,12 +81,12 @@
Cas20ProxyTicketValidator ticketValidator = new
Cas20ProxyTicketValidator(casServerUrl);
ticketValidator.setRenew(this.renewTicket);
- String serviceUrl = "http://"+ httpRequest.getServerName() +":" +
httpRequest.getServerPort() +
- httpRequest.getContextPath() +"/private/classic";
- Assertion assertion = ticketValidator.validate(ticket, serviceUrl);
+ //String serviceUrl = "http://"+ httpRequest.getServerName() +":"
+ httpRequest.getServerPort() +
+ //httpRequest.getContextPath() +"/private/classic";
+ Assertion assertion = ticketValidator.validate(ticket, this.casServiceUrl);
log.debug("------------------------------------------------------------------------------------");
- log.debug("Service: "+serviceUrl);
+ log.debug("Service: "+this.casServiceUrl);
log.debug("Principal: "+assertion.getPrincipal().getName());
log.debug("------------------------------------------------------------------------------------");
Show replies by date