/*
This could replaced later with something more inteligent
where the user would set if dcau is required or not, etc.
182573
protected void negotiateDCAU(FTPClient src, FTPClient dst)
        throws IOException, FTPException {
        if (src instanceof GridFTPClient) {
            // src: dcau can be on or off
            if (dst instanceof GridFTPClient) {
                // dst: dca can be on or off
                GridFTPClient s = (GridFTPClient)src;
                GridFTPClient d = (GridFTPClient)dst;

                if (src.isFeatureSupported("DCAU") &&
                    dst.isFeatureSupported("DCAU")) {

                    setDCAU(s, getDCAU());
                    setDCAU(d, getDCAU());

                } else {
                    setDCAU(s, false);
                    setDCAU(d, false);
                    setDCAU(false);
                }

            } else {
                // dst: no dcau supported - disable src
                setDCAU((GridFTPClient)src, false);
                setDCAU(false);
            }
        } else {
            // src: no dcau
            if (dst instanceof GridFTPClient) {
                // dst: just disable dcau
                setDCAU((GridFTPClient)dst, false);
            } else {
                // dst: no dcau
                // we are all set then
            }
            setDCAU(false);
        }
    }
471936
function(provider) {
        if (!this.isCurrent()) {
          return;
        }
        if (_.isString(provider)) {
          provider = AV.User._authProviders[provider];
        }
        if (provider && provider.deauthenticate) {
          provider.deauthenticate();
        }
      }
295450
public boolean isCasAuthenticationOldForMaxAgeAuthorizationRequest(final WebContext context) {
        return isCasAuthenticationAvailable(context)
            .filter(a -> isCasAuthenticationOldForMaxAgeAuthorizationRequest(context, a))
            .isPresent();
    }
1030351
def is_required(action):
    '''
    
    '''
    return not isinstance(action, _SubParsersAction) and (
    action.required == True and action.nargs not in ['*', '?'])
1180372
protected function checkAuthInput()
    {
        
        $defaults = array('user' => null,
						  'password' => null);
						  
		$this->options = array_merge($defaults, $this->options);
		
		if ($this->options['user'] == null) {
			$this->err("Please provide a value for the 'user' parameter.", true);
		}
		else if ($this->options['password'] == null) {
			$this->err("Please provide a value for the 'password' parameter.", true);
		}
        
    }
751231
function init(ctx) {
        var server = ctx.server;

        if (!privateKey) {
            throw new Error('Please set config.security.token.privateKey');
        }

        server.ext('onPreAuth', validateToken);

        return new Q(ctx);
    }
466386
def dcc_accept(self, mask, filepath, port, pos):
        """"""
        return self.dcc.resume(mask, filepath, port, pos)
407779
public boolean hasValidCredentials() {
        String accessToken = storage.retrieveString(KEY_ACCESS_TOKEN);
        String refreshToken = storage.retrieveString(KEY_REFRESH_TOKEN);
        String idToken = storage.retrieveString(KEY_ID_TOKEN);
        Long expiresAt = storage.retrieveLong(KEY_EXPIRES_AT);

        return !(isEmpty(accessToken) && isEmpty(idToken) ||
                expiresAt == null ||
                expiresAt <= getCurrentTimeInMillis() && refreshToken == null);
    }
866100
function setDefaultUser (kontx, next) {
        var a = _.clone(kontx.args);

        if (a.length === 0) { //No args are sent in, set first to be user id
            a[0] = kontx.user._id;
        }
        else if (_.has(a[0], 'include') || _.has(a[0], 'exclude')) { // If first arg is options then reassign
            a[0] = kontx.user._id;
            a[1] = kontx.args[0];
        }

        kontx.args = a;
        next();
    }
1117075
function setGAUser(auth) {
  if (auth && auth.uid) {
    ReactGA.set({ userId: auth.uid })
  }
}
301544
function validateAWSConfig(awsConfig){
    return validateAccessKeyID(awsConfig.accessKeyId) &&
    validateSecretAccessKey(awsConfig.secretAccessKey) &&
    validateAWSRegion(awsConfig.region)
}
347537
function(cName){
        if(validate.isEmpty(cName)){
            validateParams._warn('ignoring invalid coercion name: ' + cName);
        }
        if(validate.isFunction(validateParams.coercions[cName])){
            return validateParams.coercions[cName];
        }else{
            validateParams._warn("no coercion named '" + cName + "' defined - ignoring");
        }
        return undefined;
    }
733500
function(value) {
        if (attr.required && ctrl.$isEmpty(value)) {
          ctrl.$setValidity('required', false);
          return;
        } else {
          ctrl.$setValidity('required', true);
          return value;
        }
      }
246879
function isAuthorized(acl, user) {
    acl = u.str(acl).toUpperCase();
    user = u.str(user).toUpperCase();
    if (user && user === acl) return true;
    if (!aclRe[acl]) {
      aclRe[acl] = reAccess(sessionOpts.acl[acl] || process.env['ACL_' + acl]);
    }
    return aclRe[acl].test(user) || aclRe.ADMIN.test(user);
  }
551866
def http_basic_auth_login_required(func=None):
    """"""

    wrapper = auth.set_authentication_predicate(http_basic_auth_check_user, [auth.user_is_authenticated])

    # If @http_basic_auth_login_required() is used (with parenthesis)
    if func is None:
        return wrapper

    # If @http_basic_auth_login_required is used without parenthesis
    return wrapper(func)
1314642
def _pv_required(opts, key, is_required=true)
        if is_required
          if (opts.has_key?(key.to_s) && !opts[key.to_s].nil?) ||
              (opts.has_key?(key.to_sym) && !opts[key.to_sym].nil?)
            true
          else
            raise ValidationFailed, "Required argument #{key} is missing!"
          end
        end
      end
749295
private Optional<String> guessScmAuthor(DefaultIssue issue, Component component) {
    String author = null;
    if (scmChangesets != null) {
      author = IssueLocations.allLinesFor(issue, component.getUuid())
        .filter(scmChangesets::hasChangesetForLine)
        .mapToObj(scmChangesets::getChangesetForLine)
        .filter(c -> StringUtils.isNotEmpty(c.getAuthor()))
        .max(Comparator.comparingLong(Changeset::getDate))
        .map(Changeset::getAuthor)
        .orElse(null);
    }
    return Optional.ofNullable(defaultIfEmpty(author, lastCommitAuthor));
  }