Author: prabath Date: Thu Jun 5 03:03:15 2008 New Revision: 17989 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=17989
Log: loads host/port mapping from the web.xml - these settings are required when the RP hosted Tomcat is behind an Apache front-end Modified: trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyData.java trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyFilter.java Modified: trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyData.java URL: http://wso2.org/svn/browse/wso2/trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyData.java?rev=17989&r1=17988&r2=17989&view=diff ============================================================================== --- trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyData.java (original) +++ trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyData.java Thu Jun 5 03:03:15 2008 @@ -24,6 +24,14 @@ private KeyStore trustStore = null; + protected String mappedHostName = null; + + protected String mappedPortNumber = null; + + protected String mappingHostName = null; + + protected String mappingPortNumber = null; + /** * One array contains one DN name */ @@ -37,12 +45,9 @@ /** * This method read parameters from web.xml Step 1 : Read my private key * Step 2 : Read the token validation policy Step 3 : Read paramters that is - * needed perform token validation - * - * if(promiscuous) ->read nothing else if(blackList) ->read the blacklist - * and keystore details else if (whiteList)->read the whitelist and keystor - * details - * + * needed perform token validation if(promiscuous) ->read nothing else + * if(blackList) ->read the blacklist and keystore details else if + * (whiteList)->read the whitelist and keystor details */ public void loadData(FilterConfig filterConfig) throws ServletException { String keyStore = filterConfig @@ -56,6 +61,8 @@ String keyPass = filterConfig .getInitParameter(TokenVerifierConstants.KEY_PASS); + loadOpenIDHostMapping(filterConfig); + issuerPolicy = filterConfig .getInitParameter(TokenVerifierConstants.ISSUER_POLICY); @@ -160,6 +167,27 @@ } } + /** + * When the RP hosted Tomcat is behind an Apache serever, OpenID + * verification fails since return_to url mismatches with the returning url. + * To avoid that - only when the Tomcat is behind an Apache frontend we need + * to provide a host/port mapping in the web.xml. + * @param filterConfig Filter configurations + */ + protected void loadOpenIDHostMapping(FilterConfig filterConfig) { + mappedHostName = filterConfig + .getInitParameter(TokenVerifierConstants.MAPPED_HOST); + + mappedPortNumber = filterConfig + .getInitParameter(TokenVerifierConstants.MAPPED_PORT); + + mappingHostName = filterConfig + .getInitParameter(TokenVerifierConstants.MAPPING_HOST); + + mappingPortNumber = filterConfig + .getInitParameter(TokenVerifierConstants.MAPPING_PORT); + } + public PrivateKey getPrivateKey() { return privateKey; } @@ -245,4 +273,20 @@ return dnList; } -} + public String getMappedHostName() { + return mappedHostName; + } + + public String getMappedPortNumber() { + return mappedPortNumber; + } + + public String getMappingHostName() { + return mappingHostName; + } + + public String getMappingPortNumber() { + return mappingPortNumber; + } + +} \ No newline at end of file Modified: trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyFilter.java URL: http://wso2.org/svn/browse/wso2/trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyFilter.java?rev=17989&r1=17988&r2=17989&view=diff ============================================================================== --- trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyFilter.java (original) +++ trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/RelyingPartyFilter.java Thu Jun 5 03:03:15 2008 @@ -40,6 +40,9 @@ WSSConfig.getDefaultWSConfig(); } + /** + * [EMAIL PROTECTED] + */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { @@ -106,12 +109,19 @@ chain.doFilter(request, response); } + /** + * [EMAIL PROTECTED] + */ public void init(FilterConfig config) throws ServletException { data = new RelyingPartyData(); data.loadData(config); + OpenIDUtil.setRpData(data); } + /** + * [EMAIL PROTECTED] + */ public void destroy() { } -} +} \ No newline at end of file _______________________________________________ Identity-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/identity-dev
