Package org.exist.security

Examples of org.exist.security.AbstractAccount


        }
       
        usersByName.modify2E(new PrincipalDbModify2E<Account, PermissionDeniedException, EXistException>(){
            @Override
            public void execute(Map<String, Account> principalDb) throws PermissionDeniedException, EXistException {
                final AbstractAccount remove_account = (AbstractAccount)principalDb.get(account.getName());
                if(remove_account == null){
                    throw new IllegalArgumentException("No such account exists!");
                }

                DBBroker broker = null;
                try {
                    broker = getDatabase().get(null);
                    final Account user = broker.getSubject();

                    if(!(account.getName().equals(user.getName()) || user.hasDbaRole()) ) {
                        throw new PermissionDeniedException("You are not allowed to delete '" +account.getName() + "' user");
                    }

                    remove_account.setRemoved(true);
                    remove_account.setCollection(broker, collectionRemovedAccounts, XmldbURI.create(UUIDGenerator.getUUID()+".xml"));

                    final TransactionManager transaction = getDatabase().getTransactionManager();
                    Txn txn = null;
                    try {
                        txn = transaction.beginTransaction();

                        collectionAccounts.removeXMLResource(txn, broker, XmldbURI.create( remove_account.getName() + ".xml"));

                        transaction.commit(txn);
                    } catch(final Exception e) {
                        transaction.abort(txn);
                        e.printStackTrace();
                        LOG.debug("loading configuration failed: " + e.getMessage());
                    } finally {
                        transaction.close(txn);
                    }

                    getSecurityManager().addUser(remove_account.getId(), remove_account);
                    principalDb.remove(remove_account.getName());
                } finally {
                    getDatabase().release(broker);
                }
            }
        });
View Full Code Here


      Identifier verified = verification.getVerifiedId();
      if (verified != null) {
        // success
       
        String accountName = AccountImpl.escape(verified.getIdentifier());
        AbstractAccount account = (AbstractAccount) OpenIDRealm.instance.getAccount(accountName);
        if (account == null) {
          Database db = OpenIDRealm.instance.getDatabase();
          org.exist.security.Subject currentSubject = db.getSubject();
          try {
            db.setSubject(db.getSecurityManager().getSystemSubject());
View Full Code Here

        // Binds using the username and password provided by the user.
        LdapContext ctx = null;
        try {
            ctx = ensureContextFactory().getLdapContext(name, String.valueOf(credentials));

            final AbstractAccount account = (AbstractAccount) getAccount(ctx, name);
            if (account == null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Account '"+name+"' can not be found.");
                }
          throw new AuthenticationException(
View Full Code Here

        final Subject subject;
        final SecurityManager sm = manager.getDatabase().getSecurityManager();
        if(account == null || account.isEmpty()) {
            subject = manager.getDatabase().getSecurityManager().getGuestSubject();
        } else {
            final AbstractAccount acc = (AbstractAccount) sm.getAccount(account);
            if(acc == null) {
                //UNDERSTAND: error better here?
                subject = sm.getGuestSubject();
            } else {
                subject = new SubjectAccreditedImpl(acc, this);
View Full Code Here

          AuthenticationException.UNNOWN_EXCEPTION,
          e.getMessage());
    }

    if (ldapUser) {
      AbstractAccount account = (AbstractAccount) getAccount(username);
      if (account == null) {
        Subject currentSubject = getDatabase().getSubject();
                DBBroker broker = null;
        try {
                    broker = getDatabase().get(null);
View Full Code Here

TOP

Related Classes of org.exist.security.AbstractAccount

Copyright © 2018 www.massapicom. 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.