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) BRDPC.throwNPE("protocol"); 268 if (keyExchange == null) BRDPC.throwNPE("keyExchange"); 269 if (cipher == null) BRDPC.throwNPE("cipher"); 270 if (certificate == null) BRDPC.throwNPE("certificate"); 271 if (subjectName == null) BRDPC.throwNPE("subjectName"); 272 if (issuer == null) BRDPC.throwNPE("issuer"); 273 if (validFrom == null) BRDPC.throwNPE("validFrom"); 274 if (validTo == null) BRDPC.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 (other == null) return false; 330 if (other.getClass() != this.getClass()) return false; 331 332 CertificateSecurityState o = (CertificateSecurityState) other; 333 334 return 335 Objects.equals(this.protocol, o.protocol) 336 && Objects.equals(this.keyExchange, o.keyExchange) 337 && Objects.equals(this.keyExchangeGroup, o.keyExchangeGroup) 338 && Objects.equals(this.cipher, o.cipher) 339 && Objects.equals(this.mac, o.mac) 340 && Arrays.deepEquals(this.certificate, o.certificate) 341 && Objects.equals(this.subjectName, o.subjectName) 342 && Objects.equals(this.issuer, o.issuer) 343 && Objects.equals(this.validFrom, o.validFrom) 344 && Objects.equals(this.validTo, o.validTo) 345 && Objects.equals(this.certificateNetworkError, o.certificateNetworkError) 346 && (this.certificateHasWeakSignature == o.certificateHasWeakSignature) 347 && (this.certificateHasSha1Signature == o.certificateHasSha1Signature) 348 && (this.modernSSL == o.modernSSL) 349 && (this.obsoleteSslProtocol == o.obsoleteSslProtocol) 350 && (this.obsoleteSslKeyExchange == o.obsoleteSslKeyExchange) 351 && (this.obsoleteSslCipher == o.obsoleteSslCipher) 352 && (this.obsoleteSslSignature == o.obsoleteSslSignature); 353 } 354 355 /** Generates a Hash-Code for {@code 'this'} instance */ 356 public int hashCode() 357 { 358 return 359 Objects.hashCode(this.protocol) 360 + Objects.hashCode(this.keyExchange) 361 + Objects.hashCode(this.keyExchangeGroup) 362 + Objects.hashCode(this.cipher) 363 + Objects.hashCode(this.mac) 364 + Arrays.deepHashCode(this.certificate) 365 + Objects.hashCode(this.subjectName) 366 + Objects.hashCode(this.issuer) 367 + Objects.hashCode(this.validFrom) 368 + Objects.hashCode(this.validTo) 369 + Objects.hashCode(this.certificateNetworkError) 370 + (this.certificateHasWeakSignature ? 1 : 0) 371 + (this.certificateHasSha1Signature ? 1 : 0) 372 + (this.modernSSL ? 1 : 0) 373 + (this.obsoleteSslProtocol ? 1 : 0) 374 + (this.obsoleteSslKeyExchange ? 1 : 0) 375 + (this.obsoleteSslCipher ? 1 : 0) 376 + (this.obsoleteSslSignature ? 1 : 0); 377 } 378 } 379 380 /** 381 * <CODE>[No Description Provided by Google]</CODE> 382 * <BR /> 383 * <BR /><B>EXPERIMENTAL</B> 384 */ 385 public static class SafetyTipInfo 386 extends BaseType 387 implements java.io.Serializable 388 { 389 /** For Object Serialization. java.io.Serializable */ 390 protected static final long serialVersionUID = 1; 391 392 public boolean[] optionals() 393 { return new boolean[] { false, true, }; } 394 395 /** Describes whether the page triggers any safety tips or reputation warnings. Default is unknown. */ 396 public final String safetyTipStatus; 397 398 /** 399 * The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches. 400 * <BR /> 401 * <BR /><B>OPTIONAL</B> 402 */ 403 public final String safeUrl; 404 405 /** 406 * Constructor 407 * 408 * @param safetyTipStatus Describes whether the page triggers any safety tips or reputation warnings. Default is unknown. 409 * 410 * @param safeUrl The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches. 411 * <BR /><B>OPTIONAL</B> 412 */ 413 public SafetyTipInfo(String safetyTipStatus, String safeUrl) 414 { 415 // Exception-Check(s) to ensure that if any parameters which are not declared as 416 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 417 418 if (safetyTipStatus == null) BRDPC.throwNPE("safetyTipStatus"); 419 420 // Exception-Check(s) to ensure that if any parameters which must adhere to a 421 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 422 423 BRDPC.checkIAE("safetyTipStatus", safetyTipStatus, "Security.SafetyTipStatus", Security.SafetyTipStatus); 424 425 this.safetyTipStatus = safetyTipStatus; 426 this.safeUrl = safeUrl; 427 } 428 429 /** 430 * JSON Object Constructor 431 * @param jo A Json-Object having data about an instance of {@code 'SafetyTipInfo'}. 432 */ 433 public SafetyTipInfo (JsonObject jo) 434 { 435 this.safetyTipStatus = ReadJSON.getString(jo, "safetyTipStatus", false, true); 436 this.safeUrl = ReadJSON.getString(jo, "safeUrl", true, false); 437 } 438 439 440 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 441 public boolean equals(Object other) 442 { 443 if (other == null) return false; 444 if (other.getClass() != this.getClass()) return false; 445 446 SafetyTipInfo o = (SafetyTipInfo) other; 447 448 return 449 Objects.equals(this.safetyTipStatus, o.safetyTipStatus) 450 && Objects.equals(this.safeUrl, o.safeUrl); 451 } 452 453 /** Generates a Hash-Code for {@code 'this'} instance */ 454 public int hashCode() 455 { 456 return 457 Objects.hashCode(this.safetyTipStatus) 458 + Objects.hashCode(this.safeUrl); 459 } 460 } 461 462 /** 463 * Security state information about the page. 464 * <BR /> 465 * <BR /><B>EXPERIMENTAL</B> 466 */ 467 public static class VisibleSecurityState 468 extends BaseType 469 implements java.io.Serializable 470 { 471 /** For Object Serialization. java.io.Serializable */ 472 protected static final long serialVersionUID = 1; 473 474 public boolean[] optionals() 475 { return new boolean[] { false, true, true, false, }; } 476 477 /** The security level of the page. */ 478 public final String securityState; 479 480 /** 481 * Security state details about the page certificate. 482 * <BR /> 483 * <BR /><B>OPTIONAL</B> 484 */ 485 public final Security.CertificateSecurityState certificateSecurityState; 486 487 /** 488 * 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. 489 * <BR /> 490 * <BR /><B>OPTIONAL</B> 491 */ 492 public final Security.SafetyTipInfo safetyTipInfo; 493 494 /** Array of security state issues ids. */ 495 public final String[] securityStateIssueIds; 496 497 /** 498 * Constructor 499 * 500 * @param securityState The security level of the page. 501 * 502 * @param certificateSecurityState Security state details about the page certificate. 503 * <BR /><B>OPTIONAL</B> 504 * 505 * @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. 506 * <BR /><B>OPTIONAL</B> 507 * 508 * @param securityStateIssueIds Array of security state issues ids. 509 */ 510 public VisibleSecurityState( 511 String securityState, Security.CertificateSecurityState certificateSecurityState, 512 Security.SafetyTipInfo safetyTipInfo, String[] securityStateIssueIds 513 ) 514 { 515 // Exception-Check(s) to ensure that if any parameters which are not declared as 516 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 517 518 if (securityState == null) BRDPC.throwNPE("securityState"); 519 if (securityStateIssueIds == null) BRDPC.throwNPE("securityStateIssueIds"); 520 521 // Exception-Check(s) to ensure that if any parameters which must adhere to a 522 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 523 524 BRDPC.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 525 526 this.securityState = securityState; 527 this.certificateSecurityState = certificateSecurityState; 528 this.safetyTipInfo = safetyTipInfo; 529 this.securityStateIssueIds = securityStateIssueIds; 530 } 531 532 /** 533 * JSON Object Constructor 534 * @param jo A Json-Object having data about an instance of {@code 'VisibleSecurityState'}. 535 */ 536 public VisibleSecurityState (JsonObject jo) 537 { 538 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 539 this.certificateSecurityState = ReadJSON.getObject(jo, "certificateSecurityState", Security.CertificateSecurityState.class, true, false); 540 this.safetyTipInfo = ReadJSON.getObject(jo, "safetyTipInfo", Security.SafetyTipInfo.class, true, false); 541 this.securityStateIssueIds = (jo.getJsonArray("securityStateIssueIds") == null) 542 ? null 543 : RJArrIntoStream.strArr(jo.getJsonArray("securityStateIssueIds"), null, 0).toArray(String[]::new); 544 545 } 546 547 548 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 549 public boolean equals(Object other) 550 { 551 if (other == null) return false; 552 if (other.getClass() != this.getClass()) return false; 553 554 VisibleSecurityState o = (VisibleSecurityState) other; 555 556 return 557 Objects.equals(this.securityState, o.securityState) 558 && Objects.equals(this.certificateSecurityState, o.certificateSecurityState) 559 && Objects.equals(this.safetyTipInfo, o.safetyTipInfo) 560 && Arrays.deepEquals(this.securityStateIssueIds, o.securityStateIssueIds); 561 } 562 563 /** Generates a Hash-Code for {@code 'this'} instance */ 564 public int hashCode() 565 { 566 return 567 Objects.hashCode(this.securityState) 568 + this.certificateSecurityState.hashCode() 569 + this.safetyTipInfo.hashCode() 570 + Arrays.deepHashCode(this.securityStateIssueIds); 571 } 572 } 573 574 /** An explanation of an factor contributing to the security state. */ 575 public static class SecurityStateExplanation 576 extends BaseType 577 implements java.io.Serializable 578 { 579 /** For Object Serialization. java.io.Serializable */ 580 protected static final long serialVersionUID = 1; 581 582 public boolean[] optionals() 583 { return new boolean[] { false, false, false, false, false, false, true, }; } 584 585 /** Security state representing the severity of the factor being explained. */ 586 public final String securityState; 587 588 /** Title describing the type of factor. */ 589 public final String title; 590 591 /** Short phrase describing the type of factor. */ 592 public final String summary; 593 594 /** Full text explanation of the factor. */ 595 public final String description; 596 597 /** The type of mixed content described by the explanation. */ 598 public final String mixedContentType; 599 600 /** Page certificate. */ 601 public final String[] certificate; 602 603 /** 604 * Recommendations to fix any issues. 605 * <BR /> 606 * <BR /><B>OPTIONAL</B> 607 */ 608 public final String[] recommendations; 609 610 /** 611 * Constructor 612 * 613 * @param securityState Security state representing the severity of the factor being explained. 614 * 615 * @param title Title describing the type of factor. 616 * 617 * @param summary Short phrase describing the type of factor. 618 * 619 * @param description Full text explanation of the factor. 620 * 621 * @param mixedContentType The type of mixed content described by the explanation. 622 * 623 * @param certificate Page certificate. 624 * 625 * @param recommendations Recommendations to fix any issues. 626 * <BR /><B>OPTIONAL</B> 627 */ 628 public SecurityStateExplanation( 629 String securityState, String title, String summary, String description, 630 String mixedContentType, String[] certificate, String[] recommendations 631 ) 632 { 633 // Exception-Check(s) to ensure that if any parameters which are not declared as 634 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 635 636 if (securityState == null) BRDPC.throwNPE("securityState"); 637 if (title == null) BRDPC.throwNPE("title"); 638 if (summary == null) BRDPC.throwNPE("summary"); 639 if (description == null) BRDPC.throwNPE("description"); 640 if (mixedContentType == null) BRDPC.throwNPE("mixedContentType"); 641 if (certificate == null) BRDPC.throwNPE("certificate"); 642 643 // Exception-Check(s) to ensure that if any parameters which must adhere to a 644 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 645 646 BRDPC.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 647 BRDPC.checkIAE("mixedContentType", mixedContentType, "Security.MixedContentType", Security.MixedContentType); 648 649 this.securityState = securityState; 650 this.title = title; 651 this.summary = summary; 652 this.description = description; 653 this.mixedContentType = mixedContentType; 654 this.certificate = certificate; 655 this.recommendations = recommendations; 656 } 657 658 /** 659 * JSON Object Constructor 660 * @param jo A Json-Object having data about an instance of {@code 'SecurityStateExplanation'}. 661 */ 662 public SecurityStateExplanation (JsonObject jo) 663 { 664 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 665 this.title = ReadJSON.getString(jo, "title", false, true); 666 this.summary = ReadJSON.getString(jo, "summary", false, true); 667 this.description = ReadJSON.getString(jo, "description", false, true); 668 this.mixedContentType = ReadJSON.getString(jo, "mixedContentType", false, true); 669 this.certificate = (jo.getJsonArray("certificate") == null) 670 ? null 671 : RJArrIntoStream.strArr(jo.getJsonArray("certificate"), null, 0).toArray(String[]::new); 672 673 this.recommendations = (jo.getJsonArray("recommendations") == null) 674 ? null 675 : RJArrIntoStream.strArr(jo.getJsonArray("recommendations"), null, 0).toArray(String[]::new); 676 677 } 678 679 680 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 681 public boolean equals(Object other) 682 { 683 if (other == null) return false; 684 if (other.getClass() != this.getClass()) return false; 685 686 SecurityStateExplanation o = (SecurityStateExplanation) other; 687 688 return 689 Objects.equals(this.securityState, o.securityState) 690 && Objects.equals(this.title, o.title) 691 && Objects.equals(this.summary, o.summary) 692 && Objects.equals(this.description, o.description) 693 && Objects.equals(this.mixedContentType, o.mixedContentType) 694 && Arrays.deepEquals(this.certificate, o.certificate) 695 && Arrays.deepEquals(this.recommendations, o.recommendations); 696 } 697 698 /** Generates a Hash-Code for {@code 'this'} instance */ 699 public int hashCode() 700 { 701 return 702 Objects.hashCode(this.securityState) 703 + Objects.hashCode(this.title) 704 + Objects.hashCode(this.summary) 705 + Objects.hashCode(this.description) 706 + Objects.hashCode(this.mixedContentType) 707 + Arrays.deepHashCode(this.certificate) 708 + Arrays.deepHashCode(this.recommendations); 709 } 710 } 711 712 /** 713 * Information about insecure content on the page. 714 * <BR /> 715 * <BR /><B>DEPRECATED</B> 716 */ 717 public static class InsecureContentStatus 718 extends BaseType 719 implements java.io.Serializable 720 { 721 /** For Object Serialization. java.io.Serializable */ 722 protected static final long serialVersionUID = 1; 723 724 public boolean[] optionals() 725 { return new boolean[] { false, false, false, false, false, false, false, }; } 726 727 /** Always false. */ 728 public final boolean ranMixedContent; 729 730 /** Always false. */ 731 public final boolean displayedMixedContent; 732 733 /** Always false. */ 734 public final boolean containedMixedForm; 735 736 /** Always false. */ 737 public final boolean ranContentWithCertErrors; 738 739 /** Always false. */ 740 public final boolean displayedContentWithCertErrors; 741 742 /** Always set to unknown. */ 743 public final String ranInsecureContentStyle; 744 745 /** Always set to unknown. */ 746 public final String displayedInsecureContentStyle; 747 748 /** 749 * Constructor 750 * 751 * @param ranMixedContent Always false. 752 * 753 * @param displayedMixedContent Always false. 754 * 755 * @param containedMixedForm Always false. 756 * 757 * @param ranContentWithCertErrors Always false. 758 * 759 * @param displayedContentWithCertErrors Always false. 760 * 761 * @param ranInsecureContentStyle Always set to unknown. 762 * 763 * @param displayedInsecureContentStyle Always set to unknown. 764 */ 765 public InsecureContentStatus( 766 boolean ranMixedContent, boolean displayedMixedContent, boolean containedMixedForm, 767 boolean ranContentWithCertErrors, boolean displayedContentWithCertErrors, 768 String ranInsecureContentStyle, String displayedInsecureContentStyle 769 ) 770 { 771 // Exception-Check(s) to ensure that if any parameters which are not declared as 772 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 773 774 if (ranInsecureContentStyle == null) BRDPC.throwNPE("ranInsecureContentStyle"); 775 if (displayedInsecureContentStyle == null) BRDPC.throwNPE("displayedInsecureContentStyle"); 776 777 // Exception-Check(s) to ensure that if any parameters which must adhere to a 778 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 779 780 BRDPC.checkIAE("ranInsecureContentStyle", ranInsecureContentStyle, "Security.SecurityState", Security.SecurityState); 781 BRDPC.checkIAE("displayedInsecureContentStyle", displayedInsecureContentStyle, "Security.SecurityState", Security.SecurityState); 782 783 this.ranMixedContent = ranMixedContent; 784 this.displayedMixedContent = displayedMixedContent; 785 this.containedMixedForm = containedMixedForm; 786 this.ranContentWithCertErrors = ranContentWithCertErrors; 787 this.displayedContentWithCertErrors = displayedContentWithCertErrors; 788 this.ranInsecureContentStyle = ranInsecureContentStyle; 789 this.displayedInsecureContentStyle = displayedInsecureContentStyle; 790 } 791 792 /** 793 * JSON Object Constructor 794 * @param jo A Json-Object having data about an instance of {@code 'InsecureContentStatus'}. 795 */ 796 public InsecureContentStatus (JsonObject jo) 797 { 798 this.ranMixedContent = ReadPrimJSON.getBoolean(jo, "ranMixedContent"); 799 this.displayedMixedContent = ReadPrimJSON.getBoolean(jo, "displayedMixedContent"); 800 this.containedMixedForm = ReadPrimJSON.getBoolean(jo, "containedMixedForm"); 801 this.ranContentWithCertErrors = ReadPrimJSON.getBoolean(jo, "ranContentWithCertErrors"); 802 this.displayedContentWithCertErrors = ReadPrimJSON.getBoolean(jo, "displayedContentWithCertErrors"); 803 this.ranInsecureContentStyle = ReadJSON.getString(jo, "ranInsecureContentStyle", false, true); 804 this.displayedInsecureContentStyle = ReadJSON.getString(jo, "displayedInsecureContentStyle", false, true); 805 } 806 807 808 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 809 public boolean equals(Object other) 810 { 811 if (other == null) return false; 812 if (other.getClass() != this.getClass()) return false; 813 814 InsecureContentStatus o = (InsecureContentStatus) other; 815 816 return 817 (this.ranMixedContent == o.ranMixedContent) 818 && (this.displayedMixedContent == o.displayedMixedContent) 819 && (this.containedMixedForm == o.containedMixedForm) 820 && (this.ranContentWithCertErrors == o.ranContentWithCertErrors) 821 && (this.displayedContentWithCertErrors == o.displayedContentWithCertErrors) 822 && Objects.equals(this.ranInsecureContentStyle, o.ranInsecureContentStyle) 823 && Objects.equals(this.displayedInsecureContentStyle, o.displayedInsecureContentStyle); 824 } 825 826 /** Generates a Hash-Code for {@code 'this'} instance */ 827 public int hashCode() 828 { 829 return 830 (this.ranMixedContent ? 1 : 0) 831 + (this.displayedMixedContent ? 1 : 0) 832 + (this.containedMixedForm ? 1 : 0) 833 + (this.ranContentWithCertErrors ? 1 : 0) 834 + (this.displayedContentWithCertErrors ? 1 : 0) 835 + Objects.hashCode(this.ranInsecureContentStyle) 836 + Objects.hashCode(this.displayedInsecureContentStyle); 837 } 838 } 839 840 /** 841 * There is a certificate error. If overriding certificate errors is enabled, then it should be 842 * handled with the <CODE>handleCertificateError</CODE> command. Note: this event does not fire if the 843 * certificate error has been allowed internally. Only one client per target should override 844 * certificate errors at the same time. 845 * <BR /> 846 * <BR /><B>DEPRECATED</B> 847 */ 848 public static class certificateError 849 extends BrowserEvent 850 implements java.io.Serializable 851 { 852 /** For Object Serialization. java.io.Serializable */ 853 protected static final long serialVersionUID = 1; 854 855 public boolean[] optionals() 856 { return new boolean[] { false, false, false, }; } 857 858 /** The ID of the event. */ 859 public final int eventId; 860 861 /** The type of the error. */ 862 public final String errorType; 863 864 /** The url that was requested. */ 865 public final String requestURL; 866 867 /** 868 * Constructor 869 * 870 * @param eventId The ID of the event. 871 * 872 * @param errorType The type of the error. 873 * 874 * @param requestURL The url that was requested. 875 */ 876 public certificateError(int eventId, String errorType, String requestURL) 877 { 878 super("Security", "certificateError", 3); 879 880 // Exception-Check(s) to ensure that if any parameters which are not declared as 881 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 882 883 if (errorType == null) BRDPC.throwNPE("errorType"); 884 if (requestURL == null) BRDPC.throwNPE("requestURL"); 885 886 this.eventId = eventId; 887 this.errorType = errorType; 888 this.requestURL = requestURL; 889 } 890 891 /** 892 * JSON Object Constructor 893 * @param jo A Json-Object having data about an instance of {@code 'certificateError'}. 894 */ 895 public certificateError (JsonObject jo) 896 { 897 super("Security", "certificateError", 3); 898 899 this.eventId = ReadPrimJSON.getInt(jo, "eventId"); 900 this.errorType = ReadJSON.getString(jo, "errorType", false, true); 901 this.requestURL = ReadJSON.getString(jo, "requestURL", false, true); 902 } 903 904 905 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 906 public boolean equals(Object other) 907 { 908 if (other == null) return false; 909 if (other.getClass() != this.getClass()) return false; 910 911 certificateError o = (certificateError) other; 912 913 return 914 (this.eventId == o.eventId) 915 && Objects.equals(this.errorType, o.errorType) 916 && Objects.equals(this.requestURL, o.requestURL); 917 } 918 919 /** Generates a Hash-Code for {@code 'this'} instance */ 920 public int hashCode() 921 { 922 return 923 this.eventId 924 + Objects.hashCode(this.errorType) 925 + Objects.hashCode(this.requestURL); 926 } 927 } 928 929 /** 930 * The security state of the page changed. 931 * <BR /> 932 * <BR /><B>EXPERIMENTAL</B> 933 */ 934 public static class visibleSecurityStateChanged 935 extends BrowserEvent 936 implements java.io.Serializable 937 { 938 /** For Object Serialization. java.io.Serializable */ 939 protected static final long serialVersionUID = 1; 940 941 public boolean[] optionals() 942 { return new boolean[] { false, }; } 943 944 /** Security state information about the page. */ 945 public final Security.VisibleSecurityState visibleSecurityState; 946 947 /** 948 * Constructor 949 * 950 * @param visibleSecurityState Security state information about the page. 951 */ 952 public visibleSecurityStateChanged(Security.VisibleSecurityState visibleSecurityState) 953 { 954 super("Security", "visibleSecurityStateChanged", 1); 955 956 // Exception-Check(s) to ensure that if any parameters which are not declared as 957 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 958 959 if (visibleSecurityState == null) BRDPC.throwNPE("visibleSecurityState"); 960 961 this.visibleSecurityState = visibleSecurityState; 962 } 963 964 /** 965 * JSON Object Constructor 966 * @param jo A Json-Object having data about an instance of {@code 'visibleSecurityStateChanged'}. 967 */ 968 public visibleSecurityStateChanged (JsonObject jo) 969 { 970 super("Security", "visibleSecurityStateChanged", 1); 971 972 this.visibleSecurityState = ReadJSON.getObject(jo, "visibleSecurityState", Security.VisibleSecurityState.class, false, true); 973 } 974 975 976 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 977 public boolean equals(Object other) 978 { 979 if (other == null) return false; 980 if (other.getClass() != this.getClass()) return false; 981 982 visibleSecurityStateChanged o = (visibleSecurityStateChanged) other; 983 984 return 985 Objects.equals(this.visibleSecurityState, o.visibleSecurityState); 986 } 987 988 /** Generates a Hash-Code for {@code 'this'} instance */ 989 public int hashCode() 990 { 991 return 992 this.visibleSecurityState.hashCode(); 993 } 994 } 995 996 /** The security state of the page changed. */ 997 public static class securityStateChanged 998 extends BrowserEvent 999 implements java.io.Serializable 1000 { 1001 /** For Object Serialization. java.io.Serializable */ 1002 protected static final long serialVersionUID = 1; 1003 1004 public boolean[] optionals() 1005 { return new boolean[] { false, false, false, false, true, }; } 1006 1007 /** Security state. */ 1008 public final String securityState; 1009 1010 /** 1011 * True if the page was loaded over cryptographic transport such as HTTPS. 1012 * <BR /> 1013 * <BR /><B>DEPRECATED</B> 1014 */ 1015 public final boolean schemeIsCryptographic; 1016 1017 /** 1018 * List of explanations for the security state. If the overall security state is <CODE>insecure</CODE> or 1019 * <CODE>warning</CODE>, at least one corresponding explanation should be included. 1020 */ 1021 public final Security.SecurityStateExplanation[] explanations; 1022 1023 /** 1024 * Information about insecure content on the page. 1025 * <BR /> 1026 * <BR /><B>DEPRECATED</B> 1027 */ 1028 public final Security.InsecureContentStatus insecureContentStatus; 1029 1030 /** 1031 * Overrides user-visible description of the state. 1032 * <BR /> 1033 * <BR /><B>OPTIONAL</B> 1034 */ 1035 public final String summary; 1036 1037 /** 1038 * Constructor 1039 * 1040 * @param securityState Security state. 1041 * 1042 * @param schemeIsCryptographic True if the page was loaded over cryptographic transport such as HTTPS. 1043 * <BR /><B>DEPRECATED</B> 1044 * 1045 * @param explanations 1046 * List of explanations for the security state. If the overall security state is <CODE>insecure</CODE> or 1047 * <CODE>warning</CODE>, at least one corresponding explanation should be included. 1048 * 1049 * @param insecureContentStatus Information about insecure content on the page. 1050 * <BR /><B>DEPRECATED</B> 1051 * 1052 * @param summary Overrides user-visible description of the state. 1053 * <BR /><B>OPTIONAL</B> 1054 */ 1055 public securityStateChanged( 1056 String securityState, boolean schemeIsCryptographic, 1057 Security.SecurityStateExplanation[] explanations, 1058 Security.InsecureContentStatus insecureContentStatus, String summary 1059 ) 1060 { 1061 super("Security", "securityStateChanged", 5); 1062 1063 // Exception-Check(s) to ensure that if any parameters which are not declared as 1064 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1065 1066 if (securityState == null) BRDPC.throwNPE("securityState"); 1067 if (explanations == null) BRDPC.throwNPE("explanations"); 1068 if (insecureContentStatus == null) BRDPC.throwNPE("insecureContentStatus"); 1069 1070 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1071 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1072 1073 BRDPC.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 1074 1075 this.securityState = securityState; 1076 this.schemeIsCryptographic = schemeIsCryptographic; 1077 this.explanations = explanations; 1078 this.insecureContentStatus = insecureContentStatus; 1079 this.summary = summary; 1080 } 1081 1082 /** 1083 * JSON Object Constructor 1084 * @param jo A Json-Object having data about an instance of {@code 'securityStateChanged'}. 1085 */ 1086 public securityStateChanged (JsonObject jo) 1087 { 1088 super("Security", "securityStateChanged", 5); 1089 1090 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 1091 this.schemeIsCryptographic = ReadPrimJSON.getBoolean(jo, "schemeIsCryptographic"); 1092 this.explanations = (jo.getJsonArray("explanations") == null) 1093 ? null 1094 : RJArrDimN.objArr(jo.getJsonArray("explanations"), null, 0, Security.SecurityStateExplanation[].class); 1095 1096 this.insecureContentStatus = ReadJSON.getObject(jo, "insecureContentStatus", Security.InsecureContentStatus.class, false, true); 1097 this.summary = ReadJSON.getString(jo, "summary", true, false); 1098 } 1099 1100 1101 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1102 public boolean equals(Object other) 1103 { 1104 if (other == null) return false; 1105 if (other.getClass() != this.getClass()) return false; 1106 1107 securityStateChanged o = (securityStateChanged) other; 1108 1109 return 1110 Objects.equals(this.securityState, o.securityState) 1111 && (this.schemeIsCryptographic == o.schemeIsCryptographic) 1112 && Arrays.deepEquals(this.explanations, o.explanations) 1113 && Objects.equals(this.insecureContentStatus, o.insecureContentStatus) 1114 && Objects.equals(this.summary, o.summary); 1115 } 1116 1117 /** Generates a Hash-Code for {@code 'this'} instance */ 1118 public int hashCode() 1119 { 1120 return 1121 Objects.hashCode(this.securityState) 1122 + (this.schemeIsCryptographic ? 1 : 0) 1123 + Arrays.deepHashCode(this.explanations) 1124 + this.insecureContentStatus.hashCode() 1125 + Objects.hashCode(this.summary); 1126 } 1127 } 1128 1129 1130 // Counter for keeping the WebSocket Request ID's distinct. 1131 private static int counter = 1; 1132 1133 /** 1134 * Disables tracking security state changes. 1135 * 1136 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1137 * {@link Ret0}></CODE> 1138 * 1139 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1140 * browser receives the invocation-request. 1141 * 1142 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1143 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1144 * {@code >} to ensure the Browser Function has run to completion. 1145 */ 1146 public static Script<String, JsonObject, Ret0> disable() 1147 { 1148 final int webSocketID = 35000000 + counter++; 1149 final boolean[] optionals = new boolean[0]; 1150 1151 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1152 String requestJSON = WriteJSON.get( 1153 parameterTypes.get("disable"), 1154 parameterNames.get("disable"), 1155 optionals, webSocketID, 1156 "Security.disable" 1157 ); 1158 1159 // This Remote Command does not have a Return-Value. 1160 return new Script<> 1161 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1162 } 1163 1164 /** 1165 * Enables tracking security state changes. 1166 * 1167 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1168 * {@link Ret0}></CODE> 1169 * 1170 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1171 * browser receives the invocation-request. 1172 * 1173 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1174 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1175 * {@code >} to ensure the Browser Function has run to completion. 1176 */ 1177 public static Script<String, JsonObject, Ret0> enable() 1178 { 1179 final int webSocketID = 35001000 + counter++; 1180 final boolean[] optionals = new boolean[0]; 1181 1182 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1183 String requestJSON = WriteJSON.get( 1184 parameterTypes.get("enable"), 1185 parameterNames.get("enable"), 1186 optionals, webSocketID, 1187 "Security.enable" 1188 ); 1189 1190 // This Remote Command does not have a Return-Value. 1191 return new Script<> 1192 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1193 } 1194 1195 /** 1196 * Enable/disable whether all certificate errors should be ignored. 1197 * <BR /><B>EXPERIMENTAL</B> 1198 * 1199 * @param ignore If true, all certificate errors will be ignored. 1200 * 1201 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1202 * {@link Ret0}></CODE> 1203 * 1204 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1205 * browser receives the invocation-request. 1206 * 1207 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1208 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1209 * {@code >} to ensure the Browser Function has run to completion. 1210 */ 1211 public static Script<String, JsonObject, Ret0> setIgnoreCertificateErrors(boolean ignore) 1212 { 1213 final int webSocketID = 35002000 + counter++; 1214 final boolean[] optionals = { false, }; 1215 1216 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1217 String requestJSON = WriteJSON.get( 1218 parameterTypes.get("setIgnoreCertificateErrors"), 1219 parameterNames.get("setIgnoreCertificateErrors"), 1220 optionals, webSocketID, 1221 "Security.setIgnoreCertificateErrors", 1222 ignore 1223 ); 1224 1225 // This Remote Command does not have a Return-Value. 1226 return new Script<> 1227 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1228 } 1229 1230 /** 1231 * Handles a certificate error that fired a certificateError event. 1232 * <BR /><B>DEPRECATED</B> 1233 * 1234 * @param eventId The ID of the event. 1235 * 1236 * @param action The action to take on the certificate error. 1237 * 1238 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1239 * {@link Ret0}></CODE> 1240 * 1241 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1242 * browser receives the invocation-request. 1243 * 1244 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1245 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1246 * {@code >} to ensure the Browser Function has run to completion. 1247 */ 1248 public static Script<String, JsonObject, Ret0> handleCertificateError 1249 (int eventId, String action) 1250 { 1251 // Exception-Check(s) to ensure that if any parameters which are not declared as 1252 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1253 1254 if (action == null) BRDPC.throwNPE("action"); 1255 1256 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1257 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1258 1259 BRDPC.checkIAE("action", action, "Security.CertificateErrorAction", Security.CertificateErrorAction); 1260 1261 final int webSocketID = 35003000 + counter++; 1262 final boolean[] optionals = { false, false, }; 1263 1264 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1265 String requestJSON = WriteJSON.get( 1266 parameterTypes.get("handleCertificateError"), 1267 parameterNames.get("handleCertificateError"), 1268 optionals, webSocketID, 1269 "Security.handleCertificateError", 1270 eventId, action 1271 ); 1272 1273 // This Remote Command does not have a Return-Value. 1274 return new Script<> 1275 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1276 } 1277 1278 /** 1279 * Enable/disable overriding certificate errors. If enabled, all certificate error events need to 1280 * be handled by the DevTools client and should be answered with <CODE>handleCertificateError</CODE> commands. 1281 * <BR /><B>DEPRECATED</B> 1282 * 1283 * @param override If true, certificate errors will be overridden. 1284 * 1285 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1286 * {@link Ret0}></CODE> 1287 * 1288 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1289 * browser receives the invocation-request. 1290 * 1291 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1292 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1293 * {@code >} to ensure the Browser Function has run to completion. 1294 */ 1295 public static Script<String, JsonObject, Ret0> setOverrideCertificateErrors 1296 (boolean override) 1297 { 1298 final int webSocketID = 35004000 + counter++; 1299 final boolean[] optionals = { false, }; 1300 1301 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1302 String requestJSON = WriteJSON.get( 1303 parameterTypes.get("setOverrideCertificateErrors"), 1304 parameterNames.get("setOverrideCertificateErrors"), 1305 optionals, webSocketID, 1306 "Security.setOverrideCertificateErrors", 1307 override 1308 ); 1309 1310 // This Remote Command does not have a Return-Value. 1311 return new Script<> 1312 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1313 } 1314 1315}