Ivan Lagunov's Blog

Search This Blog

Posts

This is a short "recipe" article explaining how to configure remote ElasticSearch instance to support CORS requests and basic authentication using Apache HTTP Server 2.4. Proxy
To start with, we need to configure Apache to proxy requests to the Elasticsearch instance. By default, Elasticsearch is running on the port 9200:
ProxyPass /elastic http://localhost:9200/
ProxyPassReverse /elastic http://localhost:9200/
Basic authentication
Enabling basic authentication is easy. By default, Apache checks the user credentials against the local file which you can create using the following command:
/path/to/htpasswd -c /usr/local/apache/password/.htpasswd_elasticsearch elasticsearchuser
Then you'll need to use the following directives to allow only authenticated users to access your content:
AuthType Basic
AuthName "Elastic Server"
AuthUserFile /usr/local/apache/password/.htpasswd_elasticsearch
Require valid-user
For more complex setups such as LDAP-based authenticatio…

This is a short "recipe" article explaining how to configure basic authentication for the following setup:
Apache Tomcat with some application that need be partially password-protectedApache HTTP Server 2.4 as a proxyCentOS 7 Linux server
Although basic authentication can be configured within Tomcat itself, my target is to use Apache for that purpose. In addition, as passing unencrypted credentials over the web is insecure, I'm going to install SSL certificates to enable HTTPS for the part of my application. This setup can be used when a part of an internal application need be secured to make it publicly accessible using a separate firewall/proxy (out of scope of this article), that part will be password-protected and SSL-encrypted.
StepsCopy certificates into /etc/ssl/certs/ivanlagunov.comCreate symlink:cd /etc/httpd
sudo ln -s /etc/ssl/certs/ivanlagunov.com
Install Apache mod_sslsudo yum -y install mod_sslCreate file with user credentials for basic authenticationsudo …

Here I'll show an example of using Oracle Data Pump Import (impdp) utility. It allows importing Oracle data dumps. Specifically, below is the list of steps I used on an existing Oracle schema to reload the data from a dump.
Steps to reload the data from an Oracle dumpWe start with logging into SQL Plus as sysdba to be able to manage users.
sqlplus sys/password@test as sysdba
Dropping the existing user. CASCADE clause will ensure that all schema objects are removed before the user.
SQL> DROP USER test CASCADE;
Creating a fresh user will automatically create an empty schema with the same name.
SQL> CREATE USER test IDENTIFIED BY "testpassword";
Granting DBA role to the user to load the dump later. Actually, it's an overkill and loading the dump can be permitted using a more granular role IMP_FULL_DATABASE.
SQL> GRANT DBA TO test;
Registering the directory where the dump is located.
SQL> CREATE DIRECTORY dump_dir AS '/home/test/dumpdir';
Runnin…

This article will guide you through the steps showing how to use the Authentication Framework in a Cocoon 2.2 application.
Maven dependencies.Spring configuration.Sitemap.Login page and controls.Maven dependencies
You need the following dependency in your pom.xml:
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-auth-impl</artifactId>
<version>1.0.0</version>
</dependency>
Spring configuration
Authentication Framework has a flexible configuration based on a concepts of applications and security handlers. There can be several applications defined and running at the same that are simply independent security zones of your web application. The security details of an application are specified using a security handler. There are several implementations provided and you're free to implement your own. Here is the SimpleSecurityHandler used that takes the hardcoded credentials:
<?xml version="1.0"?>
…

This article is devoted to an upgrade of a common JSF Spring application. Time flies and there is already Java EE 7 platform out and widely used. It's sometimes said that Spring framework has become legacy with appearance of Java EE 6. But it's out of scope of this post. Here I'm going to provide notes about the minimal changes that I found required for the upgrade of the application from JSF 1.2 to 2.1, from JSTL 1.1.2 to 1.2, from Servlet 2.4 to 3.0, from Spring 3.1.3 to 4.0.5, from RichFaces 3.3.3 to 4.3.7. It must be mentioned that the latest final RichFaces release 4.3.7 depends on JSF 2.1, JSTL 1.2 and Servlet 3.0.1 that dictated those versions. This post should not be considered as comprehensive but rather showing how I did the upgrade. See the links for more details.
Jetty & Tomcat.JSTL.JSF & Facelets.Servlet.Spring framework.RichFaces.Jetty & Tomcat
First, I upgraded the application to run with the latest servlet container versions. For development I u…