Author: prabath Date: Thu Jun 5 03:00:02 2008 New Revision: 17988 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=17988
Log: users can use this filter with no dependency on Information Cards Added: trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/OpenIDRelyingPartyData.java trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/OpenIDRelyingPartyFilter.java Added: trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/OpenIDRelyingPartyData.java URL: http://wso2.org/svn/browse/wso2/trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/OpenIDRelyingPartyData.java?pathrev=17988 ============================================================================== --- (empty file) +++ trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/OpenIDRelyingPartyData.java Thu Jun 5 03:00:02 2008 @@ -0,0 +1,35 @@ +/* + * Copyright 2005-2008 WSO2, Inc. (http://wso2.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.solutions.identity.relyingparty.servletfilter; + +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; + +/** + * + */ +public class OpenIDRelyingPartyData extends RelyingPartyData { + + /** + * [EMAIL PROTECTED] + */ + public void loadData(FilterConfig filterConfig) throws ServletException { + + loadOpenIDHostMapping(filterConfig); + } + +} \ No newline at end of file Added: trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/OpenIDRelyingPartyFilter.java URL: http://wso2.org/svn/browse/wso2/trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/OpenIDRelyingPartyFilter.java?pathrev=17988 ============================================================================== --- (empty file) +++ trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/servletfilter/OpenIDRelyingPartyFilter.java Thu Jun 5 03:00:02 2008 @@ -0,0 +1,83 @@ +/* + * Copyright 2005-2008 WSO2, Inc. (http://wso2.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.solutions.identity.relyingparty.servletfilter; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +import org.wso2.solutions.identity.relyingparty.TokenVerifierConstants; +import org.wso2.solutions.identity.relyingparty.openid.OpenIDConsumer; +import org.wso2.solutions.identity.relyingparty.openid.OpenIDUtil; + +public class OpenIDRelyingPartyFilter implements Filter { + + public OpenIDRelyingPartyData data = null; + + /** + * [EMAIL PROTECTED] + */ + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + + boolean isOpenIDSignin = false; + + try { + isOpenIDSignin = OpenIDUtil + .isOpenIDAuthetication((HttpServletRequest) request); + + if (isOpenIDSignin) { + + OpenIDConsumer.getInstance().setSessionAttributes( + (HttpServletRequest) request); + } + } catch (Exception e) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintWriter(baos)); + request.setAttribute(TokenVerifierConstants.ATTR_STATE, + TokenVerifierConstants.STATE_FAILURE); + request.setAttribute(TokenVerifierConstants.FAILURE_REASON, + new String(baos.toByteArray())); + } + + chain.doFilter(request, response); + } + + /** + * [EMAIL PROTECTED] + */ + public void init(FilterConfig config) throws ServletException { + data = new OpenIDRelyingPartyData(); + 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
