Examples of OSecurityAccessException


Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

   * @return The role that has granted the permission if any, otherwise a OSecurityAccessException exception is raised
   * @exception OSecurityAccessException
   */
  public ORole allow(final String iResource, final int iOperation) {
    if (roles == null || roles.isEmpty())
      throw new OSecurityAccessException(document.getDatabase().getName(), "User '" + document.field("name")
          + "' has no role defined");

    final ORole role = checkIfAllowed(iResource, iOperation);

    if (role == null)
      throw new OSecurityAccessException(document.getDatabase().getName(), "User '" + document.field("name")
          + "' has no the permission to execute the operation '" + ORole.permissionToString(iOperation)
          + "' against the resource: " + iResource);

    return role;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

                ((ODatabasePoolBase<?>) owner).close();
            }

            public DB createNewResource(final String iDatabaseName, final Object... iAdditionalArgs) {
              if (iAdditionalArgs.length < 2)
                throw new OSecurityAccessException("Username and/or password missed");

              return createResource(owner, iDatabaseName, iAdditionalArgs);
            }

            public boolean reuseResource(final String iKey, final Object[] iAdditionalArgs, final DB iValue) {
              if (((ODatabasePooled) iValue).isUnderlyingOpen()) {
                ((ODatabasePooled) iValue).reuse(owner, iAdditionalArgs);
                if (iValue.getStorage().isClosed())
                  // STORAGE HAS BEEN CLOSED: REOPEN IT
                  iValue.getStorage().open((String) iAdditionalArgs[0], (String) iAdditionalArgs[1], null);
                else if (!((ODatabaseComplex<?>) iValue).getUser().checkPassword((String) iAdditionalArgs[1]))
                  throw new OSecurityAccessException(iValue.getName(), "User or password not valid for database: '"
                      + iValue.getName() + "'");

                return true;
              }
              return false;
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

    return threadGroup;
  }

  public OServerUserConfiguration serverLogin(final String iUser, final String iPassword, final String iResource) {
    if (!authenticate(iUser, iPassword, iResource))
      throw new OSecurityAccessException(
          "Wrong user/password to [connect] to the remote OrientDB Server instance. Get the user/password from the config/orientdb-server-config.xml file");

    return getUser(iUser);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

   protected ODatabaseDocumentTx getProfiledDatabaseInstance(final OHttpRequest iRequest) throws InterruptedException {
     final OHttpSession session = OHttpSessionManager.getInstance().getSession(iRequest.sessionId);

     if (session == null)
       throw new OSecurityAccessException(iRequest.databaseName, "No session active");

     // after authentication, if current login user is different compare with current DB user, reset DB user to login user
     ODatabaseRecordInternal localDatabase = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();

     if (localDatabase == null) {
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

      if (document.field("roles") != null && !((Collection<OIdentifiable>) document.field("roles")).isEmpty()) {
        final ODocument doc = document;
        document = null;
        fromStream(doc);
      } else
        throw new OSecurityAccessException(document.getDatabase().getName(), "User '" + document.field("name")
            + "' has no role defined");
    }

    final ORole role = checkIfAllowed(iResource, iOperation);

    if (role == null)
      throw new OSecurityAccessException(document.getDatabase().getName(), "User '" + document.field("name")
          + "' has no the permission to execute the operation '" + ORole.permissionToString(iOperation)
          + "' against the resource: " + iResource);

    return role;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

  public OUser authenticate(final String iUserName, final String iUserPassword) {
    final String dbName = getDatabase().getName();

    final OUser user = getUser(iUserName);
    if (user == null)
      throw new OSecurityAccessException(dbName, "User or password not valid for database: '" + dbName + "'");

    if (user.getAccountStatus() != STATUSES.ACTIVE)
      throw new OSecurityAccessException(dbName, "User '" + iUserName + "' is not active");

    if (!(getDatabase().getStorage() instanceof OStorageProxy)) {
      // CHECK USER & PASSWORD
      if (!user.checkPassword(iUserPassword)) {
        // WAIT A BIT TO AVOID BRUTE FORCE
        try {
          Thread.sleep(200);
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
        }
        throw new OSecurityAccessException(dbName, "User or password not valid for database: '" + dbName + "'");
      }
    }

    return user;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

     }
   }

   protected void checkServerAccess(final String iResource) {
     if (connection.serverUser == null)
       throw new OSecurityAccessException("Server user not authenticated.");

     if (!server.authenticate(connection.serverUser.name, null, iResource))
       throw new OSecurityAccessException("User '" + connection.serverUser.name + "' cannot access to the resource [" + iResource
           + "]. Use another server user or change permission in the file config/orientdb-server-config.xml");
   }
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

     connection.database = (ODatabaseDocumentTx) server.openDatabase(dbType, dbURL, user, passwd);
     connection.rawDatabase = ((ODatabaseComplexInternal<?>) connection.database.getUnderlying()).getUnderlying();

     if (connection.database.getStorage() instanceof OStorageProxy && !loadUserFromSchema(user, passwd)) {
       sendErrorOrDropConnection(clientTxId, new OSecurityAccessException(connection.database.getName(),
           "User or password not valid for database: '" + connection.database.getName() + "'"));
     } else {

       beginResponse();
       try {
View Full Code Here

Examples of com.orientechnologies.orient.core.exception.OSecurityAccessException

     }

     OLogManager.instance().error(this, "Authentication error of remote client %s:%d: shutdown is aborted.",
         channel.socket.getInetAddress(), channel.socket.getPort());

     sendErrorOrDropConnection(clientTxId, new OSecurityAccessException("Invalid user/password to shutdown the server"));
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.