Examples of UserAccount


Examples of com.casamind.adware.server.domain.UserAccount

import com.google.appengine.api.taskqueue.TaskOptions;
import com.googlecode.objectify.Key;

public class DatastoreProxy {
  public static UserAccount getUserAccountById(Long id) {
    UserAccount user = null;
    user = new ObjectifyGenericDAO<UserAccount>(UserAccount.class).getByProperty("id", id);
    if (user != null)
      return user;
    user = new ObjectifyGenericDAO<Company>(Company.class).getByProperty("id", id);
    if (user != null)
View Full Code Here

Examples of com.casamind.adware.server.domain.UserAccount

      return user;
    return null;
  }

  public static UserAccount getUserAccountByLogin(String login) {
    UserAccount user = null;
    user = new ObjectifyGenericDAO<UserAccount>(UserAccount.class).getByProperty("login", login);
    if (user != null)
      return user;
    user = new ObjectifyGenericDAO<Company>(Company.class).getByProperty("login", login);
    if (user != null)
View Full Code Here

Examples of com.casamind.adware.server.domain.UserAccount

    }
    return byteArray;
  }

  public static UserAccount getUserAccountByUniqueId(String uniqueId) {
    UserAccount user = null;
    user = new ObjectifyGenericDAO<UserAccount>(UserAccount.class).getByProperty("uniqueId", uniqueId);
    if (user != null)
      return user;
    user = new ObjectifyGenericDAO<Company>(Company.class).getByProperty("uniqueId", uniqueId);
    if (user != null)
View Full Code Here

Examples of com.cloud.user.UserAccount

                    throw new CloudAuthenticationException("Unable to find the domain from the path " + domainPath);
                }
            }
        }

        UserAccount userAcct = _accountMgr.authenticateUser(username, password, domainId, loginIpAddress, requestParameters);
        if (userAcct != null) {
            String timezone = userAcct.getTimezone();
            float offsetInHrs = 0f;
            if (timezone != null) {
                TimeZone t = TimeZone.getTimeZone(timezone);
                s_logger.info("Current user logged in under " + timezone + " timezone");

                java.util.Date date = new java.util.Date();
                long longDate = date.getTime();
                float offsetInMs = (t.getOffset(longDate));
                offsetInHrs = offsetInMs / (1000 * 60 * 60);
                s_logger.info("Timezone offset from UTC is: " + offsetInHrs);
            }

            Account account = _accountMgr.getAccount(userAcct.getAccountId());

            // set the userId and account object for everyone
            session.setAttribute("userid", userAcct.getId());
            UserVO user = (UserVO) _accountMgr.getActiveUser(userAcct.getId());
            if(user.getUuid() != null){
                session.setAttribute("user_UUID", user.getUuid());
            }
           
            session.setAttribute("username", userAcct.getUsername());
            session.setAttribute("firstname", userAcct.getFirstname());
            session.setAttribute("lastname", userAcct.getLastname());
            session.setAttribute("accountobj", account);
            session.setAttribute("account", account.getAccountName());
           
            session.setAttribute("domainid", account.getDomainId());
            DomainVO domain = (DomainVO) _domainMgr.getDomain(account.getDomainId());
            if(domain.getUuid() != null){
                session.setAttribute("domain_UUID", domain.getUuid());
            }
           
            session.setAttribute("type", Short.valueOf(account.getType()).toString());
            session.setAttribute("registrationtoken", userAcct.getRegistrationToken());
            session.setAttribute("registered", new Boolean(userAcct.isRegistered()).toString());

            if (timezone != null) {
                session.setAttribute("timezone", timezone);
                session.setAttribute("timezoneoffset", Float.valueOf(offsetInHrs).toString());
            }
View Full Code Here

Examples of com.cloud.user.UserAccount

                    throw new CloudAuthenticationException("Unable to find the domain from the path " + domainPath);
                }
            }
        }

        UserAccount userAcct = _accountMgr.authenticateUser(username, password, domainId, loginIpAddress, requestParameters);
        if (userAcct != null) {
            String timezone = userAcct.getTimezone();
            float offsetInHrs = 0f;
            if (timezone != null) {
                TimeZone t = TimeZone.getTimeZone(timezone);
                s_logger.info("Current user logged in under " + timezone + " timezone");

                java.util.Date date = new java.util.Date();
                long longDate = date.getTime();
                float offsetInMs = (t.getOffset(longDate));
                offsetInHrs = offsetInMs / (1000 * 60 * 60);
                s_logger.info("Timezone offset from UTC is: " + offsetInHrs);
            }

            Account account = _accountMgr.getAccount(userAcct.getAccountId());

            // set the userId and account object for everyone
            session.setAttribute("userid", userAcct.getId());
            UserVO user = (UserVO) _accountMgr.getActiveUser(userAcct.getId());
            if(user.getUuid() != null){
                session.setAttribute("user_UUID", user.getUuid());
            }

            session.setAttribute("username", userAcct.getUsername());
            session.setAttribute("firstname", userAcct.getFirstname());
            session.setAttribute("lastname", userAcct.getLastname());
            session.setAttribute("accountobj", account);
            session.setAttribute("account", account.getAccountName());

            session.setAttribute("domainid", account.getDomainId());
            DomainVO domain = (DomainVO) _domainMgr.getDomain(account.getDomainId());
            if(domain.getUuid() != null){
                session.setAttribute("domain_UUID", domain.getUuid());
            }

            session.setAttribute("type", Short.valueOf(account.getType()).toString());
            session.setAttribute("registrationtoken", userAcct.getRegistrationToken());
            session.setAttribute("registered", new Boolean(userAcct.isRegistered()).toString());

            if (timezone != null) {
                session.setAttribute("timezone", timezone);
                session.setAttribute("timezoneoffset", Float.valueOf(offsetInHrs).toString());
            }
View Full Code Here

Examples of com.cloud.user.UserAccount

  @Override
  public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters ) {
    if (s_logger.isDebugEnabled()) {
            s_logger.debug("Retrieving user: " + username);
        }
        UserAccount user = _userAccountDao.getUserAccount(username, domainId);
        if (user == null) {
            s_logger.debug("Unable to find user with " + username + " in domain " + domainId);
            return false;
        }
       
        if (!user.getPassword().equals(encode(password))) {
            s_logger.debug("Password does not match");
            return false;
        }
    return true;
  }
View Full Code Here

Examples of com.cloud.user.UserAccount

  public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters ) {
    if (s_logger.isDebugEnabled()) {
            s_logger.debug("Retrieving user: " + username);
        }

        UserAccount user = _userAccountDao.getUserAccount(username, domainId);
        if (user == null) {
            s_logger.debug("Unable to find user with " + username + " in domain " + domainId);
            return false;
        }
       
        if (!user.getPassword().equals(password)) {
            s_logger.debug("Password does not match");
            return false;
        }
    return true;
  }
View Full Code Here

Examples of com.cloud.user.UserAccount

    @Override
    public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters ) {
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Retrieving user: " + username);
        }
        UserAccount user = _userAccountDao.getUserAccount(username, domainId);
        if (user == null) {
            s_logger.debug("Unable to find user with " + username + " in domain " + domainId);
            return false;
        }

        String url = _configDao.getValue(LDAPParams.hostname.toString());
        if (url==null){
            s_logger.debug("LDAP authenticator is not configured.");
            return false;
        }
        String port = _configDao.getValue(LDAPParams.port.toString());
        String queryFilter = _configDao.getValue(LDAPParams.queryfilter.toString());
        String searchBase = _configDao.getValue(LDAPParams.searchbase.toString());
        Boolean useSSL = Boolean.valueOf(_configDao.getValue(LDAPParams.usessl.toString()));
        String bindDN = _configDao.getValue(LDAPParams.dn.toString());
        String bindPasswd = _configDao.getValue(LDAPParams.passwd.toString());
        String trustStore = _configDao.getValue(LDAPParams.truststore.toString());
        String trustStorePassword = _configDao.getValue(LDAPParams.truststorepass.toString());

        try {
            // get all params
            Hashtable<String, String> env = new Hashtable<String, String>(11);
            env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
            String protocol = "ldap://" ;
            if (useSSL){
                env.put(Context.SECURITY_PROTOCOL, "ssl");
                protocol="ldaps://" ;
                System.setProperty("javax.net.ssl.trustStore", trustStore);
                System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
            }
            env.put(Context.PROVIDER_URL, protocol + url  + ":" + port);

            if (bindDN != null && bindPasswd != null){
                env.put(Context.SECURITY_PRINCIPAL, bindDN);
                env.put(Context.SECURITY_CREDENTIALS, bindPasswd);
            }
            else {
                // Use anonymous authentication
                env.put(Context.SECURITY_AUTHENTICATION, "none");
            }
            // Create the initial context
            DirContext ctx = new InitialDirContext(env);
            // use this context to search

            // substitute the queryFilter with this user info
            queryFilter = queryFilter.replaceAll("\\%u", username);
            queryFilter = queryFilter.replaceAll("\\%n", user.getFirstname() + " " + user.getLastname());
            queryFilter = queryFilter.replaceAll("\\%e", user.getEmail());


            SearchControls sc = new SearchControls();
            String[] searchFilter = { "dn" };
            sc.setReturningAttributes(new String[0]); //return no attributes
View Full Code Here

Examples of com.cloud.user.UserAccount

        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
    }

    @Override
    public void execute(){
        UserAccount user = _accountService.lockUser(getId());
        if (user != null){
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
View Full Code Here

Examples of com.cloud.user.UserAccount

    }

    @Override
    public void execute(){
        UserContext.current().setEventDetails("UserId: "+getId());
        UserAccount user = _regionService.enableUser(this);

        if (user != null){
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
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.