01: /*
02: * (C) Copyright 2000 - 2005 Nabh Information Systems, Inc.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: */
19: package com.nabhinc.ws.interceptor.security;
20:
21: import java.io.IOException;
22:
23: import com.nabhinc.ws.core.WebServiceException;
24: import com.nabhinc.ws.core.WebServiceSecurityException;
25: import com.nabhinc.ws.server.Interceptor;
26: import com.nabhinc.ws.server.InterceptorChain;
27: import com.nabhinc.ws.server.RequestInfo;
28: import com.nabhinc.ws.server.ServerObjectImpl;
29:
30: /**
31: * Throws <code>WebServiceSecurityException</code> if the connection is not secure.
32: * You can use this interceptor to enfore secure access for certain methods of a
33: * Web service. If you want all operations on a web service to be accessed via
34: * secure channel, it is better to configure the service secure in webservice.xml
35: * file since that will return the secure URL in the WSDL document.
36: *
37: * @author Padmanabh Dabke
38: * (c) 2005 Nabh Information Systems, Inc. All Rights Reserved.
39: */
40: public class SecureConnectionChecker extends ServerObjectImpl implements
41: Interceptor {
42:
43: public void intercept(RequestInfo reqInfo, InterceptorChain chain)
44: throws WebServiceException, IOException {
45:
46: if (reqInfo.webServiceRequest.isSecure()) {
47: chain.doIntercept(reqInfo);
48: } else {
49: throw new WebServiceSecurityException(
50: "This operation requires secure connection.");
51:
52: }
53:
54: }
55:
56: }
|