@param string $region
@param mixed $credential

@return CodeDeployClient|null
6167
public function getCD($region, $credential)
    {
        if (!$config = $this->getConfigWithCredentials($region, $credential)) {
            return null;
        }

        return $this->aws->createCodeDeploy($config);
    }
677976
public function retrieveByCredentials(array $credentials)
    {
        // First we will add each credential element to the query as a where clause.
        // Then we can execute the query and, if we found a user, return it in a
        // generic "user" object that will be utilized by the Guard instances.
        $query = array();
        $coll = $this->conn->{$this->table};

        foreach ($credentials as $key => $value)
        {
            if ( ! str_contains($key, 'password'))
            {
                $query[$key] = $value;
            }
        }

        // Now we are ready to execute the query to see if we have an user matching
        // the given credentials. If not, we will just return nulls and indicate
        // that there are no matching users for these given credential arrays.
        $user = $coll->findOne($query);

        if ( ! is_null($user))
        {
            return new MongolUser((array) $user);
        }
    }
516323
@FFDCIgnore(NamingException.class)
    public TimedDirContext createDirContext(String principal, byte[] credential) throws NamingException {
        final String METHODNAME = "createDirContext(String, byte[])";

        String activeURL = getActiveURL();
        Hashtable<String, Object> environment = getEnvironment(URLTYPE_SINGLE, activeURL);
        environment.put(Context.SECURITY_PRINCIPAL, principal);
        environment.put(Context.SECURITY_CREDENTIALS, credential);

        SSLUtilImpl sslUtil = new SSLUtilImpl();
        Properties currentSSLProps = sslUtil.getSSLPropertiesOnThread();
        try {
            if (iSSLAlias != null) {
                try {
                    if (tc.isDebugEnabled())
                        Tr.debug(tc, METHODNAME + " Use WAS SSL Configuration.");
                    sslUtil.setSSLAlias(iSSLAlias, environment);
                } catch (Exception ssle) {
                    throw new NamingException(ssle.getMessage());
                }
            }

            // Set the classloader so that a class in the package can be loaded by JNDI
            ClassLoader origCL = getContextClassLoader();
            setContextClassLoader(getClass());
            try {
                TimedDirContext ctx = null;
                try {
                    ctx = new TimedDirContext(environment, getConnectionRequestControls(), roundToSeconds(System.currentTimeMillis()));
                } catch (NamingException e) {
                    if (!isConnectionException(e)) {
                        throw e;
                    } else {
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "Encountered an exception while creating a context: " + e.getMessage());
                    }

                    // Get the Next URL
                    environment = getEnvironment(URLTYPE_SEQUENCE, getNextURL(activeURL));
                    // Reset the security credentials on the environment.
                    environment.put(Context.SECURITY_PRINCIPAL, principal);
                    environment.put(Context.SECURITY_CREDENTIALS, credential);

                    ctx = new TimedDirContext(environment, getConnectionRequestControls(), roundToSeconds(System.currentTimeMillis()));
                    String newURL = getProviderURL(ctx);
                    long creationTimeMillisec = System.currentTimeMillis();

                    synchronized (iLock) {
                        // Refresh context pool if another thread hasn't already done so
                        if (creationTimeMillisec > iPoolCreateTimestampMillisec) {
                            createContextPool(iLiveContexts, newURL);
                            ctx.setCreateTimestamp(iPoolCreateTimestampSeconds);
                        }
                    }
                }
                return ctx;
            } finally {
                setContextClassLoader(origCL);
            }
        } finally {
            sslUtil.setSSLPropertiesOnThread(currentSSLProps);
        }
    }
822142
public function getCredential($key)
    {
        return !isset($this->credentials[$key]) ? null : $this->credentials[$key];
    }
500795
private function getSecret(AWSStaticCredential $credential)
    {
        if (!$secret = $credential->secret()) {
            return '';
        }

        return $secret = $this->encryption->decrypt($secret);
    }
687889
@Override
   public Credential getPrefillCredential()
   {
      if (this.prefillCredential == null)
      {
         if (cm.getSubjectFactory() == null || cm.getConnectionManagerConfiguration().getSecurityDomain() == null)
         {
            prefillCredential = new Credential(null, null);
         }
         else
         {
            prefillCredential =
               new Credential(SecurityActions.createSubject(cm.getSubjectFactory(),
                                                            cm.getConnectionManagerConfiguration().getSecurityDomain(),
                                                            cm.getManagedConnectionFactory()),
                              null);
         }
      }
      return this.prefillCredential;
   }
627063
protected function prepareError($http, $credential = [])
    {
        if (!$http->isSuccess()) {
            $this->code = -1;
            $this->message = '很抱歉,网络繁忙,请稍后再试';
        } else {
            // TODO 简化各类错误的处理
            if (isset($http['errcode']) && $http['errcode'] !== 0) {
                $code = $http['errcode'];
                $message = $http['errmsg'];
            } elseif (isset($http['base_resp'])) {
                $code = $http['base_resp']['errcode'];
                $message = $http['base_resp']['errmsg'];
            } elseif (isset($http['error_code'])) {
                $code = $http['error_code'];
                $message = $http['error_msg'];
            } else {
                $code = 1000;
                $message = '未知返回' . $http->getResponseText();
            }

            $this->code = -abs($code);
            $this->message = isset($this->messages[$code]) ? $this->messages[$code] : $message;
            $this->logError($http, $credential);
        }

        return false;
    }
1134355
public static function create(
        string $description,
        string $secret,
        array $permittedIps = null,
        array $customHeaders = [],
        ApiContext $apiContext = null
    ): BunqResponseInt {
        if (is_null($apiContext)) {
            throw new BunqException(self::ERROR_API_CONTEXT_IS_NULL);
        }

        $apiClient = new ApiClient($apiContext);
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                []
            ),
            [
                self::FIELD_DESCRIPTION => $description,
                self::FIELD_SECRET => $secret,
                self::FIELD_PERMITTED_IPS => $permittedIps,
            ],
            $customHeaders
        );

        return BunqResponseInt::castFromBunqResponse(
            static::processForId($responseRaw)
        );
    }
397785
public function getStaticCredentials(AWSStaticCredential $credential)
    {
        if ($this->useHostCredentials) {
            return $this->hostCredentials;
        }

        if (!$secret = $this->getSecret($credential)) {
            $this->logger->critical(self::ERR_INVALID_SECRET);
            return null;
        }

        return [
            'key' => $credential->key(),
            'secret' => $secret,
        ];
    }
676117
public function setRegion($region)
	{
		if ( ! $region instanceof Region)
		{
			$region = new Region($region);
		}
		$this->region = $region;

		return $this;
	}
581177
public function retrieveByCredentials( array $credentials )
	{
		if ( empty( $credentials ) )
			return null;

		// First we will add each credential element to the query as a where clause.
		// Then we can execute the query and, if we found a user, return it in a
		// Eloquent User "model" that will be utilized by the Guard instances.
		$query = $this->createUsrModel()->newQuery();

		foreach ( $credentials as $key => $value )
			if ( !Str::contains( $key, 'password' ) )
				$query->where( $key, $value );

		return $query->first();
	}
163306
public static Credential getCredential(final RequestContext context) {
        val cFromRequest = (Credential) context.getRequestScope().get(PARAMETER_CREDENTIAL);
        val cFromFlow = (Credential) context.getFlowScope().get(PARAMETER_CREDENTIAL);
        val cFromConversation = (Credential) context.getConversationScope().get(PARAMETER_CREDENTIAL);

        var credential = cFromRequest;
        if (credential == null || StringUtils.isBlank(credential.getId())) {
            credential = cFromFlow;
        }
        if (credential == null || StringUtils.isBlank(credential.getId())) {
            credential = cFromConversation;
            if (credential != null && !StringUtils.isBlank(credential.getId())) {
                context.getFlowScope().put(PARAMETER_CREDENTIAL, credential);
            }
        }

        if (credential == null) {
            val session = context.getFlowExecutionContext().getActiveSession();
            credential = session.getScope().get(PARAMETER_CREDENTIAL, Credential.class);
        }
        if (credential != null && StringUtils.isBlank(credential.getId())) {
            return null;
        }
        return credential;
    }
493453
public GitRepositoryBuilder credentialProvider(final String username, final String password) {
        if (StringUtils.hasText(username)) {
            this.credentialsProviders.add(new UsernamePasswordCredentialsProvider(username, password));
        }
        return this;
    }
634311
public function session($clientCustomerId = null, $credentials = null)
    {
        $credentials = (is_null($credentials)) ? $this->oauth2Credentials($clientCustomerId) : $credentials;

        return ((new AdWordsSessionBuilder())
            ->from($this->configuration($clientCustomerId))
            ->withOAuth2Credential($credentials)
            ->build());
    }
962614
public function getByCredentials(array $credentials) : ?Authenticatable
    {
        if (empty($credentials)) {
            return null;
        }

        // First we will add each credential element to the query as a where clause.
        // Then we can execute the query and, if we found a user, return it in a
        // Eloquent User "model" that will be utilized by the Guard instances.
        $query = $this->getModel()->newQuery();

        foreach ($credentials as $key => $value) {
            if (! Str::contains($key, 'password')) {
                $query->where($key, $value);
            }
        }

        return $query->first();
    }
819859
public function authenticate(Credential $credential)
    {
        $username = $credential->username;
        $password = $credential->password;

        if (!$username || !$password) {
            $this->status = Authentication::EMPTY_CREDENTIAL;

            return false;
        }

        foreach ($this->users as $user) {
            if (!isset($user['username'])) {
                continue;
            }

            if ($user['username'] !== $username) {
                continue;
            }

            if (!isset($user['password'])) {
                $this->status = Authentication::INVALID_CREDENTIAL;

                return false;
            }

            $handler = $this->getVerifyHandler();

            if (call_user_func_array($handler, [$password, $user['password']])) {
                $this->status = Authentication::SUCCESS;

                return true;
            }

            $this->status = Authentication::INVALID_CREDENTIAL;

            return false;
        }

        $this->status = Authentication::USER_NOT_FOUND;

        return false;
    }
453220
protected function getS3Client($region)
    {
        $config = config('aws');

        return new S3Client([
            'credentials' => [
                'key'    => Arr::get($config, 'key'),
                'secret' => Arr::get($config, 'secret'),
            ],
            'region'  => $region,
            'version' => 'latest',
        ]);
    }