001package Torello.Browser; 002 003import java.util.*; 004import javax.json.*; 005import javax.json.stream.*; 006import java.io.*; 007 008import java.lang.reflect.Method; 009import java.lang.reflect.Parameter; 010import java.util.function.Function; 011 012import Torello.Java.Additional.*; 013import Torello.Java.JSON.*; 014 015import static Torello.Java.JSON.JFlag.*; 016 017import Torello.Java.StrCmpr; 018import Torello.JavaDoc.StaticFunctional; 019import Torello.JavaDoc.JDHeaderBackgroundImg; 020import Torello.JavaDoc.Excuse; 021 022/** 023 * <SPAN CLASS=COPIEDJDK><B>Security</B></SPAN> 024 * 025 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 026 */ 027@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 028@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 029public class Security 030{ 031 // ******************************************************************************************** 032 // ******************************************************************************************** 033 // Class Header Stuff 034 // ******************************************************************************************** 035 // ******************************************************************************************** 036 037 038 // No Pubic Constructors 039 private Security () { } 040 041 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 042 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 043 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 044 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 045 046 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 047 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 048 // offically, two empty-vectors. One for String's, and the other for Classes. 049 050 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 051 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 052 053 static 054 { 055 for (Method m : Security.class.getMethods()) 056 { 057 // This doesn't work! The parameter names are all "arg0" ... "argN" 058 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 059 // 060 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 061 062 Vector<Class<?>> parameterTypesList = new Vector<>(); 063 064 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 065 066 parameterTypes.put( 067 m.getName(), 068 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 069 ); 070 } 071 } 072 073 static 074 { 075 Vector<String> v = null; 076 077 parameterNames.put("disable", EMPTY_VEC_STR); 078 079 parameterNames.put("enable", EMPTY_VEC_STR); 080 081 v = new Vector<String>(1); 082 parameterNames.put("setIgnoreCertificateErrors", v); 083 Collections.addAll(v, new String[] 084 { "ignore", }); 085 086 v = new Vector<String>(2); 087 parameterNames.put("handleCertificateError", v); 088 Collections.addAll(v, new String[] 089 { "eventId", "action", }); 090 091 v = new Vector<String>(1); 092 parameterNames.put("setOverrideCertificateErrors", v); 093 Collections.addAll(v, new String[] 094 { "override", }); 095 } 096 097 098 // ******************************************************************************************** 099 // ******************************************************************************************** 100 // Types - Static Inner Classes 101 // ******************************************************************************************** 102 // ******************************************************************************************** 103 104 // public static class CertificateId => Integer 105 106 /** 107 * A description of mixed content (HTTP resources on HTTPS pages), as defined by 108 * https://www.w3.org/TR/mixed-content/#categories 109 */ 110 public static final String[] MixedContentType = 111 { "blockable", "optionally-blockable", "none", }; 112 113 /** The security level of a page or resource. */ 114 public static final String[] SecurityState = 115 { "unknown", "neutral", "insecure", "secure", "info", "insecure-broken", }; 116 117 /** 118 * <CODE>[No Description Provided by Google]</CODE> 119 * <BR /> 120 * <BR /><B>EXPERIMENTAL</B> 121 */ 122 public static final String[] SafetyTipStatus = 123 { "badReputation", "lookalike", }; 124 125 /** 126 * The action to take when a certificate error occurs. continue will continue processing the 127 * request and cancel will cancel the request. 128 */ 129 public static final String[] CertificateErrorAction = 130 { "continue", "cancel", }; 131 132 /** 133 * Details about the security state of the page certificate. 134 * <BR /> 135 * <BR /><B>EXPERIMENTAL</B> 136 */ 137 public static class CertificateSecurityState 138 extends BaseType 139 implements java.io.Serializable 140 { 141 /** For Object Serialization. java.io.Serializable */ 142 protected static final long serialVersionUID = 1; 143 144 public boolean[] optionals() 145 { return new boolean[] { false, false, true, false, true, false, false, false, false, false, true, false, false, false, false, false, false, false, }; } 146 147 /** Protocol name (e.g. "TLS 1.2" or "QUIC"). */ 148 public final String protocol; 149 150 /** Key Exchange used by the connection, or the empty string if not applicable. */ 151 public final String keyExchange; 152 153 /** 154 * (EC)DH group used by the connection, if applicable. 155 * <BR /> 156 * <BR /><B>OPTIONAL</B> 157 */ 158 public final String keyExchangeGroup; 159 160 /** Cipher name. */ 161 public final String cipher; 162 163 /** 164 * TLS MAC. Note that AEAD ciphers do not have separate MACs. 165 * <BR /> 166 * <BR /><B>OPTIONAL</B> 167 */ 168 public final String mac; 169 170 /** Page certificate. */ 171 public final String[] certificate; 172 173 /** Certificate subject name. */ 174 public final String subjectName; 175 176 /** Name of the issuing CA. */ 177 public final String issuer; 178 179 /** Certificate valid from date. */ 180 public final Number validFrom; 181 182 /** Certificate valid to (expiration) date */ 183 public final Number validTo; 184 185 /** 186 * The highest priority network error code, if the certificate has an error. 187 * <BR /> 188 * <BR /><B>OPTIONAL</B> 189 */ 190 public final String certificateNetworkError; 191 192 /** True if the certificate uses a weak signature aglorithm. */ 193 public final boolean certificateHasWeakSignature; 194 195 /** True if the certificate has a SHA1 signature in the chain. */ 196 public final boolean certificateHasSha1Signature; 197 198 /** True if modern SSL */ 199 public final boolean modernSSL; 200 201 /** True if the connection is using an obsolete SSL protocol. */ 202 public final boolean obsoleteSslProtocol; 203 204 /** True if the connection is using an obsolete SSL key exchange. */ 205 public final boolean obsoleteSslKeyExchange; 206 207 /** True if the connection is using an obsolete SSL cipher. */ 208 public final boolean obsoleteSslCipher; 209 210 /** True if the connection is using an obsolete SSL signature. */ 211 public final boolean obsoleteSslSignature; 212 213 /** 214 * Constructor 215 * 216 * @param protocol Protocol name (e.g. "TLS 1.2" or "QUIC"). 217 * 218 * @param keyExchange Key Exchange used by the connection, or the empty string if not applicable. 219 * 220 * @param keyExchangeGroup (EC)DH group used by the connection, if applicable. 221 * <BR /><B>OPTIONAL</B> 222 * 223 * @param cipher Cipher name. 224 * 225 * @param mac TLS MAC. Note that AEAD ciphers do not have separate MACs. 226 * <BR /><B>OPTIONAL</B> 227 * 228 * @param certificate Page certificate. 229 * 230 * @param subjectName Certificate subject name. 231 * 232 * @param issuer Name of the issuing CA. 233 * 234 * @param validFrom Certificate valid from date. 235 * 236 * @param validTo Certificate valid to (expiration) date 237 * 238 * @param certificateNetworkError The highest priority network error code, if the certificate has an error. 239 * <BR /><B>OPTIONAL</B> 240 * 241 * @param certificateHasWeakSignature True if the certificate uses a weak signature aglorithm. 242 * 243 * @param certificateHasSha1Signature True if the certificate has a SHA1 signature in the chain. 244 * 245 * @param modernSSL True if modern SSL 246 * 247 * @param obsoleteSslProtocol True if the connection is using an obsolete SSL protocol. 248 * 249 * @param obsoleteSslKeyExchange True if the connection is using an obsolete SSL key exchange. 250 * 251 * @param obsoleteSslCipher True if the connection is using an obsolete SSL cipher. 252 * 253 * @param obsoleteSslSignature True if the connection is using an obsolete SSL signature. 254 */ 255 public CertificateSecurityState( 256 String protocol, String keyExchange, String keyExchangeGroup, String cipher, 257 String mac, String[] certificate, String subjectName, String issuer, 258 Number validFrom, Number validTo, String certificateNetworkError, 259 boolean certificateHasWeakSignature, boolean certificateHasSha1Signature, 260 boolean modernSSL, boolean obsoleteSslProtocol, boolean obsoleteSslKeyExchange, 261 boolean obsoleteSslCipher, boolean obsoleteSslSignature 262 ) 263 { 264 // Exception-Check(s) to ensure that if any parameters which are not declared as 265 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 266 267 if (protocol == null) THROWS.throwNPE("protocol"); 268 if (keyExchange == null) THROWS.throwNPE("keyExchange"); 269 if (cipher == null) THROWS.throwNPE("cipher"); 270 if (certificate == null) THROWS.throwNPE("certificate"); 271 if (subjectName == null) THROWS.throwNPE("subjectName"); 272 if (issuer == null) THROWS.throwNPE("issuer"); 273 if (validFrom == null) THROWS.throwNPE("validFrom"); 274 if (validTo == null) THROWS.throwNPE("validTo"); 275 276 this.protocol = protocol; 277 this.keyExchange = keyExchange; 278 this.keyExchangeGroup = keyExchangeGroup; 279 this.cipher = cipher; 280 this.mac = mac; 281 this.certificate = certificate; 282 this.subjectName = subjectName; 283 this.issuer = issuer; 284 this.validFrom = validFrom; 285 this.validTo = validTo; 286 this.certificateNetworkError = certificateNetworkError; 287 this.certificateHasWeakSignature = certificateHasWeakSignature; 288 this.certificateHasSha1Signature = certificateHasSha1Signature; 289 this.modernSSL = modernSSL; 290 this.obsoleteSslProtocol = obsoleteSslProtocol; 291 this.obsoleteSslKeyExchange = obsoleteSslKeyExchange; 292 this.obsoleteSslCipher = obsoleteSslCipher; 293 this.obsoleteSslSignature = obsoleteSslSignature; 294 } 295 296 /** 297 * JSON Object Constructor 298 * @param jo A Json-Object having data about an instance of {@code 'CertificateSecurityState'}. 299 */ 300 public CertificateSecurityState (JsonObject jo) 301 { 302 this.protocol = ReadJSON.getString(jo, "protocol", false, true); 303 this.keyExchange = ReadJSON.getString(jo, "keyExchange", false, true); 304 this.keyExchangeGroup = ReadJSON.getString(jo, "keyExchangeGroup", true, false); 305 this.cipher = ReadJSON.getString(jo, "cipher", false, true); 306 this.mac = ReadJSON.getString(jo, "mac", true, false); 307 this.certificate = (jo.getJsonArray("certificate") == null) 308 ? null 309 : RJArrIntoStream.strArr(jo.getJsonArray("certificate"), null, 0).toArray(String[]::new); 310 311 this.subjectName = ReadJSON.getString(jo, "subjectName", false, true); 312 this.issuer = ReadJSON.getString(jo, "issuer", false, true); 313 this.validFrom = ReadNumberJSON.get(jo, "validFrom", false, true); 314 this.validTo = ReadNumberJSON.get(jo, "validTo", false, true); 315 this.certificateNetworkError = ReadJSON.getString(jo, "certificateNetworkError", true, false); 316 this.certificateHasWeakSignature = ReadPrimJSON.getBoolean(jo, "certificateHasWeakSignature"); 317 this.certificateHasSha1Signature = ReadPrimJSON.getBoolean(jo, "certificateHasSha1Signature"); 318 this.modernSSL = ReadPrimJSON.getBoolean(jo, "modernSSL"); 319 this.obsoleteSslProtocol = ReadPrimJSON.getBoolean(jo, "obsoleteSslProtocol"); 320 this.obsoleteSslKeyExchange = ReadPrimJSON.getBoolean(jo, "obsoleteSslKeyExchange"); 321 this.obsoleteSslCipher = ReadPrimJSON.getBoolean(jo, "obsoleteSslCipher"); 322 this.obsoleteSslSignature = ReadPrimJSON.getBoolean(jo, "obsoleteSslSignature"); 323 } 324 325 326 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 327 public boolean equals(Object other) 328 { 329 if (this == other) return true; 330 if (other == null) return false; 331 if (other.getClass() != this.getClass()) return false; 332 333 CertificateSecurityState o = (CertificateSecurityState) other; 334 335 return 336 Objects.equals(this.protocol, o.protocol) 337 && Objects.equals(this.keyExchange, o.keyExchange) 338 && Objects.equals(this.keyExchangeGroup, o.keyExchangeGroup) 339 && Objects.equals(this.cipher, o.cipher) 340 && Objects.equals(this.mac, o.mac) 341 && Arrays.deepEquals(this.certificate, o.certificate) 342 && Objects.equals(this.subjectName, o.subjectName) 343 && Objects.equals(this.issuer, o.issuer) 344 && Objects.equals(this.validFrom, o.validFrom) 345 && Objects.equals(this.validTo, o.validTo) 346 && Objects.equals(this.certificateNetworkError, o.certificateNetworkError) 347 && (this.certificateHasWeakSignature == o.certificateHasWeakSignature) 348 && (this.certificateHasSha1Signature == o.certificateHasSha1Signature) 349 && (this.modernSSL == o.modernSSL) 350 && (this.obsoleteSslProtocol == o.obsoleteSslProtocol) 351 && (this.obsoleteSslKeyExchange == o.obsoleteSslKeyExchange) 352 && (this.obsoleteSslCipher == o.obsoleteSslCipher) 353 && (this.obsoleteSslSignature == o.obsoleteSslSignature); 354 } 355 356 /** Generates a Hash-Code for {@code 'this'} instance */ 357 public int hashCode() 358 { 359 return 360 Objects.hashCode(this.protocol) 361 + Objects.hashCode(this.keyExchange) 362 + Objects.hashCode(this.keyExchangeGroup) 363 + Objects.hashCode(this.cipher) 364 + Objects.hashCode(this.mac) 365 + Arrays.deepHashCode(this.certificate) 366 + Objects.hashCode(this.subjectName) 367 + Objects.hashCode(this.issuer) 368 + Objects.hashCode(this.validFrom) 369 + Objects.hashCode(this.validTo) 370 + Objects.hashCode(this.certificateNetworkError) 371 + (this.certificateHasWeakSignature ? 1 : 0) 372 + (this.certificateHasSha1Signature ? 1 : 0) 373 + (this.modernSSL ? 1 : 0) 374 + (this.obsoleteSslProtocol ? 1 : 0) 375 + (this.obsoleteSslKeyExchange ? 1 : 0) 376 + (this.obsoleteSslCipher ? 1 : 0) 377 + (this.obsoleteSslSignature ? 1 : 0); 378 } 379 } 380 381 /** 382 * <CODE>[No Description Provided by Google]</CODE> 383 * <BR /> 384 * <BR /><B>EXPERIMENTAL</B> 385 */ 386 public static class SafetyTipInfo 387 extends BaseType 388 implements java.io.Serializable 389 { 390 /** For Object Serialization. java.io.Serializable */ 391 protected static final long serialVersionUID = 1; 392 393 public boolean[] optionals() 394 { return new boolean[] { false, true, }; } 395 396 /** Describes whether the page triggers any safety tips or reputation warnings. Default is unknown. */ 397 public final String safetyTipStatus; 398 399 /** 400 * The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches. 401 * <BR /> 402 * <BR /><B>OPTIONAL</B> 403 */ 404 public final String safeUrl; 405 406 /** 407 * Constructor 408 * 409 * @param safetyTipStatus Describes whether the page triggers any safety tips or reputation warnings. Default is unknown. 410 * 411 * @param safeUrl The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches. 412 * <BR /><B>OPTIONAL</B> 413 */ 414 public SafetyTipInfo(String safetyTipStatus, String safeUrl) 415 { 416 // Exception-Check(s) to ensure that if any parameters which are not declared as 417 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 418 419 if (safetyTipStatus == null) THROWS.throwNPE("safetyTipStatus"); 420 421 // Exception-Check(s) to ensure that if any parameters which must adhere to a 422 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 423 424 THROWS.checkIAE("safetyTipStatus", safetyTipStatus, "Security.SafetyTipStatus", Security.SafetyTipStatus); 425 426 this.safetyTipStatus = safetyTipStatus; 427 this.safeUrl = safeUrl; 428 } 429 430 /** 431 * JSON Object Constructor 432 * @param jo A Json-Object having data about an instance of {@code 'SafetyTipInfo'}. 433 */ 434 public SafetyTipInfo (JsonObject jo) 435 { 436 this.safetyTipStatus = ReadJSON.getString(jo, "safetyTipStatus", false, true); 437 this.safeUrl = ReadJSON.getString(jo, "safeUrl", true, false); 438 } 439 440 441 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 442 public boolean equals(Object other) 443 { 444 if (this == other) return true; 445 if (other == null) return false; 446 if (other.getClass() != this.getClass()) return false; 447 448 SafetyTipInfo o = (SafetyTipInfo) other; 449 450 return 451 Objects.equals(this.safetyTipStatus, o.safetyTipStatus) 452 && Objects.equals(this.safeUrl, o.safeUrl); 453 } 454 455 /** Generates a Hash-Code for {@code 'this'} instance */ 456 public int hashCode() 457 { 458 return 459 Objects.hashCode(this.safetyTipStatus) 460 + Objects.hashCode(this.safeUrl); 461 } 462 } 463 464 /** 465 * Security state information about the page. 466 * <BR /> 467 * <BR /><B>EXPERIMENTAL</B> 468 */ 469 public static class VisibleSecurityState 470 extends BaseType 471 implements java.io.Serializable 472 { 473 /** For Object Serialization. java.io.Serializable */ 474 protected static final long serialVersionUID = 1; 475 476 public boolean[] optionals() 477 { return new boolean[] { false, true, true, false, }; } 478 479 /** The security level of the page. */ 480 public final String securityState; 481 482 /** 483 * Security state details about the page certificate. 484 * <BR /> 485 * <BR /><B>OPTIONAL</B> 486 */ 487 public final Security.CertificateSecurityState certificateSecurityState; 488 489 /** 490 * The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown. 491 * <BR /> 492 * <BR /><B>OPTIONAL</B> 493 */ 494 public final Security.SafetyTipInfo safetyTipInfo; 495 496 /** Array of security state issues ids. */ 497 public final String[] securityStateIssueIds; 498 499 /** 500 * Constructor 501 * 502 * @param securityState The security level of the page. 503 * 504 * @param certificateSecurityState Security state details about the page certificate. 505 * <BR /><B>OPTIONAL</B> 506 * 507 * @param safetyTipInfo The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown. 508 * <BR /><B>OPTIONAL</B> 509 * 510 * @param securityStateIssueIds Array of security state issues ids. 511 */ 512 public VisibleSecurityState( 513 String securityState, Security.CertificateSecurityState certificateSecurityState, 514 Security.SafetyTipInfo safetyTipInfo, String[] securityStateIssueIds 515 ) 516 { 517 // Exception-Check(s) to ensure that if any parameters which are not declared as 518 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 519 520 if (securityState == null) THROWS.throwNPE("securityState"); 521 if (securityStateIssueIds == null) THROWS.throwNPE("securityStateIssueIds"); 522 523 // Exception-Check(s) to ensure that if any parameters which must adhere to a 524 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 525 526 THROWS.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 527 528 this.securityState = securityState; 529 this.certificateSecurityState = certificateSecurityState; 530 this.safetyTipInfo = safetyTipInfo; 531 this.securityStateIssueIds = securityStateIssueIds; 532 } 533 534 /** 535 * JSON Object Constructor 536 * @param jo A Json-Object having data about an instance of {@code 'VisibleSecurityState'}. 537 */ 538 public VisibleSecurityState (JsonObject jo) 539 { 540 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 541 this.certificateSecurityState = ReadJSON.getObject(jo, "certificateSecurityState", Security.CertificateSecurityState.class, true, false); 542 this.safetyTipInfo = ReadJSON.getObject(jo, "safetyTipInfo", Security.SafetyTipInfo.class, true, false); 543 this.securityStateIssueIds = (jo.getJsonArray("securityStateIssueIds") == null) 544 ? null 545 : RJArrIntoStream.strArr(jo.getJsonArray("securityStateIssueIds"), null, 0).toArray(String[]::new); 546 547 } 548 549 550 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 551 public boolean equals(Object other) 552 { 553 if (this == other) return true; 554 if (other == null) return false; 555 if (other.getClass() != this.getClass()) return false; 556 557 VisibleSecurityState o = (VisibleSecurityState) other; 558 559 return 560 Objects.equals(this.securityState, o.securityState) 561 && Objects.equals(this.certificateSecurityState, o.certificateSecurityState) 562 && Objects.equals(this.safetyTipInfo, o.safetyTipInfo) 563 && Arrays.deepEquals(this.securityStateIssueIds, o.securityStateIssueIds); 564 } 565 566 /** Generates a Hash-Code for {@code 'this'} instance */ 567 public int hashCode() 568 { 569 return 570 Objects.hashCode(this.securityState) 571 + this.certificateSecurityState.hashCode() 572 + this.safetyTipInfo.hashCode() 573 + Arrays.deepHashCode(this.securityStateIssueIds); 574 } 575 } 576 577 /** An explanation of an factor contributing to the security state. */ 578 public static class SecurityStateExplanation 579 extends BaseType 580 implements java.io.Serializable 581 { 582 /** For Object Serialization. java.io.Serializable */ 583 protected static final long serialVersionUID = 1; 584 585 public boolean[] optionals() 586 { return new boolean[] { false, false, false, false, false, false, true, }; } 587 588 /** Security state representing the severity of the factor being explained. */ 589 public final String securityState; 590 591 /** Title describing the type of factor. */ 592 public final String title; 593 594 /** Short phrase describing the type of factor. */ 595 public final String summary; 596 597 /** Full text explanation of the factor. */ 598 public final String description; 599 600 /** The type of mixed content described by the explanation. */ 601 public final String mixedContentType; 602 603 /** Page certificate. */ 604 public final String[] certificate; 605 606 /** 607 * Recommendations to fix any issues. 608 * <BR /> 609 * <BR /><B>OPTIONAL</B> 610 */ 611 public final String[] recommendations; 612 613 /** 614 * Constructor 615 * 616 * @param securityState Security state representing the severity of the factor being explained. 617 * 618 * @param title Title describing the type of factor. 619 * 620 * @param summary Short phrase describing the type of factor. 621 * 622 * @param description Full text explanation of the factor. 623 * 624 * @param mixedContentType The type of mixed content described by the explanation. 625 * 626 * @param certificate Page certificate. 627 * 628 * @param recommendations Recommendations to fix any issues. 629 * <BR /><B>OPTIONAL</B> 630 */ 631 public SecurityStateExplanation( 632 String securityState, String title, String summary, String description, 633 String mixedContentType, String[] certificate, String[] recommendations 634 ) 635 { 636 // Exception-Check(s) to ensure that if any parameters which are not declared as 637 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 638 639 if (securityState == null) THROWS.throwNPE("securityState"); 640 if (title == null) THROWS.throwNPE("title"); 641 if (summary == null) THROWS.throwNPE("summary"); 642 if (description == null) THROWS.throwNPE("description"); 643 if (mixedContentType == null) THROWS.throwNPE("mixedContentType"); 644 if (certificate == null) THROWS.throwNPE("certificate"); 645 646 // Exception-Check(s) to ensure that if any parameters which must adhere to a 647 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 648 649 THROWS.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 650 THROWS.checkIAE("mixedContentType", mixedContentType, "Security.MixedContentType", Security.MixedContentType); 651 652 this.securityState = securityState; 653 this.title = title; 654 this.summary = summary; 655 this.description = description; 656 this.mixedContentType = mixedContentType; 657 this.certificate = certificate; 658 this.recommendations = recommendations; 659 } 660 661 /** 662 * JSON Object Constructor 663 * @param jo A Json-Object having data about an instance of {@code 'SecurityStateExplanation'}. 664 */ 665 public SecurityStateExplanation (JsonObject jo) 666 { 667 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 668 this.title = ReadJSON.getString(jo, "title", false, true); 669 this.summary = ReadJSON.getString(jo, "summary", false, true); 670 this.description = ReadJSON.getString(jo, "description", false, true); 671 this.mixedContentType = ReadJSON.getString(jo, "mixedContentType", false, true); 672 this.certificate = (jo.getJsonArray("certificate") == null) 673 ? null 674 : RJArrIntoStream.strArr(jo.getJsonArray("certificate"), null, 0).toArray(String[]::new); 675 676 this.recommendations = (jo.getJsonArray("recommendations") == null) 677 ? null 678 : RJArrIntoStream.strArr(jo.getJsonArray("recommendations"), null, 0).toArray(String[]::new); 679 680 } 681 682 683 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 684 public boolean equals(Object other) 685 { 686 if (this == other) return true; 687 if (other == null) return false; 688 if (other.getClass() != this.getClass()) return false; 689 690 SecurityStateExplanation o = (SecurityStateExplanation) other; 691 692 return 693 Objects.equals(this.securityState, o.securityState) 694 && Objects.equals(this.title, o.title) 695 && Objects.equals(this.summary, o.summary) 696 && Objects.equals(this.description, o.description) 697 && Objects.equals(this.mixedContentType, o.mixedContentType) 698 && Arrays.deepEquals(this.certificate, o.certificate) 699 && Arrays.deepEquals(this.recommendations, o.recommendations); 700 } 701 702 /** Generates a Hash-Code for {@code 'this'} instance */ 703 public int hashCode() 704 { 705 return 706 Objects.hashCode(this.securityState) 707 + Objects.hashCode(this.title) 708 + Objects.hashCode(this.summary) 709 + Objects.hashCode(this.description) 710 + Objects.hashCode(this.mixedContentType) 711 + Arrays.deepHashCode(this.certificate) 712 + Arrays.deepHashCode(this.recommendations); 713 } 714 } 715 716 /** 717 * Information about insecure content on the page. 718 * <BR /> 719 * <BR /><B>DEPRECATED</B> 720 */ 721 public static class InsecureContentStatus 722 extends BaseType 723 implements java.io.Serializable 724 { 725 /** For Object Serialization. java.io.Serializable */ 726 protected static final long serialVersionUID = 1; 727 728 public boolean[] optionals() 729 { return new boolean[] { false, false, false, false, false, false, false, }; } 730 731 /** Always false. */ 732 public final boolean ranMixedContent; 733 734 /** Always false. */ 735 public final boolean displayedMixedContent; 736 737 /** Always false. */ 738 public final boolean containedMixedForm; 739 740 /** Always false. */ 741 public final boolean ranContentWithCertErrors; 742 743 /** Always false. */ 744 public final boolean displayedContentWithCertErrors; 745 746 /** Always set to unknown. */ 747 public final String ranInsecureContentStyle; 748 749 /** Always set to unknown. */ 750 public final String displayedInsecureContentStyle; 751 752 /** 753 * Constructor 754 * 755 * @param ranMixedContent Always false. 756 * 757 * @param displayedMixedContent Always false. 758 * 759 * @param containedMixedForm Always false. 760 * 761 * @param ranContentWithCertErrors Always false. 762 * 763 * @param displayedContentWithCertErrors Always false. 764 * 765 * @param ranInsecureContentStyle Always set to unknown. 766 * 767 * @param displayedInsecureContentStyle Always set to unknown. 768 */ 769 public InsecureContentStatus( 770 boolean ranMixedContent, boolean displayedMixedContent, boolean containedMixedForm, 771 boolean ranContentWithCertErrors, boolean displayedContentWithCertErrors, 772 String ranInsecureContentStyle, String displayedInsecureContentStyle 773 ) 774 { 775 // Exception-Check(s) to ensure that if any parameters which are not declared as 776 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 777 778 if (ranInsecureContentStyle == null) THROWS.throwNPE("ranInsecureContentStyle"); 779 if (displayedInsecureContentStyle == null) THROWS.throwNPE("displayedInsecureContentStyle"); 780 781 // Exception-Check(s) to ensure that if any parameters which must adhere to a 782 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 783 784 THROWS.checkIAE("ranInsecureContentStyle", ranInsecureContentStyle, "Security.SecurityState", Security.SecurityState); 785 THROWS.checkIAE("displayedInsecureContentStyle", displayedInsecureContentStyle, "Security.SecurityState", Security.SecurityState); 786 787 this.ranMixedContent = ranMixedContent; 788 this.displayedMixedContent = displayedMixedContent; 789 this.containedMixedForm = containedMixedForm; 790 this.ranContentWithCertErrors = ranContentWithCertErrors; 791 this.displayedContentWithCertErrors = displayedContentWithCertErrors; 792 this.ranInsecureContentStyle = ranInsecureContentStyle; 793 this.displayedInsecureContentStyle = displayedInsecureContentStyle; 794 } 795 796 /** 797 * JSON Object Constructor 798 * @param jo A Json-Object having data about an instance of {@code 'InsecureContentStatus'}. 799 */ 800 public InsecureContentStatus (JsonObject jo) 801 { 802 this.ranMixedContent = ReadPrimJSON.getBoolean(jo, "ranMixedContent"); 803 this.displayedMixedContent = ReadPrimJSON.getBoolean(jo, "displayedMixedContent"); 804 this.containedMixedForm = ReadPrimJSON.getBoolean(jo, "containedMixedForm"); 805 this.ranContentWithCertErrors = ReadPrimJSON.getBoolean(jo, "ranContentWithCertErrors"); 806 this.displayedContentWithCertErrors = ReadPrimJSON.getBoolean(jo, "displayedContentWithCertErrors"); 807 this.ranInsecureContentStyle = ReadJSON.getString(jo, "ranInsecureContentStyle", false, true); 808 this.displayedInsecureContentStyle = ReadJSON.getString(jo, "displayedInsecureContentStyle", false, true); 809 } 810 811 812 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 813 public boolean equals(Object other) 814 { 815 if (this == other) return true; 816 if (other == null) return false; 817 if (other.getClass() != this.getClass()) return false; 818 819 InsecureContentStatus o = (InsecureContentStatus) other; 820 821 return 822 (this.ranMixedContent == o.ranMixedContent) 823 && (this.displayedMixedContent == o.displayedMixedContent) 824 && (this.containedMixedForm == o.containedMixedForm) 825 && (this.ranContentWithCertErrors == o.ranContentWithCertErrors) 826 && (this.displayedContentWithCertErrors == o.displayedContentWithCertErrors) 827 && Objects.equals(this.ranInsecureContentStyle, o.ranInsecureContentStyle) 828 && Objects.equals(this.displayedInsecureContentStyle, o.displayedInsecureContentStyle); 829 } 830 831 /** Generates a Hash-Code for {@code 'this'} instance */ 832 public int hashCode() 833 { 834 return 835 (this.ranMixedContent ? 1 : 0) 836 + (this.displayedMixedContent ? 1 : 0) 837 + (this.containedMixedForm ? 1 : 0) 838 + (this.ranContentWithCertErrors ? 1 : 0) 839 + (this.displayedContentWithCertErrors ? 1 : 0) 840 + Objects.hashCode(this.ranInsecureContentStyle) 841 + Objects.hashCode(this.displayedInsecureContentStyle); 842 } 843 } 844 845 /** 846 * There is a certificate error. If overriding certificate errors is enabled, then it should be 847 * handled with the <CODE>handleCertificateError</CODE> command. Note: this event does not fire if the 848 * certificate error has been allowed internally. Only one client per target should override 849 * certificate errors at the same time. 850 * <BR /> 851 * <BR /><B>DEPRECATED</B> 852 */ 853 public static class certificateError 854 extends BrowserEvent 855 implements java.io.Serializable 856 { 857 /** For Object Serialization. java.io.Serializable */ 858 protected static final long serialVersionUID = 1; 859 860 public boolean[] optionals() 861 { return new boolean[] { false, false, false, }; } 862 863 /** The ID of the event. */ 864 public final int eventId; 865 866 /** The type of the error. */ 867 public final String errorType; 868 869 /** The url that was requested. */ 870 public final String requestURL; 871 872 /** 873 * Constructor 874 * 875 * @param eventId The ID of the event. 876 * 877 * @param errorType The type of the error. 878 * 879 * @param requestURL The url that was requested. 880 */ 881 public certificateError(int eventId, String errorType, String requestURL) 882 { 883 super("Security", "certificateError", 3); 884 885 // Exception-Check(s) to ensure that if any parameters which are not declared as 886 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 887 888 if (errorType == null) THROWS.throwNPE("errorType"); 889 if (requestURL == null) THROWS.throwNPE("requestURL"); 890 891 this.eventId = eventId; 892 this.errorType = errorType; 893 this.requestURL = requestURL; 894 } 895 896 /** 897 * JSON Object Constructor 898 * @param jo A Json-Object having data about an instance of {@code 'certificateError'}. 899 */ 900 public certificateError (JsonObject jo) 901 { 902 super("Security", "certificateError", 3); 903 904 this.eventId = ReadPrimJSON.getInt(jo, "eventId"); 905 this.errorType = ReadJSON.getString(jo, "errorType", false, true); 906 this.requestURL = ReadJSON.getString(jo, "requestURL", false, true); 907 } 908 909 910 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 911 public boolean equals(Object other) 912 { 913 if (this == other) return true; 914 if (other == null) return false; 915 if (other.getClass() != this.getClass()) return false; 916 917 certificateError o = (certificateError) other; 918 919 return 920 (this.eventId == o.eventId) 921 && Objects.equals(this.errorType, o.errorType) 922 && Objects.equals(this.requestURL, o.requestURL); 923 } 924 925 /** Generates a Hash-Code for {@code 'this'} instance */ 926 public int hashCode() 927 { 928 return 929 this.eventId 930 + Objects.hashCode(this.errorType) 931 + Objects.hashCode(this.requestURL); 932 } 933 } 934 935 /** 936 * The security state of the page changed. 937 * <BR /> 938 * <BR /><B>EXPERIMENTAL</B> 939 */ 940 public static class visibleSecurityStateChanged 941 extends BrowserEvent 942 implements java.io.Serializable 943 { 944 /** For Object Serialization. java.io.Serializable */ 945 protected static final long serialVersionUID = 1; 946 947 public boolean[] optionals() 948 { return new boolean[] { false, }; } 949 950 /** Security state information about the page. */ 951 public final Security.VisibleSecurityState visibleSecurityState; 952 953 /** 954 * Constructor 955 * 956 * @param visibleSecurityState Security state information about the page. 957 */ 958 public visibleSecurityStateChanged(Security.VisibleSecurityState visibleSecurityState) 959 { 960 super("Security", "visibleSecurityStateChanged", 1); 961 962 // Exception-Check(s) to ensure that if any parameters which are not declared as 963 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 964 965 if (visibleSecurityState == null) THROWS.throwNPE("visibleSecurityState"); 966 967 this.visibleSecurityState = visibleSecurityState; 968 } 969 970 /** 971 * JSON Object Constructor 972 * @param jo A Json-Object having data about an instance of {@code 'visibleSecurityStateChanged'}. 973 */ 974 public visibleSecurityStateChanged (JsonObject jo) 975 { 976 super("Security", "visibleSecurityStateChanged", 1); 977 978 this.visibleSecurityState = ReadJSON.getObject(jo, "visibleSecurityState", Security.VisibleSecurityState.class, false, true); 979 } 980 981 982 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 983 public boolean equals(Object other) 984 { 985 if (this == other) return true; 986 if (other == null) return false; 987 if (other.getClass() != this.getClass()) return false; 988 989 visibleSecurityStateChanged o = (visibleSecurityStateChanged) other; 990 991 return 992 Objects.equals(this.visibleSecurityState, o.visibleSecurityState); 993 } 994 995 /** Generates a Hash-Code for {@code 'this'} instance */ 996 public int hashCode() 997 { 998 return 999 this.visibleSecurityState.hashCode(); 1000 } 1001 } 1002 1003 /** The security state of the page changed. */ 1004 public static class securityStateChanged 1005 extends BrowserEvent 1006 implements java.io.Serializable 1007 { 1008 /** For Object Serialization. java.io.Serializable */ 1009 protected static final long serialVersionUID = 1; 1010 1011 public boolean[] optionals() 1012 { return new boolean[] { false, false, false, false, true, }; } 1013 1014 /** Security state. */ 1015 public final String securityState; 1016 1017 /** 1018 * True if the page was loaded over cryptographic transport such as HTTPS. 1019 * <BR /> 1020 * <BR /><B>DEPRECATED</B> 1021 */ 1022 public final boolean schemeIsCryptographic; 1023 1024 /** 1025 * List of explanations for the security state. If the overall security state is <CODE>insecure</CODE> or 1026 * <CODE>warning</CODE>, at least one corresponding explanation should be included. 1027 */ 1028 public final Security.SecurityStateExplanation[] explanations; 1029 1030 /** 1031 * Information about insecure content on the page. 1032 * <BR /> 1033 * <BR /><B>DEPRECATED</B> 1034 */ 1035 public final Security.InsecureContentStatus insecureContentStatus; 1036 1037 /** 1038 * Overrides user-visible description of the state. 1039 * <BR /> 1040 * <BR /><B>OPTIONAL</B> 1041 */ 1042 public final String summary; 1043 1044 /** 1045 * Constructor 1046 * 1047 * @param securityState Security state. 1048 * 1049 * @param schemeIsCryptographic True if the page was loaded over cryptographic transport such as HTTPS. 1050 * <BR /><B>DEPRECATED</B> 1051 * 1052 * @param explanations 1053 * List of explanations for the security state. If the overall security state is <CODE>insecure</CODE> or 1054 * <CODE>warning</CODE>, at least one corresponding explanation should be included. 1055 * 1056 * @param insecureContentStatus Information about insecure content on the page. 1057 * <BR /><B>DEPRECATED</B> 1058 * 1059 * @param summary Overrides user-visible description of the state. 1060 * <BR /><B>OPTIONAL</B> 1061 */ 1062 public securityStateChanged( 1063 String securityState, boolean schemeIsCryptographic, 1064 Security.SecurityStateExplanation[] explanations, 1065 Security.InsecureContentStatus insecureContentStatus, String summary 1066 ) 1067 { 1068 super("Security", "securityStateChanged", 5); 1069 1070 // Exception-Check(s) to ensure that if any parameters which are not declared as 1071 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1072 1073 if (securityState == null) THROWS.throwNPE("securityState"); 1074 if (explanations == null) THROWS.throwNPE("explanations"); 1075 if (insecureContentStatus == null) THROWS.throwNPE("insecureContentStatus"); 1076 1077 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1078 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1079 1080 THROWS.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 1081 1082 this.securityState = securityState; 1083 this.schemeIsCryptographic = schemeIsCryptographic; 1084 this.explanations = explanations; 1085 this.insecureContentStatus = insecureContentStatus; 1086 this.summary = summary; 1087 } 1088 1089 /** 1090 * JSON Object Constructor 1091 * @param jo A Json-Object having data about an instance of {@code 'securityStateChanged'}. 1092 */ 1093 public securityStateChanged (JsonObject jo) 1094 { 1095 super("Security", "securityStateChanged", 5); 1096 1097 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 1098 this.schemeIsCryptographic = ReadPrimJSON.getBoolean(jo, "schemeIsCryptographic"); 1099 this.explanations = (jo.getJsonArray("explanations") == null) 1100 ? null 1101 : RJArrIntoStream.objArr(jo.getJsonArray("explanations"), null, 0, Security.SecurityStateExplanation.class).toArray(Security.SecurityStateExplanation[]::new); 1102 1103 this.insecureContentStatus = ReadJSON.getObject(jo, "insecureContentStatus", Security.InsecureContentStatus.class, false, true); 1104 this.summary = ReadJSON.getString(jo, "summary", true, false); 1105 } 1106 1107 1108 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1109 public boolean equals(Object other) 1110 { 1111 if (this == other) return true; 1112 if (other == null) return false; 1113 if (other.getClass() != this.getClass()) return false; 1114 1115 securityStateChanged o = (securityStateChanged) other; 1116 1117 return 1118 Objects.equals(this.securityState, o.securityState) 1119 && (this.schemeIsCryptographic == o.schemeIsCryptographic) 1120 && Arrays.deepEquals(this.explanations, o.explanations) 1121 && Objects.equals(this.insecureContentStatus, o.insecureContentStatus) 1122 && Objects.equals(this.summary, o.summary); 1123 } 1124 1125 /** Generates a Hash-Code for {@code 'this'} instance */ 1126 public int hashCode() 1127 { 1128 return 1129 Objects.hashCode(this.securityState) 1130 + (this.schemeIsCryptographic ? 1 : 0) 1131 + Arrays.deepHashCode(this.explanations) 1132 + this.insecureContentStatus.hashCode() 1133 + Objects.hashCode(this.summary); 1134 } 1135 } 1136 1137 1138 // Counter for keeping the WebSocket Request ID's distinct. 1139 private static int counter = 1; 1140 1141 /** 1142 * Disables tracking security state changes. 1143 * 1144 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1145 * {@link Ret0}></CODE> 1146 * 1147 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1148 * browser receives the invocation-request. 1149 * 1150 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1151 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1152 * {@code >} to ensure the Browser Function has run to completion. 1153 */ 1154 public static Script<String, JsonObject, Ret0> disable() 1155 { 1156 final int webSocketID = 35000000 + counter++; 1157 final boolean[] optionals = new boolean[0]; 1158 1159 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1160 String requestJSON = WriteJSON.get( 1161 parameterTypes.get("disable"), 1162 parameterNames.get("disable"), 1163 optionals, webSocketID, 1164 "Security.disable" 1165 ); 1166 1167 // This Remote Command does not have a Return-Value. 1168 return new Script<> 1169 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1170 } 1171 1172 /** 1173 * Enables tracking security state changes. 1174 * 1175 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1176 * {@link Ret0}></CODE> 1177 * 1178 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1179 * browser receives the invocation-request. 1180 * 1181 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1182 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1183 * {@code >} to ensure the Browser Function has run to completion. 1184 */ 1185 public static Script<String, JsonObject, Ret0> enable() 1186 { 1187 final int webSocketID = 35001000 + counter++; 1188 final boolean[] optionals = new boolean[0]; 1189 1190 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1191 String requestJSON = WriteJSON.get( 1192 parameterTypes.get("enable"), 1193 parameterNames.get("enable"), 1194 optionals, webSocketID, 1195 "Security.enable" 1196 ); 1197 1198 // This Remote Command does not have a Return-Value. 1199 return new Script<> 1200 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1201 } 1202 1203 /** 1204 * Enable/disable whether all certificate errors should be ignored. 1205 * <BR /><B>EXPERIMENTAL</B> 1206 * 1207 * @param ignore If true, all certificate errors will be ignored. 1208 * 1209 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1210 * {@link Ret0}></CODE> 1211 * 1212 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1213 * browser receives the invocation-request. 1214 * 1215 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1216 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1217 * {@code >} to ensure the Browser Function has run to completion. 1218 */ 1219 public static Script<String, JsonObject, Ret0> setIgnoreCertificateErrors(boolean ignore) 1220 { 1221 final int webSocketID = 35002000 + counter++; 1222 final boolean[] optionals = { false, }; 1223 1224 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1225 String requestJSON = WriteJSON.get( 1226 parameterTypes.get("setIgnoreCertificateErrors"), 1227 parameterNames.get("setIgnoreCertificateErrors"), 1228 optionals, webSocketID, 1229 "Security.setIgnoreCertificateErrors", 1230 ignore 1231 ); 1232 1233 // This Remote Command does not have a Return-Value. 1234 return new Script<> 1235 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1236 } 1237 1238 /** 1239 * Handles a certificate error that fired a certificateError event. 1240 * <BR /><B>DEPRECATED</B> 1241 * 1242 * @param eventId The ID of the event. 1243 * 1244 * @param action The action to take on the certificate error. 1245 * 1246 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1247 * {@link Ret0}></CODE> 1248 * 1249 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1250 * browser receives the invocation-request. 1251 * 1252 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1253 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1254 * {@code >} to ensure the Browser Function has run to completion. 1255 */ 1256 public static Script<String, JsonObject, Ret0> handleCertificateError 1257 (int eventId, String action) 1258 { 1259 // Exception-Check(s) to ensure that if any parameters which are not declared as 1260 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1261 1262 if (action == null) THROWS.throwNPE("action"); 1263 1264 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1265 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1266 1267 THROWS.checkIAE("action", action, "Security.CertificateErrorAction", Security.CertificateErrorAction); 1268 1269 final int webSocketID = 35003000 + counter++; 1270 final boolean[] optionals = { false, false, }; 1271 1272 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1273 String requestJSON = WriteJSON.get( 1274 parameterTypes.get("handleCertificateError"), 1275 parameterNames.get("handleCertificateError"), 1276 optionals, webSocketID, 1277 "Security.handleCertificateError", 1278 eventId, action 1279 ); 1280 1281 // This Remote Command does not have a Return-Value. 1282 return new Script<> 1283 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1284 } 1285 1286 /** 1287 * Enable/disable overriding certificate errors. If enabled, all certificate error events need to 1288 * be handled by the DevTools client and should be answered with <CODE>handleCertificateError</CODE> commands. 1289 * <BR /><B>DEPRECATED</B> 1290 * 1291 * @param override If true, certificate errors will be overridden. 1292 * 1293 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1294 * {@link Ret0}></CODE> 1295 * 1296 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1297 * browser receives the invocation-request. 1298 * 1299 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1300 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1301 * {@code >} to ensure the Browser Function has run to completion. 1302 */ 1303 public static Script<String, JsonObject, Ret0> setOverrideCertificateErrors 1304 (boolean override) 1305 { 1306 final int webSocketID = 35004000 + counter++; 1307 final boolean[] optionals = { false, }; 1308 1309 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1310 String requestJSON = WriteJSON.get( 1311 parameterTypes.get("setOverrideCertificateErrors"), 1312 parameterNames.get("setOverrideCertificateErrors"), 1313 optionals, webSocketID, 1314 "Security.setOverrideCertificateErrors", 1315 override 1316 ); 1317 1318 // This Remote Command does not have a Return-Value. 1319 return new Script<> 1320 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1321 } 1322 1323}