docs: public SecurityMode getSecurity() {
          // fix the variable so that this code works under concurrent modification to securityRealm.
          SecurityRealm realm = securityRealm;
  
          if(realm==SecurityRealm.NO_AUTHENTICATION)
              return SecurityMode.UNSECURED;
          if(realm instanceof LegacySecurityRealm)
              return SecurityMode.LEGACY;
          return SecurityMode.SECURED;
      }