server/src/main/java/com/orientechnologies/orient/server/security/authenticator/OServerConfigAuthenticator.java
public String authenticate(final String username, final String password) {
    String principal = null;

    try {
      if (getServerConfig() != null) {
        OServerUserConfiguration userCfg = null;

        // This will throw an IllegalArgumentException if username is null or empty.
        // However, a null or empty username is possible with some security implementations.
        if (username != null && !username.isEmpty())
          userCfg = getServerConfig().getUser(username);

        if (userCfg != null && userCfg.password != null) {
          if (OSecurityManager.instance().checkPassword(password, userCfg.password)) {
            principal = userCfg.name;
          }
        }
      } else {
        OLogManager.instance().error(this, "OServerConfigAuthenticator.authenticate() ServerConfig is null", null);
      }
    } catch (Exception ex) {
      OLogManager.instance().error(this, "OServerConfigAuthenticator.authenticate()", ex);
    }

    return principal;
  }
public String authenticate(final String username, final String password) {
    String principal = null;

    try {
      if (getServerConfig() != null) {
        OServerUserConfiguration userCfg = null;

        // This will throw an IllegalArgumentException if username is null or empty.
        // However, a null or empty username is possible with some security implementations.
        if (username != null && !username.isEmpty())
          userCfg = getServerConfig().getUser(username);

        if (userCfg != null && userCfg.password != null) {
          if (OSecurityManager.instance().checkPassword(password, userCfg.password)) {
            principal = userCfg.name;
          }
        }
      } else {
        OLogManager.instance().error(this, "OServerConfigAuthenticator.authenticate() ServerConfig is null", null);
      }
    } catch (Exception ex) {
      OLogManager.instance().error(this, "OServerConfigAuthenticator.authenticate()", ex);
    }

    return principal;
  }
public String authenticate ( final String username , final String password ) { String principal = null ; try { if ( getServerConfig ( ) != null ) { OServerUserConfiguration userCfg = null ; // This will throw an IllegalArgumentException if username is null or empty. // However, a null or empty username is possible with some security implementations. if ( username != null && ! username . isEmpty ( ) ) userCfg = getServerConfig ( ) . getUser ( username ) ; if ( userCfg != null && userCfg . password != null ) { if ( OSecurityManager . instance ( ) . checkPassword ( password , userCfg . password ) ) { principal = userCfg . name ; } } } else { OLogManager . instance ( ) . error ( this , "OServerConfigAuthenticator.authenticate() ServerConfig is null" , null ) ; } } catch ( Exception ex ) { OLogManager . instance ( ) . error ( this , "OServerConfigAuthenticator.authenticate()" , ex ) ; } return principal ; }
Returns the actual username if successful, null otherwise.
Returns the actual username if successful null otherwise .