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.AppletAction`
    `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 SecurityDialogs.AppletAction` | `getIntegerResponseAsAppletAction(java.lang.Object ref)`
    `static boolean` | `getIntegerResponseAsBoolean(java.lang.Object ref)` Returns true iff the given Object reference can be cast to Integer and that Integer's intValue is 0.
    `static java.lang.Object` | `showAccessWarningDialog(SecurityDialogs.AccessType accessType, JNLPFile file, java.lang.Object[] extras)` unlike showAccessWarningDialogB this is returning raw int code
    `static boolean` | `showAccessWarningDialogB(SecurityDialogs.AccessType accessType, JNLPFile file)` Shows a warning dialog for different types of system access (i.e.
    `static boolean` | `showAccessWarningDialogB(SecurityDialogs.AccessType accessType, JNLPFile file, java.lang.Object[] extras)`
    `static net.sourceforge.jnlp.security.dialogs.AccessWarningPaneComplexReturn` | `showAccessWarningDialogComplexReturn(SecurityDialogs.AccessType accessType, JNLPFile file)`
    `static int` | `showAccessWarningDialogI(SecurityDialogs.AccessType accessType, JNLPFile file)` unlike showAccessWarningDialogB this is returning raw int code
    `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 SecurityDialogs.AppletAction` | `showCertWarningDialog(SecurityDialogs.AccessType accessType, JNLPFile file, CertVerifier certVerifier, JNLPClassLoader.SecurityDelegate securityDelegate)` Shows a security warning dialog according to the specified type of access.
    `static boolean` | `showMatchingALACAttributePanel(JNLPFile file, java.net.URL codeBase, java.util.Set<java.net.URL> remoteUrls)`
    `static boolean` | `showMissingALACAttributePanel(java.lang.String title, java.net.URL codeBase, java.util.Set<java.net.URL> remoteUrls)`
    `static boolean` | `showMissingPermissionsAttributeDialogue(java.lang.String title, java.net.URL codeBase)`
    `static net.sourceforge.jnlp.security.dialogs.apptrustwarningpanel.AppTrustWarningPanel.AppSigningWarningAction` | `showPartiallySignedWarningDialog(JNLPFile file, CertVerifier certVerifier, JNLPClassLoader.SecurityDelegate securityDelegate)` Shows a warning dialog for when an applet or application is partially signed.
    `static net.sourceforge.jnlp.security.dialogs.apptrustwarningpanel.AppTrustWarningPanel.AppSigningWarningAction` | `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

    - #### showAccessWarningDialogB

          public static boolean showAccessWarningDialogB(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.

    - #### showAccessWarningDialogB

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

    - #### showAccessWarningDialogI

          public static int showAccessWarningDialogI(SecurityDialogs.AccessType accessType,
                                     JNLPFile file)

      unlike showAccessWarningDialogB this is returning raw int code
      Parameters:
        `accessType` - type of dialogue
        `file` - file for which thsi dialogue is built for
      Returns:
        return from dialogue

    - #### showAccessWarningDialogComplexReturn

          public static net.sourceforge.jnlp.security.dialogs.AccessWarningPaneComplexReturn showAccessWarningDialogComplexReturn(SecurityDialogs.AccessType accessType,
                                                                                                                  JNLPFile file)

    - #### showAccessWarningDialog

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

      unlike showAccessWarningDialogB this is returning raw int code
      Parameters:
        `accessType` - type of dialogue
        `file` - file for which thsi dialogue is built for
        `extras` - aditional parameters to dialogue
      Returns:
        return from dialogue

    - #### showUnsignedWarningDialog

          public static net.sourceforge.jnlp.security.dialogs.apptrustwarningpanel.AppTrustWarningPanel.AppSigningWarningAction showUnsignedWarningDialog(JNLPFile file)

      Shows a warning dialog for when a plugin applet is unsigned. This is used with 'high-security' setting.
      Parameters:
        `file` - the file to be base as information source for this dialogue
      Returns:
        true if permission was granted by the user, false otherwise.

    - #### showCertWarningDialog

          public static SecurityDialogs.AppletAction showCertWarningDialog(SecurityDialogs.AccessType accessType,
                                                           JNLPFile file,
                                                           CertVerifier certVerifier,
                                                           JNLPClassLoader.SecurityDelegate securityDelegate)

      Shows a security warning dialog according to the specified type of access. If `accessType` is one of `SecurityDialogs.AccessType.VERIFIED` or `SecurityDialogs.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
        `securityDelegate` - the delegate for security atts.
      Returns:
        RUN if the user accepted the certificate, SANDBOX if the user wants the applet to run with only sandbox permissions, or CANCEL if the user did not accept running the applet

    - #### showPartiallySignedWarningDialog

          public static net.sourceforge.jnlp.security.dialogs.apptrustwarningpanel.AppTrustWarningPanel.AppSigningWarningAction showPartiallySignedWarningDialog(JNLPFile file,
                                                                                                                                                 CertVerifier certVerifier,
                                                                                                                                                 JNLPClassLoader.SecurityDelegate securityDelegate)

      Shows a warning dialog for when an applet or application is partially signed.
      Parameters:
        `file` - the JNLPFile associated with this warning
        `certVerifier` - the JarCertVerifier used to verify this application
        `securityDelegate` - the delegate for security atts.
      Returns:
        true if permission was granted by the user, false otherwise.

    - #### 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.

    - #### showMissingALACAttributePanel

          public static boolean showMissingALACAttributePanel(java.lang.String title,
                                              java.net.URL codeBase,
                                              java.util.Set<java.net.URL> remoteUrls)

    - #### showMatchingALACAttributePanel

          public static boolean showMatchingALACAttributePanel(JNLPFile file,
                                               java.net.URL codeBase,
                                               java.util.Set<java.net.URL> remoteUrls)

    - #### showAppletWarning

          public static int showAppletWarning()

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

    - #### showMissingPermissionsAttributeDialogue

          public static boolean showMissingPermissionsAttributeDialogue(java.lang.String title,
                                                        java.net.URL codeBase)

    - #### getIntegerResponseAsBoolean

          public static boolean getIntegerResponseAsBoolean(java.lang.Object ref)

      Returns true iff the given Object reference can be cast to Integer and that Integer's intValue is 0.
      Parameters:
        `ref` - the Integer (hopefully) reference
      Returns:
        whether the given reference is both an Integer type and has intValue of 0

    - #### getIntegerResponseAsAppletAction

          public static SecurityDialogs.AppletAction getIntegerResponseAsAppletAction(java.lang.Object ref)