Tabnine Logo
OSecurityManager.instance
Code IndexAdd Tabnine to your IDE (free)

How to use
instance
method
in
com.orientechnologies.orient.core.security.OSecurityManager

Best Java code snippets using com.orientechnologies.orient.core.security.OSecurityManager.instance (Showing top 6 results out of 315)

origin: com.orientechnologies/orientdb-core

public static final String encryptPassword(final String iPassword) {
 return OSecurityManager.instance()
   .createHash(iPassword, OGlobalConfiguration.SECURITY_USER_PASSWORD_DEFAULT_ALGORITHM.getValueAsString(), true);
}
origin: com.orientechnologies/orientdb-core

public boolean checkPassword(final String iPassword) {
 return OSecurityManager.instance().checkPassword(iPassword, (String) document.field(PASSWORD_FIELD));
}
origin: com.orientechnologies/orientdb-core

public boolean checkPassword(final String iPassword) {
 return OSecurityManager.instance().checkPassword(iPassword, getPassword());
}
origin: com.orientechnologies/orientdb-tools

@SuppressWarnings("unchecked")
@ConsoleCommand(description = "Set a server user. If the user already exists, the password and permissions are updated. For more information look at http://orientdb.com/docs/last/Security.html#orientdb-server-security", onlineHelp = "Console-Command-Set-Server-User")
public void setServerUser(@ConsoleParameter(name = "user-name", description = "User name") String iServerUserName,
  @ConsoleParameter(name = "user-password", description = "User password") String iServerUserPasswd,
  @ConsoleParameter(name = "user-permissions", description = "Permissions, look at http://orientdb.com/docs/last/Security.html#servers-resources") String iPermissions) {
 if (iServerUserName == null || iServerUserName.length() == 0)
  throw new IllegalArgumentException("User name null or empty");
 if (iPermissions == null || iPermissions.length() == 0)
  throw new IllegalArgumentException("User permissions null or empty");
 final File serverCfgFile = new File("../config/orientdb-server-config.xml");
 if (!serverCfgFile.exists())
  throw new OConfigurationException("Cannot access to file " + serverCfgFile);
 try {
  final OServerConfigurationManager serverCfg = new OServerConfigurationManager(serverCfgFile);
  final String defAlgo = OGlobalConfiguration.SECURITY_USER_PASSWORD_DEFAULT_ALGORITHM.getValueAsString();
  final String hashedPassword = OSecurityManager.instance().createHash(iServerUserPasswd, defAlgo, true);
  serverCfg.setUser(iServerUserName, hashedPassword, iPermissions);
  serverCfg.saveConfiguration();
  message("\nServer user '%s' set correctly", iServerUserName);
 } catch (Exception e) {
  error("\nError on loading %s file: %s", serverCfgFile, e.toString());
 }
}
origin: com.orientechnologies/orientdb-core

public OUser authenticate(final String username, final String password) {
 if (delegate == null)
  throw new OSecurityAccessException("OSymmetricKeySecurity.authenticate() Delegate is null for username: " + username);
 if (database == null)
  throw new OSecurityAccessException("OSymmetricKeySecurity.authenticate() Database is null for username: " + username);
 final String dbName = database.getName();
 OUser user = delegate.getUser(username);
 if (user == null)
  throw new OSecurityAccessException(dbName,
    "OSymmetricKeySecurity.authenticate() Username or Key is invalid for username: " + username);
 if (user.getAccountStatus() != OSecurityUser.STATUSES.ACTIVE)
  throw new OSecurityAccessException(dbName, "OSymmetricKeySecurity.authenticate() User '" + username + "' is not active");
 try {
  OUserSymmetricKeyConfig userConfig = new OUserSymmetricKeyConfig(user);
  OSymmetricKey sk = OSymmetricKey.fromConfig(userConfig);
  String decryptedUsername = sk.decryptAsString(password);
  if (OSecurityManager.instance().checkPassword(username, decryptedUsername))
   return user;
 } catch (Exception ex) {
  throw OException.wrapException(new OSecurityAccessException(dbName,
    "OSymmetricKeySecurity.authenticate() Exception for database: " + dbName + ", username: " + username + " " + ex
      .getMessage()), ex);
 }
 throw new OSecurityAccessException(dbName,
   "OSymmetricKeySecurity.authenticate() Username or Key is invalid for database: " + dbName + ", username: " + username);
}
origin: com.orientechnologies/orientdb-core

public OSharedContextEmbedded(OStorage storage) {
 schema = new OSchemaEmbedded(this);
 security = OSecurityManager.instance().newSecurity();
 indexManager = new OIndexManagerShared(storage);
 functionLibrary = new OFunctionLibraryImpl();
 scheduler = new OSchedulerImpl();
 sequenceLibrary = new OSequenceLibraryImpl();
 liveQueryOps = new OLiveQueryHook.OLiveQueryOps();
 liveQueryOpsV2 = new OLiveQueryHookV2.OLiveQueryOps();
 commandCache = new OCommandCacheSoftRefs(storage.getUnderlying());
 statementCache = new OStatementCache(
   storage.getConfiguration().getContextConfiguration().getValueAsInteger(OGlobalConfiguration.STATEMENT_CACHE_SIZE));
 executionPlanCache = new OExecutionPlanCache(
   storage.getConfiguration().getContextConfiguration().getValueAsInteger(OGlobalConfiguration.STATEMENT_CACHE_SIZE));
 this.registerListener(executionPlanCache);
 queryStats = new OQueryStats();
 activeDistributedQueries = new HashMap<>();
 ((OAbstractPaginatedStorage) storage).setStorageConfigurationUpdateListener(update -> {
  for (OMetadataUpdateListener listener : browseListeners()) {
   listener.onStorageConfigurationUpdate(storage.getName(), update);
  }
 });
}
com.orientechnologies.orient.core.securityOSecurityManagerinstance

Popular methods of OSecurityManager

  • createHash
    Hashes the input string.
  • byteArrayToHexStr
  • checkPassword
    Checks if an hash string matches a password, based on the algorithm found on hash string.
  • checkPasswordWithSalt
  • createHashWithSalt
  • createSHA256
  • digestSHA256
  • getPbkdf2
  • hexToByteArray
  • isAlgorithmSupported
    Returns true if the algorithm is supported by the current version of Java
  • newSecurity
  • validateAlgorithm
  • newSecurity,
  • validateAlgorithm

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • getSystemService (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • JComboBox (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now