--- a/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/common/RadLoginManager.java Thu Dec 09 14:15:58 2010 -0500
+++ b/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/common/RadLoginManager.java Thu Dec 09 14:16:23 2010 -0500
@@ -49,6 +49,8 @@
//
private static interface AuthPrompter {
+ DialogMessage getInitialMessage(LoginRequest request);
+
Block initiate(LoginRequest request, AuthenticatorMXBean auth)
throws ActionAbortedException, ObjectException;
@@ -59,6 +61,13 @@
private class LoginPrompter implements AuthPrompter {
@Override
+ public DialogMessage getInitialMessage(LoginRequest request) {
+ return new DialogMessage(Finder.getString(
+ "login.message.userauth", request.getHost().getValue(),
+ request.getUser().getValue()));
+ }
+
+ @Override
public Block initiate(LoginRequest request,
AuthenticatorMXBean auth) throws ActionAbortedException,
ObjectException {
@@ -82,6 +91,13 @@
private class RolePrompter implements AuthPrompter {
@Override
+ public DialogMessage getInitialMessage(LoginRequest request) {
+ return new DialogMessage(Finder.getString(
+ "login.message.roleauth", request.getHost().getValue(),
+ request.getUser().getValue(), request.getRole().getValue()));
+ }
+
+ @Override
public Block initiate(LoginRequest request,
AuthenticatorMXBean auth) throws ActionAbortedException,
ObjectException {
@@ -549,13 +565,26 @@
ActionRegressedException {
List<DialogMessage> messages = request.getMessages();
+ messages.add(prompter.getInitialMessage(request));
+
try {
Block answer = prompter.initiate(request, auth);
+ List<LoginProperty> properties =
+ new LinkedList<LoginProperty>();
+
BlockType type;
while (true) {
+ properties.clear();
+
switch (type = answer.getType()) {
case success:
+ // Display any lingering messages from the server
+ if (!messages.isEmpty()) {
+ prompter.prompt(request, properties, data);
+ messages.clear();
+ }
+
auth.complete();
return true;
@@ -565,21 +594,17 @@
default:
assert type == BlockType.conv;
case conv:
- List<LoginProperty> properties =
- new LinkedList<LoginProperty>();
-
for (Message m : answer.getMessages()) {
String text = m.getMessage();
switch (m.getStyle()) {
case prompt_echo_off:
- properties.add(
- new PasswordLoginProperty(text,
- new char[0], true));
+ properties.add(new PasswordLoginProperty(
+ text, new char[0], true));
break;
case prompt_echo_on:
- properties.add(
- new StringLoginProperty(text, "", true));
+ properties.add(new StringLoginProperty(
+ text, "", true));
break;
case error_msg:
@@ -596,7 +621,6 @@
if (!properties.isEmpty()) {
prompter.prompt(request, properties, data);
- // User only needs to see any message once, presumably
messages.clear();
}
@@ -604,8 +628,9 @@
for (LoginProperty property : properties) {
if (property instanceof StringLoginProperty) {
String v = (String)property.getValue();
- if (v != null)
+ if (v != null) {
response.add(v.toCharArray());
+ }
} else if (property instanceof PasswordLoginProperty) {
response.add((char[])property.getValue());
}
--- a/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/common/resources/Resources.properties Thu Dec 09 14:15:58 2010 -0500
+++ b/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/common/resources/Resources.properties Thu Dec 09 14:16:23 2010 -0500
@@ -23,11 +23,8 @@
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
#
-login.status.field.validation = Validating login fields...
-login.status.host.truststore = Creating truststore...
-login.status.host.trusted = Verifing {0} is trusted...
-login.status.host.connecting = Connecting to {0}...
-login.status.loggingin = Logging into {0} as {1}...
+login.message.roleauth = Role "{2}" must be authenticated.
+login.message.userauth = User "{1}" must be authenticated.
login.err.host.unknown = Host "{0}" is unknown.
login.err.host.refused = Connection to host "{0}" was refused.
--- a/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/swing/LoginPane.java Thu Dec 09 14:15:58 2010 -0500
+++ b/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/swing/LoginPane.java Thu Dec 09 14:16:23 2010 -0500
@@ -474,11 +474,7 @@
}
});
- DialogMessage help = new DialogMessage(Finder.getString(
- "login.message.roleauth", host.getValue(),
- user.getValue(), role.getValue()));
-
- promptForAuth(request.getMessages(), help, properties);
+ promptForAuth(request.getMessages(), properties);
}
/**
@@ -510,10 +506,7 @@
}
});
- DialogMessage help = new DialogMessage(Finder.getString(
- "login.message.userauth", host.getValue(), user.getValue()));
-
- promptForAuth(request.getMessages(), help, properties);
+ promptForAuth(request.getMessages(), properties);
}
//
@@ -611,22 +604,20 @@
/**
* Prompt the user for login information.
*
- * @param messages - messages to instruct the user
+ * @param messages
+ * messages to instruct the user
*
- * @param help - on-screen help.
- *
- * @param properties - A {@code List} of {@code LoginProperty} objects.
+ * @param properties
+ * {@code List} of {@code LoginProperty} objects.
* NOTE: Only instances of {@code StringLoginProperty} and
* {@code PasswordLoginProperty} are allowed.
*/
private void promptForAuth(final List<DialogMessage> messages,
- DialogMessage help, final List<LoginProperty> properties)
+ final List<LoginProperty> properties)
throws ActionAbortedException, ActionRegressedException {
assert !EventQueue.isDispatchThread();
- messages.add(help);
-
final Map<LoginProperty, JTextComponent> map =
new HashMap<LoginProperty, JTextComponent>();
--- a/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/swing/resources/Resources.properties Thu Dec 09 14:15:58 2010 -0500
+++ b/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/swing/resources/Resources.properties Thu Dec 09 14:16:23 2010 -0500
@@ -38,9 +38,7 @@
login.message.hostuser.host = Select a host to administer as user "{1}".
login.message.hostuser.host.user = Select a host to connect to and a user to administer it.
login.message.hostuser.user = Select a user to administer host "{0}".
-login.message.userauth = User "{1}" must be authenticated.
login.message.role = Select a role to authenticate, or choose "(none)" to administer host "{0}" as user "{1}".
-login.message.roleauth = Role "{2}" must be authenticated.
login.button.yes = Yes
login.button.no = No