net.sourceforge.jnlp.security

## Class SecurityDialogs

- java.lang.Object
- - net.sourceforge.jnlp.security.SecurityDialogs

-     public class SecurityDialogs
      extends java.lang.Object

  A factory for showing many possible types of security warning to the user.

  This contains all the public methods that classes outside this package should use instead of using `SecurityDialog` directly. All of these methods post a message to the `SecurityDialogMessageHandler` and block waiting for a response.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SecurityDialogs.AccessType` The types of access which may need user permission.
    `static class` | `SecurityDialogs.DialogType` Types of dialogs we can create

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SecurityDialogs()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `showAccessWarningDialog(SecurityDialogs.AccessType accessType, JNLPFile file)` Shows a warning dialog for different types of system access (i.e.
    `static boolean` | `showAccessWarningDialog(SecurityDialogs.AccessType accessType, JNLPFile file, java.lang.Object[] extras)` Shows a warning dialog for different types of system access (i.e.
    `static int` | `showAppletWarning()` FIXME This is unused.
    `static java.lang.Object[]` | `showAuthenicationPrompt(java.lang.String host, int port, java.lang.String prompt, java.lang.String type)` Present a dialog to the user asking them for authentication information, and returns the user's response.
    `static boolean` | `showCertWarningDialog(SecurityDialogs.AccessType accessType, JNLPFile file, CertVerifier certVerifier)` Shows a security warning dialog according to the specified type of access.
    `static boolean` | `showNotAllSignedWarningDialog(JNLPFile file)` Shows a warning dialog for when the main application jars are signed, but extensions aren't
    `static UnsignedAppletTrustWarningPanel.UnsignedWarningAction` | `showUnsignedWarningDialog(JNLPFile file)` Shows a warning dialog for when a plugin applet is unsigned.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SecurityDialogs

          public SecurityDialogs()

  - ### Method Detail

    - #### showAccessWarningDialog

          public static boolean showAccessWarningDialog(SecurityDialogs.AccessType accessType,
                                        JNLPFile file)

      Shows a warning dialog for different types of system access (i.e. file open/save, clipboard read/write, printing, etc).
      Parameters:
        `accessType` - the type of system access requested.
        `file` - the jnlp file associated with the requesting application.
      Returns:
        true if permission was granted by the user, false otherwise.

    - #### showAccessWarningDialog

          public static boolean showAccessWarningDialog(SecurityDialogs.AccessType accessType,
                                        JNLPFile file,
                                        java.lang.Object[] extras)

      Shows a warning dialog for different types of system access (i.e. file open/save, clipboard read/write, printing, etc).
      Parameters:
        `accessType` - the type of system access requested.
        `file` - the jnlp file associated with the requesting application.
        `extras` - an optional array of Strings (typically) that gets passed to the dialog labels.
      Returns:
        true if permission was granted by the user, false otherwise.

    - #### showNotAllSignedWarningDialog

          public static boolean showNotAllSignedWarningDialog(JNLPFile file)

      Shows a warning dialog for when the main application jars are signed, but extensions aren't
      Returns:
        true if permission was granted by the user, false otherwise.

    - #### showUnsignedWarningDialog

          public static UnsignedAppletTrustWarningPanel.UnsignedWarningAction showUnsignedWarningDialog(JNLPFile file)

      Shows a warning dialog for when a plugin applet is unsigned. This is used with 'high-security' setting.
      Returns:
        true if permission was granted by the user, false otherwise.

    - #### showCertWarningDialog

          public static boolean showCertWarningDialog(SecurityDialogs.AccessType accessType,
                                      JNLPFile file,
                                      CertVerifier certVerifier)

      Shows a security warning dialog according to the specified type of access. If `type` is one of AccessType.VERIFIED or AccessType.UNVERIFIED, extra details will be available with regards to code signing and signing certificates.
      Parameters:
        `accessType` - the type of warning dialog to show
        `file` - the JNLPFile associated with this warning
        `certVerifier` - the JarCertVerifier used to verify this application
      Returns:
        true if the user accepted the certificate

    - #### showAuthenicationPrompt

          public static java.lang.Object[] showAuthenicationPrompt(java.lang.String host,
                                                   int port,
                                                   java.lang.String prompt,
                                                   java.lang.String type)

      Present a dialog to the user asking them for authentication information, and returns the user's response. The caller must have NetPermission("requestPasswordAuthentication") for this to work.
      Parameters:
        `host` - The host for with authentication is needed
        `port` - The port being accessed
        `prompt` - The prompt (realm) as presented by the server
        `type` - The type of server (proxy/web)
      Returns:
        an array of objects representing user's authentication tokens
      Throws:
        `java.lang.SecurityException` - if the caller does not have the appropriate permissions.

    - #### showAppletWarning

          public static int showAppletWarning()

      FIXME This is unused. Remove it?
      Returns:
        (0, 1, 2) => (Yes, No, Cancel)

Submit a bug or feature