X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.e4.rap%2Fsrc%2Forg%2Fargeo%2Fcms%2Fe4%2Frap%2FCmsE4EntryPointFactory.java;h=a5a32348e43896837bd0908730af7a4aa4fc0dba;hb=cb244985c93c4003dee97ad26eed7fb814f71986;hp=6b974770eb7d03eabfa4de6d572644e13fac2e22;hpb=7fa402d36e0e194424589f4d7efeae5610d2c6eb;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsE4EntryPointFactory.java b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsE4EntryPointFactory.java index 6b974770e..a5a32348e 100644 --- a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsE4EntryPointFactory.java +++ b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsE4EntryPointFactory.java @@ -6,29 +6,62 @@ import javax.security.auth.Subject; import org.eclipse.rap.e4.E4ApplicationConfig; import org.eclipse.rap.e4.E4EntryPointFactory; +import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.application.EntryPoint; +import org.eclipse.rap.rwt.client.service.JavaScriptExecutor; public class CmsE4EntryPointFactory extends E4EntryPointFactory { - private Subject subject; + public final static String DEFAULT_LIFECYCLE_URI = "bundleclass://org.argeo.cms.e4.rap/org.argeo.cms.e4.rap.CmsLoginLifecycle"; - public CmsE4EntryPointFactory(Subject subject, E4ApplicationConfig config) { + public CmsE4EntryPointFactory(E4ApplicationConfig config) { super(config); - this.subject = subject; + } + + public CmsE4EntryPointFactory(String e4Xmi, String lifeCycleUri) { + super(defaultConfig(e4Xmi, lifeCycleUri)); + } + + public CmsE4EntryPointFactory(String e4Xmi) { + this(e4Xmi, DEFAULT_LIFECYCLE_URI); + } + + public static E4ApplicationConfig defaultConfig(String e4Xmi, String lifeCycleUri) { + E4ApplicationConfig config = new E4ApplicationConfig(e4Xmi, lifeCycleUri, null, null, false, true, true); + return config; } @Override public EntryPoint create() { - // Subject subject = new Subject(); EntryPoint ep = createEntryPoint(); EntryPoint authEp = new EntryPoint() { @Override public int createUI() { + Subject subject = new Subject(); return Subject.doAs(subject, new PrivilegedAction() { @Override public Integer run() { - return ep.createUI(); + // SPNEGO + // HttpServletRequest request = RWT.getRequest(); + // String authorization = request.getHeader(HEADER_AUTHORIZATION); + // if (authorization == null || !authorization.startsWith("Negotiate")) { + // HttpServletResponse response = RWT.getResponse(); + // response.setStatus(401); + // response.setHeader(HEADER_WWW_AUTHENTICATE, "Negotiate"); + // response.setDateHeader("Date", System.currentTimeMillis()); + // response.setDateHeader("Expires", System.currentTimeMillis() + (24 * 60 * 60 + // * 1000)); + // response.setHeader("Accept-Ranges", "bytes"); + // response.setHeader("Connection", "Keep-Alive"); + // response.setHeader("Keep-Alive", "timeout=5, max=97"); + // // response.setContentType("text/html; charset=UTF-8"); + // } + + JavaScriptExecutor jsExecutor = RWT.getClient().getService(JavaScriptExecutor.class); + Integer exitCode = ep.createUI(); + jsExecutor.execute("location.reload()"); + return exitCode; } }); @@ -40,5 +73,4 @@ public class CmsE4EntryPointFactory extends E4EntryPointFactory { protected EntryPoint createEntryPoint() { return super.create(); } - }