I'm now sure that vim is the perfect tool to write *clean* code !
And for vim fanatics, you can even get vim inside NetBeans (integration work much better than in Eclipse):
http://jvi.sourceforge.net/
Tuesday, June 22, 2010
Friday, April 30, 2010
Spring Batch integration module for GridGain
For the purpose of using Spring Batch in a scalable and distributed manner to process huge amount of data, I am actually developing some components to make integration of Spring Batch with compute/data grid easier.
Different solutions is offered by Spring Batch to provide scalability, the one that best suit my needs is remote chunking.
As I already done some investigation before using GridGain I chose this framework to implement a distributed remote chunking system that can be easily integrated into any existing Spring Batch systems.
Using GridGain is really straightforward, and setting up a grid on a development machine doesn't need so much configuration.
The only issue I faced is due to the fact that GridGain use serialization to deploy tasks on nodes, in order to be able to deploy a remote ChunkProcessor, it must contains serializable ItemProcessor and ItemWriter, which unfortunately is not the case by default.
So instead of creating new interfaces, I made a SerializableChunkProcessor which only accept serializable ItemProcessor and ItemWriter. It's surely not the smarter solution, but since I can't modify default interfaces in Spring Batch and I don't want to create my own interfaces, this workaround will suffice.
Usage
Here is the job application context used for the integration test, as you can see the 'real' ItemProcessor / ItemWriter are injected into the GridGain chunk writer:
Download
You can download the spring-batch-integration-gridgain module here:
http://github.com/downloads/aloiscochard/spring-batch-integration-gridgain/spring-batch-integration-gridgain-0.0.1-SNAPSHOT.jar
If you want to see a full working sample, take a look at the integration test. The full project sources can be downloaded here:
http://github.com/aloiscochard/spring-batch-integration-gridgain
Different solutions is offered by Spring Batch to provide scalability, the one that best suit my needs is remote chunking.
As I already done some investigation before using GridGain I chose this framework to implement a distributed remote chunking system that can be easily integrated into any existing Spring Batch systems.
Using GridGain is really straightforward, and setting up a grid on a development machine doesn't need so much configuration.
The only issue I faced is due to the fact that GridGain use serialization to deploy tasks on nodes, in order to be able to deploy a remote ChunkProcessor, it must contains serializable ItemProcessor and ItemWriter, which unfortunately is not the case by default.
So instead of creating new interfaces, I made a SerializableChunkProcessor which only accept serializable ItemProcessor and ItemWriter. It's surely not the smarter solution, but since I can't modify default interfaces in Spring Batch and I don't want to create my own interfaces, this workaround will suffice.
Usage
Here is the job application context used for the integration test, as you can see the 'real' ItemProcessor / ItemWriter are injected into the GridGain chunk writer:
Download
You can download the spring-batch-integration-gridgain module here:
http://github.com/downloads/aloiscochard/spring-batch-integration-gridgain/spring-batch-integration-gridgain-0.0.1-SNAPSHOT.jar
If you want to see a full working sample, take a look at the integration test. The full project sources can be downloaded here:
http://github.com/aloiscochard/spring-batch-integration-gridgain
Thursday, March 25, 2010
Integrating failover strategy for Spring Security NTLM
During implementation of the NTLM authentication into our application, I wanted to achieve failover to standard login page (html form) if NTLM authentication fail.
In order to obtain the wanted behavior I extended some Spring Security classes and hack them a little bit, so I created:
This implementation was made using Spring Security 2.0.5, but can be easly converted to Spring Security 3.0 using the Spring Security NTLM 3 module I recently created. Don't hesitate to ask me if you want that I publish an updated version.
Download
You can download a sample application including hacked class here:
http://github.com/downloads/aloiscochard/spring-security-ntlm-samples/spring-security-ntlm-samples-2.0.5.SNAPSHOT.zip
In order to obtain the wanted behavior I extended some Spring Security classes and hack them a little bit, so I created:
- An AuthenticationEntryPoint strategy to switch between NTLM or standard login
- A custom AuthenticationProvider to prevent password checking when user authenticate with NTLM
- A custom NtlmProcessingFilter to disable NTLM authentication if a remember-me cookie is present
The thing I was unable to do is detecting if the user client is NTLM compliant before starting the NTLM challenge. Due to the way the protocol is build (and certainly for security reasons) it's impossible to know if the client is NTLM compliant before launching the challenge.
So let's took the scenario of a Google Chrome user:
- A popup (HTTP realm) authentication window is shown to the user
- He hit enter with invalid credentials (i.e. empty username/password)
- The browser is redirected to the standard html login form
By using 'remember me' the NTLM authentication won't be shown next time the user access the site due to the presence of the cookie.
If the user client is Internet Explorer no authentication window is shown because the navigator use directly the information of the logged user. If the authentication fail, then the standard html login form is displayed letting him login with other credentials.
Download
You can download a sample application including hacked class here:
http://github.com/downloads/aloiscochard/spring-security-ntlm-samples/spring-security-ntlm-samples-2.0.5.SNAPSHOT.zip
Labels:
java,
ntlm,
security,
spring,
spring-security
Sunday, March 21, 2010
Spring Security NTLM 3
As of version 3.X Spring Security doesn't include the NTLM extension anymore.
For the purpose of using NTLM authentication on Spring 3 projects, I migrated the 2.0.5 NTLM extension to the new version of Spring Security.
The full project sources are available here:
http://github.com/aloiscochard/spring-security-ntlm
I haven't took time fixing the following bugs found on version 2.0.5:
https://jira.springsource.org/browse/SEC-1003
https://jira.springsource.org/browse/SEC-1087
If your are interested to help correcting this defects don't hesitate to get in touch.
Download
You can download the spring-security-ntlm snapshot here:
http://github.com/downloads/aloiscochard/spring-security-ntlm/spring-security-ntlm-3.0.2.SNAPSHOT.jar
Usage
Due to the fact that NTLM isn't integrated in new version of spring-security-core, you need to add a custom filter.
Here is a snippet describing briefly how to do that:
Don't hesitate to ask if you need help, this extension work exactly as version 2.0.5. You can use an example from version 2.0.5 if you are starting from scratch.
For the purpose of using NTLM authentication on Spring 3 projects, I migrated the 2.0.5 NTLM extension to the new version of Spring Security.
The full project sources are available here:
http://github.com/aloiscochard/spring-security-ntlm
I haven't took time fixing the following bugs found on version 2.0.5:
https://jira.springsource.org/browse/SEC-1003
https://jira.springsource.org/browse/SEC-1087
If your are interested to help correcting this defects don't hesitate to get in touch.
Download
You can download the spring-security-ntlm snapshot here:
http://github.com/downloads/aloiscochard/spring-security-ntlm/spring-security-ntlm-3.0.2.SNAPSHOT.jar
Usage
Due to the fact that NTLM isn't integrated in new version of spring-security-core, you need to add a custom filter.
Here is a snippet describing briefly how to do that:
Don't hesitate to ask if you need help, this extension work exactly as version 2.0.5. You can use an example from version 2.0.5 if you are starting from scratch.
Subscribe to:
Posts (Atom)