import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.LanguageCallback;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.LanguageCallback;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.cms.CmsMsg;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.cms.CmsMsg;
import org.argeo.cms.auth.HttpRequestCallback;
import org.argeo.cms.i18n.LocaleUtils;
import org.argeo.cms.ui.CmsStyles;
import org.argeo.cms.ui.CmsView;
import org.argeo.cms.ui.internal.Activator;
import org.argeo.cms.util.CmsUtils;
import org.argeo.cms.auth.HttpRequestCallback;
import org.argeo.cms.i18n.LocaleUtils;
import org.argeo.cms.ui.CmsStyles;
import org.argeo.cms.ui.CmsView;
import org.argeo.cms.ui.internal.Activator;
import org.argeo.cms.util.CmsUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
specificUserUi(credentialsBlock);
Label l = new Label(credentialsBlock, SWT.NONE);
specificUserUi(credentialsBlock);
Label l = new Label(credentialsBlock, SWT.NONE);
// new Label(this, SWT.NONE).setText(CmsMsg.username.lead());
usernameT = new Text(credentialsBlock, SWT.BORDER);
usernameT.setMessage(username.lead(locale));
// new Label(this, SWT.NONE).setText(CmsMsg.username.lead());
usernameT = new Text(credentialsBlock, SWT.BORDER);
usernameT.setMessage(username.lead(locale));
GridData gd = CmsUtils.fillWidth();
gd.widthHint = textWidth;
usernameT.setLayoutData(gd);
GridData gd = CmsUtils.fillWidth();
gd.widthHint = textWidth;
usernameT.setLayoutData(gd);
// new Label(this, SWT.NONE).setText(CmsMsg.password.lead());
passwordT = new Text(credentialsBlock, SWT.BORDER | SWT.PASSWORD);
passwordT.setMessage(password.lead(locale));
// new Label(this, SWT.NONE).setText(CmsMsg.password.lead());
passwordT = new Text(credentialsBlock, SWT.BORDER | SWT.PASSWORD);
passwordT.setMessage(password.lead(locale));
gd = CmsUtils.fillWidth();
gd.widthHint = textWidth;
passwordT.setLayoutData(gd);
gd = CmsUtils.fillWidth();
gd.widthHint = textWidth;
passwordT.setLayoutData(gd);
- new LoginContext(LOGIN_CONTEXT_ANONYMOUS, subject).logout();
- loginContext = new LoginContext(LOGIN_CONTEXT_USER, subject, this);
+ // loginContext.logout();
+ LoginContext loginContext = new LoginContext(NodeConstants.LOGIN_CONTEXT_USER, this);
- } catch (FailedLoginException e) {
- log.warn(e.getMessage());
+ cmsView.authChange(loginContext);
+ return true;
+ } catch (LoginException e) {
+ if (log.isTraceEnabled())
+ log.warn("Login failed: " + e.getMessage(), e);
+ else
+ log.warn("Login failed: " + e.getMessage());
+
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
- else if (callback instanceof HttpRequestCallback)
- ((HttpRequestCallback) callback).setRequest(RWT.getRequest());
- else if (callback instanceof LanguageCallback && localeChoice != null)
+ else if (callback instanceof HttpRequestCallback) {
+ ((HttpRequestCallback) callback).setRequest(UiContext.getHttpRequest());
+ ((HttpRequestCallback) callback).setResponse(UiContext.getHttpResponse());
+ } else if (callback instanceof LanguageCallback && localeChoice != null)