org.nuxeo.runtime.api
Class LoginModuleWrapper
java.lang.Object
org.nuxeo.runtime.api.LoginModuleWrapper
- All Implemented Interfaces:
- LoginModule
public class LoginModuleWrapper
- extends Object
- implements LoginModule
A login module wrapper to overcome the class loading issues on OSGi frameworks.
A login module is specified using the class name - and when doing a login against that module
the login context will get a class instance for the module by using Clas.forName and the current
thread context class loader. This means in an OSGi application the class loader of the caller bundle
will be used to resolve the login module. But the caller bundle may not have any dependency on the login module
since it is not aware about which login module implementation is used underneath - so in most cases
the login module class will not be found.
For this reason all the contributed login modules will be wrapped using this class.
As almost any Nuxeo bundle have a dependency on runtime this class will be visible from almost any Nuxeo bundle.
So, the login context will instantiate this wrapper instead of the real login module and the wrapper
will use OSGi logic to instantiate the wrapped login module. (by using the bundle that contributed the login module)
IMPORTANT
This class is in org.nuxeo.runtime.api package to be visible to any bundle that uses Nuxeo runtime.
This is because this package is imported by almost any bundle using Nuxeo runtime - so you don't
need to declare the import package in the OSGi manifest.
In the case you don't use runtime but you are doing logins in the context of your bundle you must import the package
org.nuxeo.runtime.api
in your manifest.
- Author:
- Bogdan Stefanescu
DELEGATE_CLASS_KEY
public static final String DELEGATE_CLASS_KEY
LoginModuleWrapper
public LoginModuleWrapper()
initialize
public void initialize(Subject subject,
CallbackHandler callbackHandler,
Map<String,?> sharedState,
Map<String,?> options)
- Specified by:
initialize
in interface LoginModule
login
public boolean login()
throws LoginException
- Specified by:
login
in interface LoginModule
- Throws:
LoginException
commit
public boolean commit()
throws LoginException
- Specified by:
commit
in interface LoginModule
- Throws:
LoginException
abort
public boolean abort()
throws LoginException
- Specified by:
abort
in interface LoginModule
- Throws:
LoginException
logout
public boolean logout()
throws LoginException
- Specified by:
logout
in interface LoginModule
- Throws:
LoginException
Copyright © 2011 Nuxeo SAS. All Rights Reserved.