Rob Winch

Rob Winch

Rob Winch is employed by VMware as the project lead of security related projects within Spring. He is also a committer on the core Spring Framework and co-author for Spring Security LiveLessons and a Spring Security book. In the past he has worked in the health care industry, bioinformatics research, high performance computing, and as a web consultant. When he is not sitting in front of a computer he enjoys cycling with his friends.

Recent Blog posts by Rob Winch

Spring Security 3.2 M1 Highlights, Servlet 3 API Support

Engineering | December 17, 2012 | ...

Last week I announced the release of Spring Security 3.2 M1 that contains improved Servlet 3 support. In this post, I will introduce some of the more exciting features found in the 3.2 M1 release. Specifically, we will take a look at the following new Spring Security features:

Concurrency Support

You might ask "What is concurrency support doing in a release that has a Servlet 3 focused theme?" The reason is that the concurrency support provides a foundation for all the other features found in this release. While the concurrency support is used by the Servlet 3 integration, it can also serve as building blocks to support concurrency and Spring Security in any application. Let's take a look at Spring Security's concurrency support now.

DelegatingSecurityContextRunnable

One of the most fundamental building blocks within Spring Security's concurrency support is the DelegatingSecurityContextRunnable. It wraps a delegate Runnable in order to initialize the SecurityContextHolder with a specified SecurityContext for the delegate. It then invokes the delegate Runnable ensuring to clear the SecurityContextHolder afterwards. The DelegatingSecurityContextRunnable looks something like this:

public void run() {
  try {
    SecurityContextHolder.setContext(securityContext);
    delegate.run();
  } finally {
    SecurityContextHolder.clearContext();
  }
}

While very simple, it makes it seamless to transfer the SecurityContext from one Thread to another. This is important since, in most cases, the SecurityContextHolder acts on a per Thread basis. For example, you might have used Spring Security's <global-method-security> support to secure one of your services. You can now easily transfer the SecurityContext of the current Thread to the Thread that invokes the secured service. An example of how you might do this can be found below:


Runnable originalRunnable = new Runnable() {
  public void run() {
    // invoke secured service
  }
};

SecurityContext context = SecurityContextHolder.getContext();
DelegatingSecurityContextRunnable wrappedRunnable =
    new DelegatingSecurityContextRunnable(originalRunnable, context);

new Thread(wrappedRunnable).start();

The code above performs the following steps:

  • Creates a Runnable that will be invoking our secured service. Notice that it is not aware of Spring Security
  • Obtains the SecurityContext that we wish to use from the SecurityContextHolder and initializes the DelegatingSecurityContextRunnable
  • Use the DelegatingSecurityContextRunnable to create a Thread
  • Start the Thread we created

Since it is quite common to create a DelegatingSecurityContextRunnable with the SecurityContext from the SecurityContextHolder there is a shortcut constructor for it. The following code is the same as the code above:


Runnable originalRunnable = new Runnable() {
  public void run() {
    // invoke secured…

Spring Security 3.2.0.M1 Released

Releases | December 13, 2012 | ...

The first milestone release toward Spring Security 3.2 is now available from the SpringSource repository at http://repo.springsource.org. See here for a quick tutorial on resolving these artifacts via Maven.

The highlights of this release include:

  • Concurency Support
  • Servlet 3, Async Support
  • Spring MVC Async Integration
  • Servlet 3 API Integration
  • New Servlet API Sample Application
Stay tuned to the SpringSource Blog over the coming week for information on what's new in 3.2.0.M1.

Changelog | Download | Reference Manual | FAQ

Spring Security 2.0.8, 3.0.8, & 3.1.3 Released

Releases | October 09, 2012 | ...

We're please to announce the relase of Spring Security 2.0.8, 3.0.8, and 3.1.3 which fixes CVE-2012-5055 and brings Spring Security's open bugs to 0. The releases are available from the Spring Community Downloads area and jars are available from Maven central repository. See the project website for more information.

A special thanks to Nicholas Goodwin (@NGoody) for disclosing the issue and keeping it private until a fix could be pushed out.

3.1.3: Changelog | Download | 3.1.3 Reference Manual | FAQ

3.0.8: Changelog | Download | Reference Manual

2.0.8: Changelog | Download | Reference Manual

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all