001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/security/owsrequestvalidator/OWSValidator.java $ 002 /*---------------- FILE HEADER ------------------------------------------ 003 004 This file is part of deegree. 005 Copyright (C) 2001-2008 by: 006 EXSE, Department of Geography, University of Bonn 007 http://www.giub.uni-bonn.de/deegree/ 008 lat/lon GmbH 009 http://www.lat-lon.de 010 011 This library is free software; you can redistribute it and/or 012 modify it under the terms of the GNU Lesser General Public 013 License as published by the Free Software Foundation; either 014 version 2.1 of the License, or (at your option) any later version. 015 016 This library is distributed in the hope that it will be useful, 017 but WITHOUT ANY WARRANTY; without even the implied warranty of 018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 019 Lesser General Public License for more details. 020 021 You should have received a copy of the GNU Lesser General Public 022 License along with this library; if not, write to the Free Software 023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 024 025 Contact: 026 027 Andreas Poth 028 lat/lon GmbH 029 Aennchenstr. 19 030 53115 Bonn 031 Germany 032 E-Mail: poth@lat-lon.de 033 034 Prof. Dr. Klaus Greve 035 Department of Geography 036 University of Bonn 037 Meckenheimer Allee 166 038 53115 Bonn 039 Germany 040 E-Mail: greve@giub.uni-bonn.de 041 042 ---------------------------------------------------------------------------*/ 043 package org.deegree.security.owsrequestvalidator; 044 045 import org.deegree.ogcwebservices.InvalidParameterValueException; 046 import org.deegree.ogcwebservices.OGCWebServiceRequest; 047 import org.deegree.security.UnauthorizedException; 048 import org.deegree.security.drm.model.User; 049 import org.deegree.security.owsproxy.Condition; 050 051 /** 052 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a> 053 * @author last edited by: $Author: apoth $ 054 * 055 * @version $Revision: 9346 $, $Date: 2007-12-27 17:39:07 +0100 (Do, 27 Dez 2007) $ 056 */ 057 058 public abstract class OWSValidator { 059 060 protected Policy policy = null; 061 062 protected GetCapabilitiesRequestValidator getCapabilitiesValidator = null; 063 064 protected GetCapabilitiesResponseValidator getCapabilitiesValidatorR = null; 065 066 /** 067 * @param policy 068 * @param proxyURL 069 */ 070 public OWSValidator( Policy policy, String proxyURL ) { 071 this.policy = policy; 072 getCapabilitiesValidator = new GetCapabilitiesRequestValidator( policy ); 073 getCapabilitiesValidatorR = new GetCapabilitiesResponseValidator( policy, proxyURL ); 074 } 075 076 /** 077 * validates if the passed request itself and its content is valid against the conditions 078 * defined in the policies assigned to a <tt>OWSPolicyValidator</tt> 079 * 080 * @param request 081 * @param user 082 * @throws InvalidParameterValueException 083 * @throws UnauthorizedException 084 */ 085 public abstract void validateRequest( OGCWebServiceRequest request, User user ) 086 throws InvalidParameterValueException, UnauthorizedException; 087 088 /** 089 * @param request 090 * @param response 091 * @param mime 092 * @param user 093 * @return 094 * @throws InvalidParameterValueException 095 * @throws UnauthorizedException 096 * 097 */ 098 public abstract byte[] validateResponse( OGCWebServiceRequest request, byte[] response, 099 String mime, User user ) 100 throws InvalidParameterValueException, UnauthorizedException; 101 102 /** 103 * returns the general condition assigned to the encapsulated policy 104 * 105 * @return the general condition assigned to the encapsulated policy 106 */ 107 public Condition getGeneralCondtion() { 108 return policy.getGeneralCondition(); 109 } 110 111 /** 112 * returns the policy underlying a OWSValidator 113 * 114 * @return the policy underlying a OWSValidator 115 */ 116 public Policy getPolicy() { 117 return policy; 118 } 119 120 }