/** * validates the passed WMS GetMap request against a User- and Rights-Management DB. * * @param wmsreq * @throws InvalidParameterValueException */ private void validateAgainstRightsDB(GetLegendGraphic wmsreq, User user) throws InvalidParameterValueException, UnauthorizedException { if (user == null) { throw new UnauthorizedException("no access to anonymous user"); } // create feature that describes the map request FeatureProperty[] fps = new FeatureProperty[7]; fps[0] = FeatureFactory.createFeatureProperty(new QualifiedName("version"), wmsreq.getVersion()); fps[1] = FeatureFactory.createFeatureProperty( new QualifiedName("width"), new Integer(wmsreq.getWidth())); fps[2] = FeatureFactory.createFeatureProperty( new QualifiedName("height"), new Integer(wmsreq.getHeight())); fps[3] = FeatureFactory.createFeatureProperty(new QualifiedName("format"), wmsreq.getFormat()); fps[4] = FeatureFactory.createFeatureProperty( new QualifiedName("exceptions"), wmsreq.getExceptions()); fps[5] = FeatureFactory.createFeatureProperty(new QualifiedName("sld"), wmsreq.getSLD()); fps[6] = FeatureFactory.createFeatureProperty(new QualifiedName("style"), wmsreq.getStyle()); Feature feature = FeatureFactory.createFeature("id", glgFT, fps); if (securityConfig.getProxiedUrl() == null) { handleUserCoupledRules(user, feature, wmsreq.getLayer(), "Layer", GETLEGENDGRAPHIC); } else { handleUserCoupledRules( user, feature, "[" + securityConfig.getProxiedUrl() + "]:" + wmsreq.getLayer(), "Layer", GETLEGENDGRAPHIC); } }
/** * creates a feature type that matches the parameters of a GetLagendGraphic request * * @return created <tt>FeatureType</tt> */ private static FeatureType createFeatureType() { PropertyType[] ftps = new PropertyType[7]; ftps[0] = FeatureFactory.createSimplePropertyType(new QualifiedName("version"), Types.VARCHAR, false); ftps[1] = FeatureFactory.createSimplePropertyType(new QualifiedName("width"), Types.INTEGER, false); ftps[2] = FeatureFactory.createSimplePropertyType(new QualifiedName("height"), Types.INTEGER, false); ftps[3] = FeatureFactory.createSimplePropertyType(new QualifiedName("format"), Types.VARCHAR, false); ftps[4] = FeatureFactory.createSimplePropertyType( new QualifiedName("exceptions"), Types.VARCHAR, false); ftps[5] = FeatureFactory.createSimplePropertyType(new QualifiedName("sld"), Types.VARCHAR, false); ftps[6] = FeatureFactory.createSimplePropertyType(new QualifiedName("style"), Types.VARCHAR, false); return FeatureFactory.createFeatureType("GetLegendGraphic", false, ftps); }