Author: sohil.shah(a)jboss.com
Date: 2011-03-09 12:51:29 -0500 (Wed, 09 Mar 2011)
New Revision: 5990
Modified:
components/sso/branches/sso-wci/agent/src/main/java/org/gatein/sso/agent/cas/CASAgent.java
components/sso/branches/sso-wci/agent/src/main/java/org/gatein/sso/agent/filter/InitiateLoginFilter.java
Log:
ported hardcoded serviceUrl bug fix
Modified:
components/sso/branches/sso-wci/agent/src/main/java/org/gatein/sso/agent/cas/CASAgent.java
===================================================================
---
components/sso/branches/sso-wci/agent/src/main/java/org/gatein/sso/agent/cas/CASAgent.java 2011-03-09
16:56:57 UTC (rev 5989)
+++
components/sso/branches/sso-wci/agent/src/main/java/org/gatein/sso/agent/cas/CASAgent.java 2011-03-09
17:51:29 UTC (rev 5990)
@@ -39,13 +39,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)
{
@@ -53,7 +55,7 @@
{
if(CASAgent.singleton == null)
{
- CASAgent.singleton = new CASAgent(casServerUrl);
+ CASAgent.singleton = new CASAgent(casServerUrl,casServiceUrl);
}
}
}
@@ -76,12 +78,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("------------------------------------------------------------------------------------");
Modified:
components/sso/branches/sso-wci/agent/src/main/java/org/gatein/sso/agent/filter/InitiateLoginFilter.java
===================================================================
---
components/sso/branches/sso-wci/agent/src/main/java/org/gatein/sso/agent/filter/InitiateLoginFilter.java 2011-03-09
16:56:57 UTC (rev 5989)
+++
components/sso/branches/sso-wci/agent/src/main/java/org/gatein/sso/agent/filter/InitiateLoginFilter.java 2011-03-09
17:51:29 UTC (rev 5990)
@@ -27,6 +27,7 @@
private String ssoServerUrl;
private String ssoCookieName;
private boolean casRenewTicket;
+ private String casServiceUrl;
public void init(FilterConfig filterConfig) throws ServletException
{
@@ -38,6 +39,12 @@
{
this.casRenewTicket = Boolean.parseBoolean(casRenewTicketConfig);
}
+
+ String casServiceUrlConfig =
filterConfig.getInitParameter("casServiceUrl");
+ if(casServiceUrlConfig != null &&
casServiceUrlConfig.trim().length()>0)
+ {
+ casServiceUrl = casServiceUrlConfig;
+ }
}
public void doFilter(ServletRequest request, ServletResponse response,
@@ -77,7 +84,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);
}
Show replies by date