Changeset 32988 for main/trunk/greenstone3
- Timestamp:
- 2019-04-05T14:52:41+13:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/URLFilter.java
r32657 r32988 19 19 import javax.servlet.http.HttpServletRequest; 20 20 import javax.servlet.http.HttpServletRequestWrapper; 21 import javax.servlet.http.HttpServletResponse; 21 22 22 23 import org.apache.commons.io.FileUtils; … … 28 29 import org.greenstone.gsdl3.util.UserContext; 29 30 import org.greenstone.gsdl3.util.XMLConverter; 31 import org.greenstone.gsdl3.service.Authentication; 30 32 import org.w3c.dom.Document; 31 33 import org.w3c.dom.Element; … … 52 54 protected static final String DOCUMENT_PATH = "document"; 53 55 protected static final String COLLECTION_PATH = "collection"; 54 protected static final String GROUP_PATH = "group";56 protected static final String GROUP_PATH = "group"; 55 57 protected static final String PAGE_PATH = "page"; 56 58 protected static final String SYSTEM_PATH = "system"; 57 protected static final String BROWSE_PATH = "browse";58 protected static final String SEARCH_PATH = "search";59 protected static final String BROWSE_PATH = "browse"; 60 protected static final String SEARCH_PATH = "search"; 59 61 60 62 protected static final String METADATA_RETRIEVAL_SERVICE = "DocumentMetadataRetrieve"; … … 187 189 Element securityResponse = (Element) GSXML.getChildByTagName(gsRouter.process(securityMessage), GSXML.RESPONSE_ELEM); 188 190 ArrayList<String> groups = GSXML.getGroupsFromSecurityResponse(securityResponse); 191 _logger.debug("security response = "+XMLConverter.getPrettyString(securityResponse)); 189 192 190 193 if (!groups.contains("")) … … 202 205 if (!found) 203 206 { 207 // this just returns nothing to the browser - get no error or anything, just an empty document 208 // can we return an error page?? 209 String new_url = context.getContextPath()+"/"+ context.getAttribute("LibraryName")+"?a=p&sa=error&c="+collection+"&ec=wrong_group"; 210 ((HttpServletResponse)response).sendRedirect(new_url); 204 211 return; 205 212 } 213 } 214 // if got here have no groups. 215 // do we have human verify thing? 216 boolean human_verify = false; 217 218 if (!securityResponse.getAttribute("humanVerify").equals("")) { 219 // have we already done the test? 220 String hmvf_response = gRequest.getParameter("hmvf"); 221 // hmvf param will be set by form 222 if (hmvf_response != null) { 223 if (!securityResponse.getAttribute("siteKey").equals("")) { 224 String recaptcha_response = gRequest.getParameter("g-recaptcha-response"); 225 String secret_key = securityResponse.getAttribute("secretKey"); 226 int result = Authentication.verifyRecaptcha(secret_key, recaptcha_response); 227 _logger.debug("recaptcha result code = "+result); 228 if (result == Authentication.NO_ERROR) { 229 _logger.debug("RECAPTCHA SUCCESS, hopefully going to the document"); 230 231 } else { 232 _logger.error("something went wrong with recaptcha, error="+result); 233 _logger.error(Authentication.getErrorKey(result)); 234 // display error page 235 String new_url = context.getContextPath()+"/"+ context.getAttribute("LibraryName")+"?a=p&sa=error&c="+collection+"&ec=recap_fail"; 236 ((HttpServletResponse)response).sendRedirect(new_url); 237 238 return; 239 } 240 } 241 242 } else { 243 // hmvf param is not set - we haven't shown them the form yet 244 // we need to display the verify page 245 String new_url = context.getContextPath()+"/"+ context.getAttribute("LibraryName")+"?a=p&sa=verify&c="+collection+"&url="+url; 246 ((HttpServletResponse)response).sendRedirect(new_url); 247 return; 248 } 206 249 } 207 250 } … … 294 337 { 295 338 gRequest.setParameter(GSParams.DOCUMENT, segments[i + 1]); 296 339 297 340 additionalParameters = new String[] { GSParams.ACTION }; 298 341 defaultParamValues = new String[] { "d" }; 342 if ((i+2) < segments.length && segments[i+2].equals("print")) { 343 gRequest.setParameter(GSParams.SUBACTION, "print"); 344 gRequest.setParameter("ed", "1"); 345 346 } 347 299 348 } 300 349 //PAGE
Note:
See TracChangeset
for help on using the changeset viewer.