usr/src/java/vpanels/client/org/opensolaris/os/vp/client/common/RadLoginManager.java
author Stephen Talley <stephen.talley@oracle.com>
Thu, 09 Dec 2010 14:06:11 -0500
changeset 619 7c1f7535bc78
parent 615 d3970b657f35
child 620 faf036da4417
permissions -rw-r--r--
17587 rad text_info messages are shown as error messages in login dialog
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     1
/*
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     2
 * CDDL HEADER START
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     3
 *
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     7
 *
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    11
 * and limitations under the License.
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    12
 *
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    18
 *
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    19
 * CDDL HEADER END
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    20
 */
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    21
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    22
/*
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    23
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    24
 */
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    25
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    26
package org.opensolaris.os.vp.client.common;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    27
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    28
import java.io.*;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    29
import java.net.*;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    30
import java.security.*;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    31
import java.security.cert.*;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    32
import java.security.cert.Certificate;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    33
import java.util.*;
438
5341dd3e7a04 14761 simplify login dialog
Stephen Talley <stephen.talley@sun.com>
parents: 433
diff changeset
    34
import javax.management.*;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    35
import javax.management.remote.*;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    36
import javax.swing.JOptionPane;
438
5341dd3e7a04 14761 simplify login dialog
Stephen Talley <stephen.talley@sun.com>
parents: 433
diff changeset
    37
import org.opensolaris.os.rad.*;
5341dd3e7a04 14761 simplify login dialog
Stephen Talley <stephen.talley@sun.com>
parents: 433
diff changeset
    38
import org.opensolaris.os.rad.api.pam.*;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    39
import org.opensolaris.os.rad.jmx.RadConnector;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    40
import org.opensolaris.os.vp.common.panel.MBeanUtil;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    41
import org.opensolaris.os.vp.panel.common.*;
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
    42
import org.opensolaris.os.vp.panel.common.action.*;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    43
import org.opensolaris.os.vp.util.misc.*;
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    44
import org.opensolaris.os.vp.util.misc.finder.Finder;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    45
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    46
public abstract class RadLoginManager {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
    47
    //
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    48
    // Inner classes
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    49
    //
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    50
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    51
    private static interface AuthPrompter {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    52
	Block initiate(LoginRequest request, AuthenticatorMXBean auth)
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    53
	    throws ActionAbortedException, ObjectException;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    54
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    55
	void prompt(LoginRequest request, List<LoginProperty> properties,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    56
	    LoginData data) throws ActionAbortedException,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    57
	    ActionRegressedException;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    58
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    59
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    60
    private class LoginPrompter implements AuthPrompter {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    61
	@Override
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    62
	public Block initiate(LoginRequest request,
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    63
	    AuthenticatorMXBean auth) throws ActionAbortedException,
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    64
	    ObjectException {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    65
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    66
	    return auth.login(Locale.getDefault().getLanguage(),
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    67
		request.getUser().getValue());
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    68
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    69
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    70
	@Override
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    71
	public void prompt(LoginRequest request, List<LoginProperty> properties,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    72
	    LoginData data) throws ActionAbortedException,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    73
	    ActionRegressedException {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    74
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
    75
	    try {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
    76
		promptForUserAuth(request, properties);
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
    77
	    } finally {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
    78
		data.setUserAcknowledged(true);
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
    79
	    }
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    80
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    81
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    82
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    83
    private class RolePrompter implements AuthPrompter {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    84
	@Override
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    85
	public Block initiate(LoginRequest request,
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    86
	    AuthenticatorMXBean auth) throws ActionAbortedException,
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    87
	    ObjectException {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    88
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    89
	    return auth.assume(Locale.getDefault().getLanguage(),
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    90
		request.getRole().getValue());
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    91
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    92
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    93
	@Override
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    94
	public void prompt(LoginRequest request, List<LoginProperty> properties,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    95
	    LoginData data) throws ActionAbortedException,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
    96
	    ActionRegressedException {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
    97
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
    98
	    try {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
    99
		promptForRoleAuth(request, properties);
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   100
	    } finally {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   101
		data.setRoleAcknowledged(true);
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   102
	    }
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   103
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   104
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   105
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   106
    private static class LoginData {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   107
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   108
	// Instance data
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   109
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   110
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   111
	private ConnectionInfo userInfo;
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   112
	private ConnectionInfo roleInfo;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   113
	private AuthenticatorMXBean auth;
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   114
	private JMXConnector authConnector;
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   115
	private boolean userAcknowledged;
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   116
	private boolean roleAcknowledged;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   117
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   118
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   119
	// LoginData methods
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   120
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   121
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   122
	public AuthenticatorMXBean getAuthBean(LoginRequest request) {
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   123
	    JMXConnector connector =
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   124
		roleInfo != null ? roleInfo.getConnector() :
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   125
		userInfo != null ? userInfo.getConnector() : null;
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   126
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   127
	    if (authConnector != connector || auth == null) {
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   128
		authConnector = connector;
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   129
		auth = null;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   130
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   131
		if (connector != null) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   132
		    try {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   133
			MBeanServerConnection mbsc =
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   134
			    connector.getMBeanServerConnection();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   135
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   136
			ObjectName oName = MBeanUtil.makeObjectName(
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   137
			    "org.opensolaris.os.rad", "authentication");
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   138
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   139
			auth = JMX.newMXBeanProxy(mbsc, oName,
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   140
			    AuthenticatorMXBean.class);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   141
		    } catch (IOException e) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   142
			request.getMessages().add(new DialogMessage(
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   143
			    Finder.getString("login.err.io",
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   144
			    request.getHost().getValue()),
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   145
			    JOptionPane.ERROR_MESSAGE));
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   146
		    }
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   147
		}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   148
	    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   149
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   150
	    return auth;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   151
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   152
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   153
	public ConnectionInfo getRoleConnectionInfo() {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   154
	    return roleInfo;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   155
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   156
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   157
	public ConnectionInfo getUserConnectionInfo() {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   158
	    return userInfo;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   159
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   160
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   161
	public boolean isRoleAcknowledged() {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   162
	    return roleAcknowledged;
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   163
	}
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   164
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   165
	public boolean isUserAcknowledged() {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   166
	    return userAcknowledged;
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   167
	}
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   168
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   169
	public void setRoleAcknowledged(boolean roleAcknowledged) {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   170
	    this.roleAcknowledged = roleAcknowledged;
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   171
	    if (roleAcknowledged) {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   172
		setUserAcknowledged(true);
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   173
	    }
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   174
	}
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   175
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   176
	public void setRoleConnectionInfo(ConnectionInfo roleInfo) {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   177
	    this.roleInfo = roleInfo;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   178
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   179
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   180
	public void setUserAcknowledged(boolean userAcknowledged) {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   181
	    this.userAcknowledged = userAcknowledged;
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   182
	    if (!userAcknowledged) {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   183
		setRoleAcknowledged(false);
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   184
	    }
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   185
	}
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   186
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   187
	public void setUserConnectionInfo(ConnectionInfo userInfo) {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   188
	    this.userInfo = userInfo;
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   189
	    setRoleConnectionInfo(null);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   190
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   191
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   192
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   193
    private static class ConnectorData {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   194
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   195
	// Instance data
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   196
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   197
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   198
	private JMXConnector connector;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   199
	private boolean isLocal;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   200
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   201
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   202
	// Constructors
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   203
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   204
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   205
	public ConnectorData(JMXConnector connector, boolean isLocal) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   206
	    this.connector = connector;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   207
	    this.isLocal = isLocal;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   208
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   209
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   210
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   211
	// ConnectorData methods
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   212
	//
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   213
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   214
	public JMXConnector getConnector() {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   215
	    return connector;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   216
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   217
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   218
	public boolean isLocal() {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   219
	    return isLocal;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   220
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   221
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   222
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   223
    //
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   224
    // Static data
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   225
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   226
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   227
    public static final String TRUSTSTORE_PASSWORD = "trustpass";
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   228
    public static final String LOCAL_USER = System.getProperty("user.name");
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   229
    public static final String LOCAL_HOST = "localhost";
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   230
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   231
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   232
    // Instance data
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   233
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   234
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   235
    private ConnectionManager connManager;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   236
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   237
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   238
    // Constructors
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   239
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   240
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   241
    public RadLoginManager(ConnectionManager connManager) {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   242
	this.connManager = connManager;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   243
    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   244
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   245
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   246
    // RadLoginManager methods
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   247
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   248
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   249
    /**
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   250
     * Creates an empty truststore file.
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   251
     */
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   252
    protected void createTrustStore(File truststore) throws KeyStoreException,
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   253
	IOException, NoSuchAlgorithmException, CertificateException {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   254
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   255
	File truststoreDir = truststore.getParentFile();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   256
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   257
	if (!truststoreDir.exists()) {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   258
	    if (!truststoreDir.mkdirs()) {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   259
		throw new IOException(
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   260
		    "could not create truststore directory: " +
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   261
		    truststoreDir.getAbsolutePath());
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   262
	    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   263
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   264
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   265
	KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   266
	char[] password = getTrustStorePassword().toCharArray();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   267
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   268
	// Create empty keystore
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   269
	keyStore.load(null, password);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   270
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   271
	FileOutputStream fos = new FileOutputStream(truststore);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   272
	keyStore.store(fos, password);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   273
	fos.close();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   274
    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   275
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   276
    /**
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   277
     * Opens a connection to the server.  This routine returns a two-element
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   278
     * array consisting of:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   279
     * <p/>
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   280
     * <ol>
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   281
     *	 <li>
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   282
     *	   a (new or existing) {@link ConnectionInfo} for the {@code user@host}
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   283
     *	   connection, and
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   284
     *	 </li>
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   285
     *	 <li>
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   286
     *	   a (new or existing) {@link ConnectionInfo} for the {@code role@host
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   287
     *	   (via user)} connection, or {@code null} if the user did not choose to
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   288
     *	   assume a role
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   289
     *	 </li>
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   290
     * </ol>
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   291
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   292
     * @param	    request
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   293
     *		    the {@link LoginRequest} encapsulating the preset values and
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   294
     *		    editability of each core {@link LoginProperty}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   295
     *
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   296
     * @param	    current
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   297
     *		    if non-{@code null}, ensures that the user is aware of
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   298
     *		    changes in host/user/role (preventing the use of cached
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   299
     *		    connections without the user's knowledge)
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   300
     *
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   301
     * @exception   ActionAbortedException
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   302
     *		    if the user cancels the operation
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   303
     *
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   304
     * @exception   ActionFailedException
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   305
     *		    if the given request fails
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   306
     */
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   307
    public ConnectionInfo[] getConnectionInfo(LoginRequest request,
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   308
	ConnectionInfo current) throws ActionAbortedException,
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   309
	ActionFailedException {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   310
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   311
	LoginData data = new LoginData();
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   312
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   313
	boolean done = false;
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   314
	while (!done) {
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   315
	    gatherHostAndUserData(request, data);
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   316
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   317
	    try {
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   318
		gatherRoleData(request, data);
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   319
		done = true;
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   320
	    } catch (ActionRegressedException e) {
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   321
		request.getHost().setErrored(false);
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   322
		request.getUser().setErrored(false);
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   323
		request.getRole().setErrored(false);
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   324
		request.getMessages().clear();
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   325
		data.setUserConnectionInfo(null);
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   326
	    }
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   327
	}
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   328
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   329
	ConnectionInfo userInfo = data.getUserConnectionInfo();
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   330
	ConnectionInfo roleInfo = data.getRoleConnectionInfo();
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   331
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   332
	// To prevent rogue connections, if the chosen connection has a
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   333
	// different host/user/role than the current connection, ensure that the
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   334
	// user has already acknowledged it at some point in the authentication
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   335
	// process.  If not, prompt for acknowledgement now.
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   336
	if (current != null &&
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   337
	    (roleInfo == null ?
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   338
	    (!data.isUserAcknowledged() &&
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   339
	    (!current.matchesHost(userInfo.getHost()) ||
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   340
	    !current.matchesUser(userInfo.getUser()))) :
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   341
	    (!data.isRoleAcknowledged() &&
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   342
	    (!current.matchesHost(roleInfo.getHost()) ||
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   343
	    !current.matchesUser(roleInfo.getUser()) ||
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   344
	    !current.matchesRole(roleInfo.getRole()))))) {
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   345
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   346
	    promptForAck(request);
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   347
	}
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   348
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   349
	return new ConnectionInfo[] { userInfo, roleInfo };
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   350
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   351
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   352
    public ConnectionManager getConnectionManager() {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   353
	return connManager;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   354
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   355
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   356
    /**
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   357
     * Gets the truststore file.
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   358
     */
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   359
    public abstract File getTrustStoreFile();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   360
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   361
    /**
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   362
     * Gets the truststore password.  This default implementation returns
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   363
     * "{@code trustpass}".
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   364
     */
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   365
    public String getTrustStorePassword() {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   366
	return TRUSTSTORE_PASSWORD;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   367
    }
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   368
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   369
    protected boolean handleCertFailure(String host, File truststore,
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   370
	Certificate certificate) throws ActionAbortedException,
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   371
	KeyStoreException, IOException, NoSuchAlgorithmException,
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   372
	CertificateException {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   373
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   374
	KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   375
	char[] password = getTrustStorePassword().toCharArray();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   376
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   377
	// Load truststore
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   378
	FileInputStream fis = new FileInputStream(truststore);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   379
	keyStore.load(fis, password);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   380
	fis.close();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   381
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   382
	// Does the truststore already contain the certificate?
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   383
	String alias = keyStore.getCertificateAlias(certificate);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   384
	if (alias != null) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   385
	    return false;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   386
	}
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   387
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   388
	boolean acceptNeeded = true;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   389
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   390
	if (NetUtil.isLocalAddress(host)) {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   391
	    FileInputStream certFileIn = null;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   392
	    try {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   393
		File certFile = new File("/etc/rad/cert.pem");
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   394
		certFileIn = new FileInputStream(certFile);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   395
		Certificate localCert = CertificateFactory.
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   396
		    getInstance("X.509").generateCertificate(certFileIn);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   397
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   398
		if (localCert.equals(certificate)) {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   399
		    acceptNeeded = false;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   400
		}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   401
	    } catch (Throwable ignore) {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   402
	    } finally {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   403
		IOUtil.closeIgnore(certFileIn);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   404
	    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   405
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   406
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   407
	if (acceptNeeded) {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   408
	    // Display the certificate, prompt user to accept
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   409
	    promptForCertificate(host, certificate);
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   410
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   411
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   412
	// Add certificate
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   413
	alias = ((X509Certificate)certificate).getIssuerDN().toString();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   414
	KeyStore.Entry entry =
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   415
	    new KeyStore.TrustedCertificateEntry(certificate);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   416
	keyStore.setEntry(alias, entry, null);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   417
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   418
	FileOutputStream fos = new FileOutputStream(truststore);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   419
	keyStore.store(fos, password);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   420
	fos.close();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   421
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   422
	return true;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   423
    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   424
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   425
    /**
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   426
     * Prompt the user to acknowledge or reject the imminent completion of the
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   427
     * given request.
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   428
     *
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   429
     * @param	    request
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   430
     *		    the {@link LoginRequest} encapsulating the preset values of
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   431
     *		    each core {@link LoginProperty}
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   432
     *
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   433
     * @exception   ActionAbortedException
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   434
     *		    if the user cancels the operation
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   435
     */
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   436
    protected abstract void promptForAck(LoginRequest request)
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   437
	throws ActionAbortedException;
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   438
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   439
    /**
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   440
     * Display the given {@code Certificate} details and prompt for user
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   441
     * confirmation to add it to the truststore.
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   442
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   443
     * @param	    host
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   444
     *		    the owner of the {@code Certificate}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   445
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   446
     * @param	    certificate
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   447
     *		    the {@code Certificate} to verify
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   448
     *
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   449
     * @exception   ActionAbortedException
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   450
     *		    if the user cancels the operation
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   451
     */
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   452
    protected abstract void promptForCertificate(String host,
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   453
	Certificate certificate) throws ActionAbortedException;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   454
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   455
    /**
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   456
     * Prompts the user to acknowledge failure of the given request.
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   457
     *
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   458
     * @param	    request
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   459
     *		    the {@link LoginRequest} encapsulating the values and
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   460
     *		    error status of each core {@link LoginProperty}
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   461
     */
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   462
    protected abstract void promptForFailedRequest(LoginRequest request);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   463
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   464
    /**
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   465
     * Prompt the user to enter host/user data, subject to the editability and
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   466
     * preset values of the host and user {@link LoginProperty}s of the given
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   467
     * request.
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   468
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   469
     * @param	    request
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   470
     *		    the {@link LoginRequest} encapsulating the preset values and
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   471
     *		    editability of each core {@link LoginProperty}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   472
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   473
     * @exception   ActionAbortedException
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   474
     *		    if the user cancels the operation
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   475
     */
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   476
    protected abstract void promptForHostAndUser(LoginRequest request)
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   477
	throws ActionAbortedException;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   478
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   479
    /**
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   480
     * Prompt the user to select a role, subject to the editability and preset
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   481
     * value of the role {@link LoginProperty} of the given request.
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   482
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   483
     * @param	    request
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   484
     *		    the {@link LoginRequest} encapsulating the preset values and
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   485
     *		    editability of each core {@link LoginProperty}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   486
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   487
     * @param	    roles
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   488
     *		    a list of valid roles for the selected user
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   489
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   490
     * @exception   ActionAbortedException
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   491
     *		    if the user cancels the operation
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   492
     *
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   493
     * @exception   ActionRegressedException
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   494
     *		    if the chooses to re-edit the host or user fields
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   495
     */
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   496
    protected abstract void promptForRole(LoginRequest request,
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   497
	List<String> roles) throws ActionAbortedException,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   498
	ActionRegressedException;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   499
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   500
    /**
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   501
     * Prompts the user to enter data for each of the given {@link
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   502
     * LoginProperty}s required for role authentication by the server.
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   503
     *
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   504
     * @param	    request
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   505
     *		    the {@link LoginRequest} encapsulating the preset values and
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   506
     *		    editability of each core {@link LoginProperty}
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   507
     *
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   508
     * @param	    properties
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   509
     *		    a {@code List} of {@link LoginProperty}s from the server
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   510
     *
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   511
     * @exception   ActionAbortedException
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   512
     *		    if the user cancels the operation
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   513
     *
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   514
     * @exception   ActionRegressedException
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   515
     *		    if the chooses to re-edit the role field
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   516
     */
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   517
    protected abstract void promptForRoleAuth(LoginRequest request,
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   518
	List<LoginProperty> properties) throws ActionAbortedException,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   519
	ActionRegressedException;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   520
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   521
    /**
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   522
     * Prompts the user to enter data for each of the given {@link
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   523
     * LoginProperty}s required for user authentication by the server.
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   524
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   525
     * @param	    request
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   526
     *		    the {@link LoginRequest} encapsulating the preset values and
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   527
     *		    editability of each core {@link LoginProperty}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   528
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   529
     * @param	    properties
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   530
     *		    a {@code List} of {@link LoginProperty}s from the server
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   531
     *
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   532
     * @exception   ActionAbortedException
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   533
     *		    if the user cancels the operation
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   534
     *
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   535
     * @exception   ActionRegressedException
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   536
     *		    if the chooses to re-edit the host or user fields
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   537
     */
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   538
    protected abstract void promptForUserAuth(LoginRequest request,
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   539
	List<LoginProperty> properties) throws ActionAbortedException,
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   540
	ActionRegressedException;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   541
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   542
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   543
    // Private methods
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   544
    //
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   545
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   546
    @SuppressWarnings({"fallthrough"})
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   547
    private boolean authConverse(LoginRequest request, AuthenticatorMXBean auth,
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   548
	AuthPrompter prompter, LoginData data) throws ActionAbortedException,
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 496
diff changeset
   549
	ActionRegressedException {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   550
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   551
	List<DialogMessage> messages = request.getMessages();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   552
	try {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   553
	    Block answer = prompter.initiate(request, auth);
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   554
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   555
	    BlockType type;
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   556
	    while (true) {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   557
		switch (type = answer.getType()) {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   558
		case success:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   559
		    auth.complete();
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   560
		    return true;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   561
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   562
		case error:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   563
		    return false;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   564
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   565
		default:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   566
		    assert type == BlockType.conv;
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   567
		case conv:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   568
		    List<LoginProperty> properties =
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   569
			new LinkedList<LoginProperty>();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   570
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   571
		    for (Message m : answer.getMessages()) {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   572
			String text = m.getMessage();
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   573
			switch (m.getStyle()) {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   574
			case prompt_echo_off:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   575
			    properties.add(
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   576
				new PasswordLoginProperty(text,
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   577
				    new char[0], true));
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   578
			    break;
468
7fa83d27b9f3 14970 python client misformats setattr requests
David Powell <David.Powell@sun.com>
parents: 442
diff changeset
   579
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   580
			case prompt_echo_on:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   581
			    properties.add(
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   582
				new StringLoginProperty(text, "", true));
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   583
			    break;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   584
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   585
			case error_msg:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   586
			    messages.add(new DialogMessage(text,
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   587
				JOptionPane.ERROR_MESSAGE));
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   588
			    break;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   589
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   590
			case text_info:
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   591
			    messages.add(new DialogMessage(text,
619
7c1f7535bc78 17587 rad text_info messages are shown as error messages in login dialog
Stephen Talley <stephen.talley@oracle.com>
parents: 615
diff changeset
   592
				JOptionPane.INFORMATION_MESSAGE));
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   593
			    break;
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   594
			}
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   595
		    }
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   596
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   597
		    if (!properties.isEmpty()) {
496
3e406d128be1 15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents: 487
diff changeset
   598
			prompter.prompt(request, properties, data);
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   599
			// User only needs to see any message once, presumably
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   600
			messages.clear();
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   601
		    }
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   602
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   603
		    List<char[]> response = new LinkedList<char[]>();
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   604
		    for (LoginProperty property : properties) {
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   605
			if (property instanceof StringLoginProperty) {
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   606
			    String v = (String)property.getValue();
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   607
			    if (v != null)
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   608
				response.add(v.toCharArray());
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   609
			} else if (property instanceof PasswordLoginProperty) {
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   610
			    response.add((char[])property.getValue());
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   611
			}
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   612
		    }
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   613
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   614
		    answer = auth.submit(response);
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   615
		    // clear out passwords
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   616
		    for (char[] res : response) {
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   617
			Arrays.fill(res, (char)0);
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   618
			res = null;
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   619
		    }
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   620
		}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   621
	    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   622
	} catch (ObjectException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   623
	    messages.add(new DialogMessage(
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   624
		Finder.getString("login.err.io",
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   625
                request.getHost().getValue()),
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   626
		JOptionPane.ERROR_MESSAGE));
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   627
	    return false;
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   628
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   629
    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   630
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   631
    private ConnectorData createConnection(String host)
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   632
	throws KeyStoreException, NoSuchAlgorithmException,
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   633
	CertificateException, MalformedURLException, IOException,
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   634
	ActionAbortedException {
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   635
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   636
	JMXConnector connector;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   637
	boolean isLocal = NetUtil.isLocalAddress(host);
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   638
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   639
	if (isLocal) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   640
	    JMXServiceURL url = new JMXServiceURL(
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   641
		RadConnector.PROTOCOL_UDS, "", 0, "/var/run/radsocket");
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   642
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   643
	    connector = JMXConnectorFactory.connect(url, null);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   644
	} else {
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   645
	    File truststore = getTrustStoreFile();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   646
	    if (!truststore.exists()) {
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   647
		createTrustStore(truststore);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   648
	    }
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   649
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   650
	    Map<String, Object> env = new HashMap<String, Object>();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   651
	    env.put(RadConnector.KEY_TLS_TRUSTSTORE,
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   652
		truststore.getAbsolutePath());
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   653
	    env.put(RadConnector.KEY_TLS_TRUSTPASS,
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   654
		getTrustStorePassword());
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   655
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   656
	    JMXServiceURL url = new JMXServiceURL(
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   657
		"service:jmx:" + RadConnector.PROTOCOL_TLS + "://" + host);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   658
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   659
	    // Throws MalformedURLException
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   660
	    connector = JMXConnectorFactory.newJMXConnector(url, null);
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   661
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   662
	    for (;;) {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   663
		RadTrustManager mtm = new RadTrustManager();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   664
		env.put(RadConnector.KEY_TLS_RADMANAGER, mtm);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   665
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   666
		try {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   667
		    connector.connect(env);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   668
		    break;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   669
		} catch (IOException e) {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   670
		    X509Certificate[] chain = mtm.getBadChain();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   671
		    if (chain == null) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   672
			throw e;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   673
		    }
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   674
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   675
		    if (!handleCertFailure(host, truststore, chain[0])) {
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   676
			throw e;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   677
		    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   678
		}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   679
	    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   680
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   681
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   682
	return new ConnectorData(connector, isLocal);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   683
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   684
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   685
    private ConnectorData createConnection(LoginRequest request)
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   686
	throws ActionAbortedException {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   687
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   688
	ConnectorData data = null;
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   689
	StringLoginProperty host = request.getHost();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   690
	String hostVal = host.getValue();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   691
	List<DialogMessage> messages = request.getMessages();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   692
	boolean success = false;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   693
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   694
	try {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   695
	    data = createConnection(hostVal);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   696
	    success = true;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   697
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   698
	// Thrown by JMXConnector.connect
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   699
	} catch (UnknownHostException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   700
	    messages.add(new DialogMessage(Finder.getString(
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   701
		"login.err.host.unknown", hostVal), JOptionPane.ERROR_MESSAGE));
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   702
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   703
	// Thrown by JMXConnector.connect
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   704
	} catch (ConnectException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   705
	    messages.add(new DialogMessage(Finder.getString(
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   706
		"login.err.host.refused", hostVal), JOptionPane.ERROR_MESSAGE));
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   707
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   708
	// Thrown by JMXConnector.connect()
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   709
	} catch (SecurityException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   710
	    messages.add(new DialogMessage(Finder.getString(
481
e35a695aa20c 15629 cryptic message when logging in with root user when root is a role (client)
Stephen Talley <stephen.talley@oracle.com>
parents: 478
diff changeset
   711
		"login.err.security", hostVal),
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   712
		JOptionPane.ERROR_MESSAGE));
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   713
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   714
	// Thrown by createTrustStore
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   715
	} catch (KeyStoreException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   716
	    messages.add(new DialogMessage(Finder.getString(
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   717
		"login.err.keystore", e.getMessage()),
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   718
		JOptionPane.ERROR_MESSAGE));
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   719
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   720
	// Thrown by createTrustStore
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   721
	} catch (NoSuchAlgorithmException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   722
	    messages.add(new DialogMessage(Finder.getString(
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   723
		"login.err.keystore", e.getMessage()),
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   724
		JOptionPane.ERROR_MESSAGE));
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   725
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   726
	// Thrown by getDaemonCertificateChain
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   727
	} catch (CertificateException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   728
	    messages.add(new DialogMessage(Finder.getString(
481
e35a695aa20c 15629 cryptic message when logging in with root user when root is a role (client)
Stephen Talley <stephen.talley@oracle.com>
parents: 478
diff changeset
   729
		"login.err.nocerts", hostVal),
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   730
		JOptionPane.ERROR_MESSAGE));
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   731
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   732
	// Thrown by new JMXServiceURL
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   733
	} catch (MalformedURLException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   734
	    messages.add(new DialogMessage(Finder.getString(
481
e35a695aa20c 15629 cryptic message when logging in with root user when root is a role (client)
Stephen Talley <stephen.talley@oracle.com>
parents: 478
diff changeset
   735
		"login.err.url.invalid"),
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   736
		JOptionPane.ERROR_MESSAGE));
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   737
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   738
	// Thrown by JMXConnector.connect et al
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   739
	} catch (IOException e) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   740
	    messages.add(new DialogMessage(Finder.getString(
481
e35a695aa20c 15629 cryptic message when logging in with root user when root is a role (client)
Stephen Talley <stephen.talley@oracle.com>
parents: 478
diff changeset
   741
		"login.err.io", hostVal),
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   742
		JOptionPane.ERROR_MESSAGE));
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   743
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   744
	} finally {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   745
	    if (!success) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   746
		host.setErrored(true);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   747
	    }
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   748
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   749
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   750
	return data;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   751
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   752
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   753
    private void gatherHostAndUserData(LoginRequest request, LoginData data)
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   754
	throws ActionAbortedException, ActionFailedException {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   755
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   756
	StringLoginProperty host = request.getHost();
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   757
	StringLoginProperty user = request.getUser();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   758
	List<DialogMessage> messages = request.getMessages();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   759
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   760
	// Loop until connected to host and authenticated as user
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   761
	while (true) {
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   762
	    // Refresh each iteration in case host/user.isEditableOnError
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   763
	    boolean hostEditable = host.isEditable();
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   764
	    boolean userEditable = user.isEditable();
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   765
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   766
	    // If host or user is in error, and cannot be fixed by the user...
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   767
	    if (!hostEditable && (host.isErrored() ||
615
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   768
		(!userEditable && user.isErrored()))) {
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   769
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   770
		promptForFailedRequest(request);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   771
		throw new ActionFailedException(
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   772
		    messages.isEmpty() ? null : messages.get(0).getText());
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   773
	    }
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   774
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   775
	    if (hostEditable || userEditable || !messages.isEmpty()) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   776
		promptForHostAndUser(request);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   777
		data.setUserAcknowledged(true);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   778
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   779
		// User only needs to see any message once, presumably
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   780
		messages.clear();
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   781
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   782
		host.setErrored(false);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   783
		user.setErrored(false);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   784
	    }
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   785
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   786
	    String hostVal = host.getValue();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   787
	    String userVal = user.getValue();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   788
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   789
	    if (hostVal == null || hostVal.isEmpty()) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   790
		messages.add(new DialogMessage(
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   791
		    Finder.getString("login.err.host.empty"),
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   792
		    JOptionPane.ERROR_MESSAGE));
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   793
		host.setErrored(true);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   794
		continue;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   795
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   796
	    } else if (userVal == null || userVal.isEmpty()) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   797
		messages.add(new DialogMessage(
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   798
		    Finder.getString("login.err.user.empty"),
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   799
		    JOptionPane.ERROR_MESSAGE));
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   800
		user.setErrored(true);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   801
		continue;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   802
	    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   803
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   804
	    // Is there an existing ConnectionInfo for this host & user?
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   805
	    ConnectionInfo info = getConnectionManager().getConnection(hostVal,
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   806
		userVal, null);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   807
	    if (info != null) {
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   808
		data.setUserConnectionInfo(info);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   809
		return;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   810
	    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   811
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   812
	    // Create connection, append to messages on error
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   813
	    ConnectorData conData = createConnection(request);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   814
	    if (conData != null) {
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   815
		info = new ConnectionInfo(hostVal, userVal, null,
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   816
		    conData.getConnector());
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   817
		data.setUserConnectionInfo(info);
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   818
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   819
		// No need to authenticate if local user on local host
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   820
		if (conData.isLocal() && userVal.equals(LOCAL_USER)) {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   821
		    return;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   822
		}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   823
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   824
		// Get/create auth bean, append to messages on error
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   825
		AuthenticatorMXBean auth = data.getAuthBean(request);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   826
		if (auth != null) {
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   827
		    try {
615
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   828
			AuthPrompter prompter = new LoginPrompter();
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   829
			do {
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   830
			    if (authConverse(request, auth, prompter, data)) {
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   831
				return;
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   832
			    }
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   833
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   834
			    // Authentication failed
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   835
			    user.setErrored(true);
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   836
615
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   837
			    // Add generic auth failure message if not already
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   838
			    // provided by server
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   839
			    if (messages.isEmpty()) {
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   840
				messages.add(new DialogMessage(Finder.getString(
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   841
				    "login.err.user.auth", hostVal, userVal),
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   842
				    JOptionPane.ERROR_MESSAGE));
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   843
			    }
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   844
615
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   845
			// No chance to edit host/user, so keep iterating here
d3970b657f35 17576 login is overly-verbose when read-only host/user fails authentication
Stephen Talley <stephen.talley@oracle.com>
parents: 601
diff changeset
   846
			} while (!host.isEditable() && !user.isEditable());
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   847
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   848
		    // Thrown by authConverse
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   849
		    } catch (ActionRegressedException e) {
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   850
			host.setErrored(false);
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   851
			user.setErrored(false);
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   852
			messages.clear();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   853
		    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   854
		}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   855
	    }
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   856
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   857
	    // Could not create/authenticate connection -- reset and try again
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   858
	    data.setUserConnectionInfo(null);
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   859
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   860
    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   861
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   862
    private void gatherRoleData(LoginRequest request, LoginData data)
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   863
	throws ActionAbortedException, ActionFailedException,
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   864
	ActionRegressedException {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   865
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   866
	StringLoginProperty host = request.getHost();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   867
	String hostVal = host.getValue();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   868
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   869
	StringLoginProperty user = request.getUser();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   870
	String userVal = user.getValue();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   871
600
c16a7e34499d 17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents: 598
diff changeset
   872
	StringLoginProperty role = request.getRole();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   873
	List<DialogMessage> messages = request.getMessages();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   874
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   875
	// Loop until no role is chosen, or chosen role is authenticated
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   876
	while (true) {
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   877
	    // Get/create auth bean, append to messages on error
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   878
	    AuthenticatorMXBean auth = data.getAuthBean(request);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   879
	    if (auth == null) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   880
		// Not likely, but handle it anyway
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   881
		promptForFailedRequest(request);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   882
		throw new ActionRegressedException();
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   883
	    }
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   884
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   885
	    // Get valid roles for this host/user
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   886
	    List<String> roles = auth.getroles();
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   887
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   888
	    String roleVal = role.getValue();
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   889
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   890
	    if (roleVal != null && !roles.contains(roleVal)) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   891
		String message = Finder.getString("login.err.role.invalid",
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   892
		    hostVal, userVal, roleVal);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   893
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   894
		messages.add(new DialogMessage(message,
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   895
		    JOptionPane.ERROR_MESSAGE));
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   896
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   897
		role.setErrored(true);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   898
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   899
		if (role.isEditable()) {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   900
		    role.setValue(null);
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   901
		} else {
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   902
		    promptForFailedRequest(request);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   903
		    throw new ActionFailedException(message);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   904
		}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   905
	    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   906
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   907
	    if ((role.isEditable() && !roles.isEmpty()) || !messages.isEmpty())
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   908
	    {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   909
		promptForRole(request, roles);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   910
		data.setRoleAcknowledged(true);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   911
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   912
		// User only needs to see any message once, presumably
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   913
		messages.clear();
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   914
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   915
		role.setErrored(false);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   916
		roleVal = role.getValue();
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   917
	    }
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   918
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   919
	    if (roleVal == null) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   920
		// No need to keep going
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   921
		return;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   922
	    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   923
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   924
	    // Search for existing connection now that roleVal is definite
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   925
	    ConnectionInfo info = getConnectionManager().getConnection(hostVal,
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   926
		userVal, roleVal);
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   927
	    if (info != null) {
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   928
		data.setRoleConnectionInfo(info);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   929
		return;
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   930
	    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   931
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   932
	    try {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   933
		byte[] token = auth.createToken();
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   934
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   935
		// Create connection, append to messages on error
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   936
		ConnectorData conData = createConnection(request);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   937
		if (conData != null) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   938
		    JMXConnector connector = conData.getConnector();
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   939
		    info = new ConnectionInfo(hostVal, userVal, roleVal,
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   940
			connector);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   941
		    data.setRoleConnectionInfo(info);
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   942
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   943
		    // Create auth bean, append to messages on error
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   944
		    auth = data.getAuthBean(request);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   945
		    if (auth != null) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   946
			auth.redeemToken(userVal, token);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   947
			if (authConverse(request, auth, new RolePrompter(),
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   948
			    data)) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   949
			    return;
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   950
			}
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   951
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   952
			// Authentication failed
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   953
			role.setErrored(true);
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   954
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   955
			// Add generic auth failure message if not already
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   956
			// provided by server
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   957
			if (messages.isEmpty()) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   958
			    messages.add(new DialogMessage(
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   959
				Finder.getString("login.err.role.auth", hostVal,
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   960
				userVal, roleVal), JOptionPane.ERROR_MESSAGE));
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   961
			}
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   962
		    }
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   963
		}
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   964
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   965
	    // Thrown by createToken/redeemToken
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   966
	    } catch (ObjectException e) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   967
		messages.add(new DialogMessage(Finder.getString(
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   968
		    "login.err.io", hostVal), JOptionPane.ERROR_MESSAGE));
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   969
601
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   970
	    // Thrown by authConverse
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   971
	    } catch (ActionRegressedException e) {
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   972
		host.setErrored(false);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   973
		user.setErrored(false);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   974
		role.setErrored(false);
9d4e3e0ee603 7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents: 600
diff changeset
   975
		messages.clear();
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   976
	    }
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 468
diff changeset
   977
478
2aa1b1c14fb7 15505 role-based connections should hold a lock on the core user connection
Stephen Talley <stephen.talley@oracle.com>
parents: 474
diff changeset
   978
	    // Could not create/authenticate connection -- reset and try again
487
09d92217e10c 15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents: 481
diff changeset
   979
	    data.setRoleConnectionInfo(null);
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   980
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   981
    }
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents:
diff changeset
   982
}