public void setSecurity(Security value)
    {
        security = value;
        String userName = security.getUserName();
        String passwordText = security.getPassword();
        String account = security.getAccount();
        if (userName != null && userName.trim().length() != 0)
        {
            // If no password is given and the userName contains "@" and an account is given, then
            // append the account to the username (e.g. joe@1234567890).
            if (passwordText == null || passwordText.length() == 0)
            {
                if (userName.indexOf("@") < 0 && account != null && account.length() > 0)
                {
                    userName += "@" + account;
                }
            }
        }
        else if (account.trim().length() != 0)
        {
            userName = security.getAccount().trim();
            passwordText = security.getLicense().trim();
        }
        else
        {
            throw new IllegalStateException("Must supply either a " +
                    "valid Account or UserName in the " +
                    "avatax4j.properties file");
        }

        SecurityHeader securityHeader = new SecurityHeader();
        UsernameToken usernameToken = new UsernameToken();
        usernameToken.setUsername(userName);
        Password password = new Password();
        password.setType(PASSWORD_TEXT_TYPE);
        password.set_value(passwordText);
        usernameToken.setPassword(password);
        securityHeader.setUsernameToken(usernameToken);
        setHeader(WSSE_NAMESPACE, "Security", securityHeader);
    }