hibernate spring secuirty implementation…

July 13, 2009 on 10:45 pm | In Security | 7 Comments

Almost two years ago, I said I would upgrade my my Hibernate-Acegi (Spring Secuirty) implementation to Spring Security’s new(er) ACL service paradigm. Here’s their suggested schema. Below is a class diagram of that paradigm.

Spring Secuirty ACL Paradigm

Back then, none of projects required groups or users to inheriting permissions. I simply gave permissions to the roles and individuals that needed them. So, I used an AffirmativeBased AccessDecisionManager, and placed a RoleVoter before any other AbstractAclVoter. Simple, and it worked. One of my newer projects, however, does require the inheriting permissions.

What else…

Since I always use GUIDs, I still don’t need Spring Security to know the the domain class. But I’d like to utilize the new auditing feature. I’d also like to turn on and off auditing at the permission entry level. All in all, the upgrade wasn’t too bad at all. I had move some code from the SimpleAclEntry (deprecated) to the BasePermission. I actually extended the BasePermission, as the javadocs suggest.

Spring-Security’s distributed example code uses JDBC. Which is fairly straight-forward. It keeps a good amount of the information on the acl entry table. Thus no real need for a parent acl table. Well, since I’m using Hibernate, a few things automatically change:

  • Built-in 2nd level caching (ehache for me)
  • Ability to define granular joins and fetches based on the context

Based on those two (three?) items, I was able to normalize a good amount of information back to a new parent table permission (acl?). Now permission entries can focus on one purpose, facilitating a relationship between their parent permission and the target SID (Secure ID). See my pared-down ERD for this:


Hibernate Permission ERD

I’m not big on defining AOP behavior via the newer namespaced expressions. So, in that context, I stayed with what I had before. Some other things have been deprecated, such as BasicAclEntryAfterInvocationProvider, in favor of AclEntryAfterInvocationProvider. Overall, it was pretty painless.

One more thing…

When it comes to ACLs, the was one thing that drives me crazy is having to define the default relationships in SQL scripts. I freaking hate it. Well, I was able to resolve that this time around: Added a task and some delegation to my existing ServletContextListener. At application start, it goes about finding existing objects that need securing, that aren’t already secured. Yeah, that’s great…

early adopter…

March 28, 2009 on 4:18 pm | In Technical stuff | No Comments

Since I’ve been introduced to WebWork, I was a serious proponent. It was built on some interesting technologies. Implemented some great concepts. Things that are now considered standard for any self-respecting web-mvc framework. After some evolution, WebWorkis now Struts2. Since I considered myself a proponent, I’ve followed most releases. Especially the security-related items.

Recently I decided to leave the 2.0.x series, and upgrade to the 2.1.x path. After a little work, you can piece together the major changes you need to adhere. For me, the biggest change was the built-in Dojo support. As of 2.1, it’s an optional, external module, which is fine. I went about making the changes. Things like changing my theme from Ajax to XHtml. Importing the Dojo taglibs into the necessary pages. Nothing too complicated. More time-consuming than anything.

OK, so I ran into a problem. I worked at it for a good weekend. After banging my head against this one, with no resolution, I sought help on the user-list. No response. None of this really bothered me. What really bothered me was my naiveté.

The affected projects are all on svn. For some reason, I did the upgrade on HEAD. So, after no resolution, I had to revert. Since the upgrade included some other libs (Hibernate-3.3, some Commons modules, etc), I actually had to revert and then reapply some other upgrades.

Regardless of your personal feelings for a framework/library, don’t ever assume it’s going to be that easy! If you have a source control tool, use it. A branch for these upgrades would have made things a bit easier. I used to think branches were for teams larger than 2-3. Yeah, not so much. It’s not a problem to adopt a release/technology early, it’s all in how you do it. Ugh, lesson learned.

ehcache-1.6

March 15, 2009 on 1:23 pm | In Technical stuff | 3 Comments

OK, no one should have to tell an engineer to use caching. If you’re dealing with non-trivial amounts of data, and have a reasonable requirement for availability, you’ll need caching. The real issue is what, and how. The what depends on your situation. The how? Well, I’ve always thought it was obvious: ehcache. I’ve been using it as my 2nd-level cache provider for years. As cache providers go, it’s done well by me.

Well, now Greg Luck’s taking it to the next level. By moving to a minimum JDK of 1.5, he’ll be able to remove all dependencies. Also, ehcache-1.5 was a performant module. Now, if his figures are right, ehcache-1.6 will truly obliterate its peers. It’s still in beta, 1.6 that is, but check it out.

fonts and stuff…

October 1, 2008 on 8:35 pm | In Technical stuff | No Comments

Eric Burke’s Blog has a post talking about finding the best font for his comics. OK, One comment brought a superior tool to light: typetester.org. Honestly, I’ve needed this thing for years.

t-mobile g1

September 23, 2008 on 8:07 pm | In Technical stuff | No Comments

Finally, if you were looking for a actual piece of hardware for your Android apps, here it goes: the T-Mobile G1. It’s not too shabby.

Next Page »

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^