]> git.argeo.org Git - lgpl/argeo-commons.git/blob - SecureRapActivator.java
762b227830f1d5b120a461f6958560a1ff63371b
[lgpl/argeo-commons.git] / SecureRapActivator.java
1 package org.argeo.security.ui.rap;
2
3 import java.net.URL;
4
5 import org.eclipse.equinox.security.auth.ILoginContext;
6 import org.eclipse.equinox.security.auth.LoginContextFactory;
7 import org.osgi.framework.BundleActivator;
8 import org.osgi.framework.BundleContext;
9
10 /** Configure Equinox login context from the bundle context. */
11 public class SecureRapActivator implements BundleActivator {
12
13 public final static String ID = "org.argeo.security.ui.rap";
14 public final static String CONTEXT_SPRING = "SPRING";
15 private static final String JAAS_CONFIG_FILE = "/META-INF/jaas_default.txt";
16
17 private static BundleContext bundleContext;
18
19 public void start(BundleContext bundleContext) throws Exception {
20 SecureRapActivator.bundleContext = bundleContext;
21 }
22
23 public void stop(BundleContext context) throws Exception {
24 }
25
26 static ILoginContext createLoginContext() {
27 URL configUrl = bundleContext.getBundle().getEntry(JAAS_CONFIG_FILE);
28 return LoginContextFactory.createContext(CONTEXT_SPRING, configUrl);
29 }
30 }