I am trying to use jaas in my osgi proxy server application. I would like the
proxy authorization to be done with jaas. I would like to keep track of what
LoginModules are available, so, the user would be able to pick from a list
of classes that implement the LoginModule interface. Here is my problem
though. 

a) User picks a LoginModule to use.
b) App sets up the Configuration so that the LoginModule class choosen
matches to the AppName. (This is the way that jaas does it.)
c) Then when its time to validate a proxy request, I use the new
LoginContext(appName, callbackhandler).login() as jaas specifies.
d) It fails, because it looks like LoginContext.login() does a
Class.forName(loginModuleClassName) and the class of the LoginModule is not
imported/known to the calling bundle.

So, how can i make it work with an existing class that loads up classes by
name, and is not going to know what there name is ahead of time, and the
bundle cant import them because it wont know ahead of time what they are
going to be.



I tried to create an interface something like this:

public interface Authenticator {
  public void authenticate(String name, String pass);
}

This way, i was hoping, i could create a bundle that could call the
following code:

new LoginContext(appName, loginModuleClassName).login()

and this bundle would know about the loginModuleClassName. I could then
place the .jar file of the loginModuleClassName and place it in the bundle,
and reference it on the Bundle-ClassPath. Then the main bundle that calls
the Authenticator should be able to just call authenticate() without knowing
what underlying classes were doing the work. But, this didnt work either. It
gives me an error of unable to find LoginModule: blah.blah.blah.Blah.  I put
the code "Class.forName(loginModuleClassName)" right inside the
authenticate() method and that worked fine with no errors. So the bundle can
access that class just fine.

I am kinda at a loss as to how to make this work. In summary, I would like
to have one "Main" bundle that uses jaas, and some "child" bundles that
implement the LoginModule interface and are called by the "Main" bundle.
But, the way that LoginContext is coded, it uses Class.forName() and that
breaks everything.

any ideas?

thanks.

-- 
View this message in context: 
http://www.nabble.com/osgi-and-jaas-tp23485885p23485885.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to