]> git.argeo.org Git - lgpl/argeo-commons.git/blob - ui/rcp/SecureApplicationActivator.java
Prepare next development cycle
[lgpl/argeo-commons.git] / ui / rcp / SecureApplicationActivator.java
1 package org.argeo.security.ui.rcp;
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 /** Activator able to create {@link ILoginContext} */
11 public class SecureApplicationActivator implements BundleActivator {
12
13 public final static String CONTEXT_REMOTE = "REMOTE";
14 public final static String CONTEXT_NIX = "NIX";
15 public final static String CONTEXT_WINDOWS = "WINDOWS";
16 private static final String JAAS_CONFIG_FILE = "/META-INF/jaas_default.txt";
17
18 private static BundleContext bundleContext;
19
20 public void start(BundleContext bundleContext) throws Exception {
21 SecureApplicationActivator.bundleContext = bundleContext;
22 }
23
24 public void stop(BundleContext context) throws Exception {
25 }
26
27 static ILoginContext createLoginContext(String context) {
28 URL configUrl = bundleContext.getBundle().getEntry(JAAS_CONFIG_FILE);
29 return LoginContextFactory.createContext(context, configUrl);
30 }
31 }