Example #1
0
 /**
  * Checks that there are enough security permissions to make popup "always on top", which allows
  * to show it above the task bar.
  */
 static boolean canPopupOverlapTaskBar() {
   boolean result = true;
   try {
     SecurityManager sm = System.getSecurityManager();
     if (sm != null) {
       sm.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
     }
   } catch (SecurityException se) {
     // There is no permission to show popups over the task bar
     result = false;
   }
   return result;
 }
Example #2
0
 public static boolean checkSecurity() {
   SecurityManager security = System.getSecurityManager();
   if (security != null) {
     try {
       security.checkPropertyAccess("user.dir");
       security.checkPropertyAccess("file.separator");
     } catch (SecurityException e) {
       System.out.println("SecurityManager restricts session recording.");
       return false;
     }
   }
   return true;
 }
 public void checkPermission(Permission p) {
   // liveconnect SocketPermission resolve takes
   // FOREVER (like 6 seconds) in Safari
   // Java does like 50 of these on the first JS call
   // 6*50=300 seconds!
   // Opera freaks out though if we deny resolve
   if (isActive
       && !isOpera
       && java.net.SocketPermission.class.isInstance(p)
       && p.getActions().matches(".*resolve.*")) {
     throw new SecurityException(
         "DOH: liveconnect resolve locks up Safari. Denying resolve request.");
   } else {
     oldsecurity.checkPermission(p);
   }
 }
    public boolean checkTopLevelWindow(Object window) {
      // If our users temporarily accept our cert for a session,
      // then use the same session to browse to a malicious website also using our applet,
      // that website can automatically execute the applet.
      // To resolve this issue, RobotSecurityManager overrides checkTopLevelWindow
      // to check the JVM to see if there are other instances of the applet running on different
      // domains.
      // If there are, it prompts the user to confirm that they want to run the applet before
      // continuing.

      // null is not supposed to be allowed
      // so we allow it to distinguish our security manager.
      if (window == null) {
        isActive = !isActive;
        log("Active is now " + isActive);
      }
      return window == null ? true : oldsecurity.checkTopLevelWindow(window);
    }
Example #5
0
 public void append(String text) {
   WordCheckPermission p = new WordCheckPermission(text, "insert");
   SecurityManager manager = System.getSecurityManager();
   if (manager != null) manager.checkPermission(p);
   super.append(text);
 }