Entries tagged [improvements]

Friday June 05, 2009

Apache OpenEJB 3.1.1 Released

The Apache OpenEJB team is excited to announce the release of OpenEJB 3.1.1.

This release includes some great enhancements for the embedded testing scenarios and general EJB programming. Notable improvements include:

- Dependency injection for test cases and clients of the embedded ejb container via new @LocalClient annotation.
- Support for annotating the same interface as @Local, @Remote and @WebService making it possible to exposing all possible EJB views with a single interface.
- Web Service views securable with @RolesAllowed, @PermitAll and @DenyAll annotations.
- Ability to easily use alternate sets of deployment descriptors for some or all tests via new 'openejb.altdd.prefix' property.
- Global lookups from any context simplified via new "openejb:" jndi namespace.

The release also contains several new examples including Applets invoking EJBs in webapps, Struts with JPA and EJB, secured web services and web services with Perl SOAP::Lite clients and more.

Monday April 27, 2009

EJBContext.getCallerPrincipal() improvements

The getCallerPrincipal() method has been improved to always return the username used to login.

Now any LoginModule implementation can use the new @CallerPrincipal annotation to flag the Principal object they want to be the one returned from getCallerPrincipal() method. The security service will iterate over the Principal objects in the current Subject and return the first one that is annotated as @CallerPrincipal. If no Principal is found with the @CallerPrincipal annotation, the security service will return the first Principal in the Subject as before. All the OpenEJB supplied LoginModules have been updated to use this new annotation.

If you have implemented your own LoginModule, here's an example of a Principal implementation that uses the new annotation:

import org.apache.openejb.spi.CallerPrincipal;

public class UserPrincipal implements java.security.Principal {

    private final String name;

    public UserPrincipal(String name) {
        if (name == null) throw new IllegalArgumentException("name cannot be null");
        this.name = name;

    public String getName() {
        return name;

    // don't forget to implement equals() and hashCode()



Hot Blogs (today's hits)

Tag Cloud