コード例 #1
0
  public ODefaultServerSecurity(
      final OServer oServer, final OServerConfigurationManager serverCfg) {
    server = oServer;
    serverConfig = serverCfg;

    oServer.registerLifecycleListener(this);
    OSecurityManager.instance().setSecurityFactory(this);
  }
コード例 #2
0
  private void createSuperUser() {
    if (superUser == null)
      throw new OSecuritySystemException(
          "ODefaultServerSecurity.createSuperUser() SuperUser cannot be null");

    try {
      // Assign a temporary password so that we know if authentication requests coming from the
      // SuperUser are from us.
      superUserPassword =
          OSecurityManager.instance()
              .createSHA256(String.valueOf(new java.util.Random().nextLong()));

      superUserCfg = new OServerUserConfiguration(superUser, superUserPassword, "*");
    } catch (Exception ex) {
      OLogManager.instance().error(this, "createSuperUser() Exception: ", ex);
    }

    if (superUserPassword == null)
      throw new OSecuritySystemException("ODefaultServerSecurity Could not create SuperUser");
  }