diff options
author | Omair Majid <[email protected]> | 2010-10-22 10:44:12 -0400 |
---|---|---|
committer | Omair Majid <[email protected]> | 2010-10-22 10:44:12 -0400 |
commit | 12747b34f31cfb98c057f45e8aeb1711ea7341c8 (patch) | |
tree | 45b4d70163f9f19f014017bf33d0adaf725e03a6 /netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java | |
parent | 61aeaaf89164aa93280527c7eb80cf4c1432fbee (diff) |
show security dialogs using the main AppContext
2010-10-22 Omair Majid <[email protected]>
* netx/net/sourceforge/jnlp/NetxPanel.java
(runLoader): Do not initialize JNLPRuntime here.
(createAppletThreads): Initialize JNLPRuntim here.
* netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java:
Switch from SecurityWarningDialog.AccessType to
SecurityWarning.AccessType.
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
(getInstance(JNLPFile,UpdatePolicy)): Switch to SecurityWarning.
(initializeResources): Likewise.
(checkTrustWithUser): Likewise.
* netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java:
Add securityDialogMesasgeHandler.
(initialize): Set System look and feel. Start security thread.
(startSecurityThread): New method. Starts a thread to show security
dialogs.
(getSecurityDialogHandler): Returns the securityDialogMessageHandler.
* netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java:
Switch from SecurityWarningDialog.AccessType to
SecurityWarning.AccessType.
(checkAwtEventQueueAccess): New method. Skeleton code for allowing
EventQueue acccess to applets.
* netx/net/sourceforge/jnlp/security/AccessWarningPane.java:
Switch from SecurityWarningDialog.AccessType to
SecurityWarning.AccessType.
* netx/net/sourceforge/jnlp/security/CertWarningPane.java:
Likewise.
* netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java:
Move DialogType and AccessType to SecurityWarning.
(SecurityWarningDialog(DialogType,AccessType,JNLPFile,CertVerifier,
X509Certificate,Object[])): New method. The catch-all construction.
(SecurityWarningDialog(DialogType,AccessType,JNLPFile): Delegate to
the new constructor.
(SecurityWarningDialog(DialogType,AccessType,JNLPFile,CertVerifier)):
Likewise.
(SecurityWarningDialog(DialogType,AccessType,CertVerifier)): Likewise.
(SecurityWarningDialog(DialogType,AccessType,JNLPFile,Object[])):
Likewise.
(SecurityWarningDialog(DialogType,X509Certificate)): Likewise.
(showAccessWarningDialog(AccessType,JNLPFile)): Move to SecurityWarning
class.
(showAccessWarningDialog(AccessType,JNLPFile,Object[])): Likewise.
(showNotAllSignedWarningDialog(JNLPFile)): Likewise.
(showCertWarningDialog(AccessType,JNLPFile,CertVerifier)): Likewise.
(showAppletWarning): Likewise.
(initDialog): Make dialog non modal and remove window closing listener.
(getValue): Make public.
(dispose): New method. Notify listeners.
(notifySelectionMade): New method. Notify listeners that user has made
a decision.
(addActionListener): New method. Add a listener to be notified when
user makes a decision about this security warning.
* netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java:
Switch from SecurityWarningDialog.AccessType to
SecurityWarning.AccessType.
* netx/net/sourceforge/jnlp/services/ServiceUtil.java: Likewise.
* netx/net/sourceforge/jnlp/services/XClipboardService.java: Likewise.
* netx/net/sourceforge/jnlp/services/XExtendedService.java: Likewise.
* netx/net/sourceforge/jnlp/services/XFileOpenService.java: Likewise.
* netx/net/sourceforge/jnlp/services/XFileSaveService.java: Likewise.
* netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java:
New class.
* netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java:
New class.
(run): New method. Runs the security message loop.
(handleMessage): New method. Handles a SecurityDialogMessage to show a
security warning.
(postMessage): New method. Posts a message to sthe security message
queue.
* netx/net/sourceforge/jnlp/security/SecurityWarning.java: New class.
Move AccessType and DialogType from SecurityWarningDialog to here.
(showAccessWarningDialog): Moved from SecurityWarningDialog to here.
(showAccessWarningDialog): Moved from SecurityWarningDialog to here.
Modified to post messages to the security queue instead of showing a
SecurityWarningDialog directly.
(showNotAllSignedWarningDialog): Likewise.
(showCertWarningDialog): Likewise.
(showAppletWarning): Likewise.
(getUserReponse): New method. Posts a message to the security thread and
blocks until it gets a response from the user.
Diffstat (limited to 'netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java b/netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java new file mode 100644 index 0000000..c958fff --- /dev/null +++ b/netx/net/sourceforge/jnlp/security/SecurityDialogMessage.java @@ -0,0 +1,44 @@ +package net.sourceforge.jnlp.security; + +import java.security.cert.X509Certificate; +import java.util.concurrent.Semaphore; + +import javax.swing.JDialog; + +import net.sourceforge.jnlp.JNLPFile; +import net.sourceforge.jnlp.security.SecurityWarning.AccessType; +import net.sourceforge.jnlp.security.SecurityWarning.DialogType; + +/** + * Represents a message to the security framework to show a specific security + * dialog + */ +final class SecurityDialogMessage { + + /* + * These fields contain information need to display the correct dialog type + */ + + public DialogType dialogType; + public AccessType accessType; + public JNLPFile file; + public CertVerifier certVerifier; + public X509Certificate certificate; + public Object[] extras; + + /* + * Volatile because this is shared between threads and we dont want threads + * to use a cached value of this. + */ + public volatile Object userResponse; + + /* + * These two fields are used to block/unblock the application or the applet. + * If either of them is not null, call release() or dispose() on it to allow + * the application/applet to continue. + */ + + public Semaphore lock; + public JDialog toDispose; + +} |