01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software
10: * distributed under the License is distributed on an "AS IS" BASIS,
11: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: * See the License for the specific language governing permissions and
13: * limitations under the License.
14: */
15: package org.acegisecurity.ui.openid.consumers;
16:
17: import org.acegisecurity.providers.openid.OpenIDAuthenticationToken;
18:
19: import org.acegisecurity.ui.openid.OpenIDConsumer;
20: import org.acegisecurity.ui.openid.OpenIDConsumerException;
21:
22: import javax.servlet.http.HttpServletRequest;
23:
24: /**
25: * DOCUMENT ME!
26: *
27: * @author Robin Bramley, Opsera Ltd
28: */
29: public class MockOpenIDConsumer implements OpenIDConsumer {
30: //~ Instance fields ================================================================================================
31:
32: private OpenIDAuthenticationToken token;
33: private String redirectUrl;
34:
35: //~ Methods ========================================================================================================
36:
37: /* (non-Javadoc)
38: * @see org.acegisecurity.ui.openid.OpenIDConsumer#beginConsumption(javax.servlet.http.HttpServletRequest, java.lang.String)
39: */
40: public String beginConsumption(HttpServletRequest req,
41: String identityUrl, String returnToUrl)
42: throws OpenIDConsumerException {
43: return redirectUrl;
44: }
45:
46: /* (non-Javadoc)
47: * @see org.acegisecurity.ui.openid.OpenIDConsumer#endConsumption(javax.servlet.http.HttpServletRequest)
48: */
49: public OpenIDAuthenticationToken endConsumption(
50: HttpServletRequest req) throws OpenIDConsumerException {
51: return token;
52: }
53:
54: /**
55: * Set the redirectUrl to be returned by beginConsumption
56: *
57: * @param redirectUrl
58: */
59: public void setRedirectUrl(String redirectUrl) {
60: this .redirectUrl = redirectUrl;
61: }
62:
63: /* (non-Javadoc)
64: * @see org.acegisecurity.ui.openid.OpenIDConsumer#setReturnToUrl(java.lang.String)
65: */
66: public void setReturnToUrl(String returnToUrl) {
67: // TODO Auto-generated method stub
68: }
69:
70: /**
71: * Set the token to be returned by endConsumption
72: *
73: * @param token
74: */
75: public void setToken(OpenIDAuthenticationToken token) {
76: this.token = token;
77: }
78: }
|