Package org.exist.security

Examples of org.exist.security.Account


                    //store any requested metadata
                    for(Entry<SchemaType, String> entry : metadata.entrySet())
                        userAider.setMetadataValue(entry.getKey(), entry.getValue());

                    Account account = getSecurityManager().addAccount(userAider);

                    return account;
                }
            });
        } catch(Exception e) {
View Full Code Here


    public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
        final SecurityManager sm = context.getBroker().getBrokerPool().getSecurityManager();
        final LDAPRealm ldapRealm = getLdapRealm(sm);
        final String accountName = args[0].itemAt(0).getStringValue();
       
        final Account ldapAccount = sm.getAccount(accountName);
        if(ldapAccount == null)
            throw new XPathException("The Account '" + accountName + "' does not exist!");
       
        try {
            ldapRealm.refreshAccountFromLdap(ldapAccount);
View Full Code Here

    }
  }

  private void processReturn(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Account principal = this.verifyResponse(req);
   
    //System.out.println(principal);
       
    String returnURL = req.getParameter("exist_return");
View Full Code Here

     
    String id = responseAttributes.get("id");
   
    String accountName = id + "@google.com";

    Account found = OAuthRealm._.getAccount(accountName);
   
    if (found == null) {
      Map<SchemaType, String> metadata = new HashMap<SchemaType, String>();
      addMetadata(responseAttributes, metadata, GoogleSchemaType.ID, "id");
      addMetadata(responseAttributes, metadata, AXSchemaType.FIRSTNAME, "given_name");
      addMetadata(responseAttributes, metadata, AXSchemaType.LASTNAME, "family_name");
      addMetadata(responseAttributes, metadata, AXSchemaType.FULLNAME, "name");
      addMetadata(responseAttributes, metadata, AXSchemaType.TIMEZONE, "timezone");

      addMetadata(responseAttributes, metadata, GoogleSchemaType.PICTURE, "picture");
      addMetadata(responseAttributes, metadata, GoogleSchemaType.LOCALE, "locale");
      addMetadata(responseAttributes, metadata, GoogleSchemaType.LINK, "link");
      addMetadata(responseAttributes, metadata, GoogleSchemaType.GENDER, "gender");     
     
      found = OAuthRealm._.createAccountInDatabase(accountName, metadata);
    }
   
    Account principal = new SubjectAccreditedImpl((AbstractAccount) found, accessToken);
   
        HttpSession session = request.getSession(true);

    Subject subject = new Subject();
View Full Code Here

                LOG.debug("No resource found for path: " + xmldbUri);
                return null;
            }

            // TODO consider. A Webdav lock can be set without subject lock.
            Account lock = document.getUserLock();
            if (lock == null) {

                if (LOG.isDebugEnabled()) {
                    LOG.debug("Document " + xmldbUri + " does not contain userlock");
                }
View Full Code Here

                //return null; // throw exception?
                throw new EXistException("No resource found.");
            }

            // Get current userlock
            Account userLock = document.getUserLock();

            // Check if Resource is already locked. @@ToDo
            if (userLock != null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Resource was already locked, ignored.");
                }
            }

            if ( userLock != null && userLock.getName() != null
                    && !userLock.getName().equals(subject.getName())
                    && !subject.hasDbaRole() ) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug(String.format("Resource is locked by user %s.", userLock.getName()));
                }
                throw new PermissionDeniedException(userLock.getName());
            }

            // Check for request for shared lock. @@TODO
            if (inputToken.getScope() == LockToken.LOCK_SCOPE_SHARED) {
                if (LOG.isDebugEnabled()) {
View Full Code Here

                LOG.debug(msg);
                throw new EXistException(msg);
            }

            // Get current userlock
            Account lock = document.getUserLock();

            // Check if Resource is already locked.
            if (lock == null) {
                LOG.debug(String.format("Resource %s is not locked.", xmldbUri));
                throw new DocumentNotLockedException("" + xmldbUri);
            }

            // Check if Resource is from subject
            if (!lock.getName().equals(subject.getName()) && !subject.hasDbaRole() ) {
                LOG.debug(String.format("Resource lock is from user %s", lock.getName()));
                throw new PermissionDeniedException(lock.getName());
            }

            // Update document
            document.setUserLock(null);
            document.getMetadata().setLockToken(null);
View Full Code Here

                //return null; // throw exception?
                throw new EXistException("No resource found.");
            }

            // Get current userlock
            Account userLock = document.getUserLock();

            // Check if Resource is already locked.
            if (userLock == null) {
                final String msg = "Resource was not locked.";
                if (LOG.isDebugEnabled()) {
                    LOG.debug(msg);
                }
                throw new DocumentNotLockedException(msg);
            }

            if (userLock.getName() != null && !userLock.getName().equals(subject.getName())
                    && !subject.hasDbaRole()) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug(String.format("Resource is locked by %s", userLock.getName()));
                }
                throw new PermissionDeniedException(userLock.getName());
            }

            LockToken lockToken = document.getMetadata().getLockToken();

            if (!token.equals(lockToken.getOpaqueLockToken())) {
View Full Code Here

                    //store any requested metadata
                    for(final SimpleEntry<AXSchemaType, String> metadata : getMetadataForLdapUser(ldapUser)) {
                        userAider.setMetadataValue(metadata.getKey(), metadata.getValue());
                    }

                    final Account account = getSecurityManager().addAccount(userAider);

                    //LDAPAccountImpl account = sm.addAccount(instantiateAccount(ID, username));

                    //TODO expand to a general method that rewrites the useraider based on the realTransformation
                    /*
 
View Full Code Here

    @Override
    public final synchronized Account getAccount(String name) {
        name = ensureCase(name);
       
        //first attempt to get the cached account
        final Account acct = super.getAccount(name);

        if(acct != null) {
            return acct;
        } else {
            LdapContext ctx = null;
View Full Code Here

TOP

Related Classes of org.exist.security.Account

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.