# HG changeset patch # User Dirk Olmes # Date 1419321671 -3600 # Node ID 0160569a17c4b73fa929fa0d6f1e62a53f8cc4e0 # Parent 94cc5f43d9d16a7ea75bfb1c0452b2aadec8c67c add a blog entry about JAAS diff -r 94cc5f43d9d1 -r 0160569a17c4 content/Java/jaas-pam.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/content/Java/jaas-pam.md Tue Dec 23 09:01:11 2014 +0100 @@ -0,0 +1,12 @@ +Title: JAAS login module using PAM +Date: 2014-12-23 +Tags: JDK +Lang: en + +I recently had a look into [JAAS](http://docs.oracle.com/javase/7/docs/technotes/guides/security/jaas/JAASRefGuide.html) for a customer project. The API is not 100% straightforward due to its design goal of hiding implementation specifics but I guess that's the price you have to pay when specifying a generic API. + +The JAAS guide talks about JAAS's similarity to [PAM](https://en.wikipedia.org/wiki/Pluggable_authentication_module). This lead me to think that there should be a default implementation of a bridge between JAAS and PAM out there. Well there is [the jaas-pam project on Sourceforge](http://jaas-pam.sourceforge.net/) but the project's code hasn't been updated in years and on top of that the project uses [JNI](http://docs.oracle.com/javase/7/docs/technotes/guides/jni/index.html). + +Then I stumbled over [Leonid Dubinsky's blog](http://blog.dub.podval.org/2011/02/java-and-pam.html) which suggests using [libpam4j](https://github.com/kohsuke/libpam4j) to implement a LoginModule for PAM. Now that sounds like some interesting project to get my feet wet with JAAS! + +It only took me an hour or so to come up with a LoginModule implementation using libpam4j. I put the code up [on github](https://github.com/dirk-olmes/jaas-pam) in case I need it later.