%@page import="de.mpg.escidoc.services.framework.PropertyReader"%> <%@page import="org.apache.commons.codec.binary.Base64"%> <%@page import="java.sql.SQLException"%> <%@page import="java.sql.ResultSetMetaData"%> <%@page import="java.sql.ResultSet"%> <%@page import="javax.sql.DataSource"%> <%@page import="javax.naming.InitialContext"%> <%@page import="javax.naming.Context"%> <%@page import="java.sql.Statement"%> <% /* * * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at license/ESCIDOC.LICENSE * or http://www.escidoc.org/license. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at license/ESCIDOC.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2006-2012 Fachinformationszentrum Karlsruhe Gesellschaft * für wissenschaftlich-technische Information mbH and Max-Planck- * Gesellschaft zur Förderung der Wissenschaft e.V. * All rights reserved. Use is subject to license terms. */ %> <%! private boolean testLogin(HttpServletRequest request, HttpServletResponse response) throws Exception { String auth = request.getHeader("authorization"); if (auth == null) { response.addHeader("WWW-Authenticate", "Basic realm=\"Validation Service\""); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return false; } else { auth = auth.substring(6); String cred = new String(Base64.decodeBase64(auth.getBytes())); if (cred.contains(":")) { String[] userPass = cred.split(":"); String userName = PropertyReader.getProperty("framework.admin.username"); String password = PropertyReader.getProperty("framework.admin.password"); if (!userPass[0].equals(userName) || !userPass[1].equals(password)) { response.sendError(HttpServletResponse.SC_FORBIDDEN); return false; } else { return true; } } else { response.sendError(HttpServletResponse.SC_FORBIDDEN); return false; } } } %> <% if (testLogin(request, response)) { %>
This is a makeshift to administer the validation cache database until a proper frontend is available.
<% if (request.getParameter("sql") != null) { %> Result:<%= resultSetMetaData.getColumnName(i) %> | <% } %><% while (rs.next()) { %>
---|
<%= (rs.getObject(i) == null ? "---" : rs.getObject(i).toString().replace("&", "&").replace("<", "<").replace("\n", " ")) %> | <%
}
%>