use of org.openntf.domino.xsp.session.InvalidSessionFactory in project org.openntf.domino by OpenNTF.
the class XotsDominoExecutor method initModule.
/**
* Helper for WrappedCallable/WrappedRunnable
*
* @param ctx
* @param mcl
* @param wrapper
* @throws ServletException
*/
static void initModule(final NotesContext ctx, final ClassLoader mcl, final Object wrappedObject) throws ServletException {
if (mcl instanceof ModuleClassLoader) {
URLClassLoader dcl = (URLClassLoader) ((ModuleClassLoader) mcl).getDynamicClassLoader();
String className = wrappedObject.getClass().getName();
String str = className.replace('.', '/') + ".class";
URL url = dcl.findResource(str);
if (url != null && url.getProtocol().startsWith("xspnsf")) {
// Set up the "TopLevelXPageSigner == Signer of the runnable
// As soon as we are in a xspnsf, we do not have a SessionFactory!
ctx.setSignerSessionRights("WEB-INF/classes/" + str);
// RPr: There is a bug: you can decide if you want to use "sessionAsSigner" or "sessionAsSignerFullAccess"
// But you cannot use both simultaneously!
Session signerSession = ctx.getSessionAsSigner(true);
if (signerSession != null) {
Factory.setSessionFactory(new XPageSignerSessionFactory(false), SessionType.SIGNER);
Factory.setSessionFactory(new XPageSignerSessionFactory(true), SessionType.SIGNER_FULL_ACCESS);
} else {
// do not setup signer sessions if it is not properly signed!
Factory.setSessionFactory(new InvalidSessionFactory(), SessionType.SIGNER);
Factory.setSessionFactory(new InvalidSessionFactory(), SessionType.SIGNER_FULL_ACCESS);
}
} else {
// The code is not part from an NSF, so it resides on the server
Factory.setSessionFactory(new XPageNamedSessionFactory(Factory.getLocalServerName(), false), SessionType.SIGNER);
Factory.setSessionFactory(new XPageNamedSessionFactory(Factory.getLocalServerName(), true), SessionType.SIGNER_FULL_ACCESS);
}
}
Factory.setClassLoader(mcl);
}
Aggregations