} else {// setup keyring
TextOutputCallback textCb1 = new TextOutputCallback(
TextOutputCallback.INFORMATION,
- "Enter a master password");
+ "Enter a master password which will protect your private data");
TextOutputCallback textCb2 = new TextOutputCallback(
TextOutputCallback.INFORMATION,
- "It will encrypt your private data");
+ "(for example your credentials to third-party services)");
TextOutputCallback textCb3 = new TextOutputCallback(
TextOutputCallback.INFORMATION,
- "Don't forget it or your data is lost");
+ "Don't forget this password since the data cannot be read without it");
PasswordCallback confirmPasswordCb = new PasswordCallback(
"Confirm password", false);
// first try
argeo.osgi.start=\
org.springframework.osgi.extender,\
+org.argeo.security.services,\
org.argeo.node.repofactory.jackrabbit,\
org.argeo.node.repo.jackrabbit,\
org.argeo.security.dao.ldap,\
-org.argeo.security.services,\
org.argeo.security.equinox,\
org.eclipse.core.runtime,\
org.eclipse.equinox.common,\
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.TextOutputCallback;
import javax.security.auth.login.LoginException;
import org.apache.commons.logging.Log;
private CallbackHandler callbackHandler;
private Subject subject;
-
- private Long waitBetweenFailedLoginAttempts = 5*1000l;
+
+ private Long waitBetweenFailedLoginAttempts = 5 * 1000l;
public SpringLoginModule() {
subject.getPublicCredentials().clear();
// ask for username and password
- Callback label = new TextOutputCallback(
- TextOutputCallback.INFORMATION, "Required login");
NameCallback nameCallback = new NameCallback("User");
PasswordCallback passwordCallback = new PasswordCallback(
"Password", false);
if (callbackHandler == null)
throw new LoginException("No call back handler available");
- callbackHandler.handle(new Callback[] { label, nameCallback,
+ callbackHandler.handle(new Callback[] { nameCallback,
passwordCallback });
// Set user name and password
SPRING_SECURITY_CONTEXT {
org.eclipse.equinox.security.auth.module.ExtensionLoginModule sufficient
extensionId="org.argeo.security.equinox.springSecurityContextLoginModule";
-};
\ No newline at end of file
+};
+
+KEYRING {
+ org.argeo.util.crypto.KeyringLoginModule required;
+};
extensionId="org.argeo.security.equinox.osSpringLoginModule";
};
-KEYRING_OLD {
- org.eclipse.equinox.security.auth.module.ExtensionLoginModule required
- extensionId="org.argeo.security.equinox.keyringLoginModule";
-};
-
KEYRING {
org.argeo.util.crypto.KeyringLoginModule required;
};
isCancelled = false;
setBlockOnOpen(false);
open();
+
final Button okButton = getButton(IDialogConstants.OK_ID);
okButton.setText("Login");
okButton.addSelectionListener(new SelectionListener() {
protected void configureShell(Shell shell) {
super.configureShell(shell);
- shell.setText("Login");
+ shell.setText("Autentication");
}
}
package org.argeo.security.ui.dialogs;
import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.TextOutputCallback;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+/** Default authentication dialog, to be used as {@link CallbackHandler}. */
public class DefaultLoginDialog extends AbstractLoginDialog {
public DefaultLoginDialog() {
protected DefaultLoginDialog(Shell parentShell) {
super(parentShell);
- // setBlockOnOpen(false);
}
protected Point getInitialSize() {
protected Control createContents(Composite parent) {
Control control = super.createContents(parent);
parent.pack();
+ // Move the dialog to the center of the top level shell.
+ Rectangle shellBounds = Display.getCurrent().getBounds();
+ Point dialogSize = parent.getSize();
+ int x = shellBounds.x + (shellBounds.width - dialogSize.x) / 2;
+ int y = shellBounds.y + (shellBounds.height - dialogSize.y) / 2;
+ parent.setLocation(x, y);
return control;
}
public void internalHandle() {
}
-
- // hack to simulate modal
- // see
- // http://dev.eclipse.org/mhonarc/newsLists/news.eclipse.platform.jface/msg00181.html
- // protected void setShellStyle(int newShellStyle) {
- // // turn off APPLICATION_MODAL
- // int newstyle = newShellStyle & ~SWT.APPLICATION_MODAL;
- // // turn on MODELESS
- // newstyle |= SWT.MODELESS;
- // super.setShellStyle(newstyle);
- // }
- //
- // public int open() {
- //
- // int retVal = super.open();
- // // this will let the caller wait till OK, Cancel is
- // // pressed, but will let the other GUI responsive
- // pumpMessages();
- // return retVal;
- // }
- //
- // protected void pumpMessages() {
- // Shell sh = getShell();
- // Display disp = sh.getDisplay();
- // while (!sh.isDisposed()) {
- // if (!disp.readAndDispatch())
- // disp.sleep();
- // }
- // disp.update();
- // }
-
}
org.argeo.jcr,
org.argeo.jcr.security,
org.argeo.jcr.spring,
- org.argeo.security.jcr,
- org.argeo.security.ui,
org.argeo.util,
org.argeo.util.crypto,
org.eclipse.ui.forms,
<bean id="repositoryRegister" class="org.argeo.jcr.DefaultRepositoryRegister">
</bean>
- <bean id="nodeSession" class="org.argeo.security.jcr.SecureThreadBoundSession">
+ <bean id="nodeSession" class="org.argeo.jcr.spring.ThreadBoundSession">
<property name="repository" ref="nodeRepository" />
</bean>
username.getText(), pwd);
session = repository.login(sc);
MessageDialog.openInformation(getParentShell(), "Success",
- "Connection to " + uri + "successful");
+ "Connection to '" + uriText.getText()
+ + "' successful");
}
} catch (Exception e) {
ErrorFeedback.show(
+++ /dev/null
-package org.argeo.jcr.security;
-
-
-public class CaManager {
- // private Session session;
-
-}
+++ /dev/null
-package org.argeo.jcr.security;
-
-public interface SecurityTypes {
- public final static String SECURITY_CA = "security:ca";
-}