Returns Recommendation Service credentials based on current siteAccess or mandatorId.

@param null|int $mandatorId
@param null|string $siteAccess

@return array
496809
public function getRecommendationServiceCredentials($mandatorId = null, $siteAccess = null)
    {
        $siteAccesses = $this->getSiteAccesses($mandatorId, $siteAccess);
        $siteAccess = end($siteAccesses);

        if ($siteAccess === self::SYSTEM_DEFAULT_SITEACCESS_NAME) {
            $siteAccess = null;
        }

        $customerId = $this->configResolver->getParameter('yoochoose.customer_id', 'ez_recommendation', $siteAccess);
        $licenceKey = $this->configResolver->getParameter('yoochoose.license_key', 'ez_recommendation', $siteAccess);

        return [$customerId, $licenceKey];
    }
1368355
public function getTemporaryCredentials()
    {
        $uri = $this->urlTemporaryCredentials();

        $client = $this->createHttpClient();

        $header = $this->temporaryCredentialsProtocolHeader($uri);
        $authorizationHeader = array('Authorization' => $header);
        $headers = $this->buildHttpClientHeaders($authorizationHeader);

        try {
            $response = $client->post($uri, [
                'headers' => $headers,
            ]);
        } catch (BadResponseException $e) {
            return $this->handleTemporaryCredentialsBadResponse($e);
        }

        return $this->createTemporaryCredentials((string) $response->getBody());
    }
1232590
private function getCredentials()
    {
        $options = ['--config ui.interactive' => 'no', '--config auth.x.prefix' => 'http://'];

        $repository = $this->credentials->getCurrentRepository();
        if ($user = $repository->username) {
            $options['--config auth.x.username'] = $user;
        }
        if ($pass = $repository->password) {
            $options['--config auth.x.password'] = $pass;
        }

        return $options;
    }
858859
public function getCredentials()
    {
        $result = $this->getSettingsByGroup('credentials');
        // No separate key for now.
        $result[Tag::EmailOnWarning] = $result[Tag::EmailOnError];
        return $result;
    }
68650
public function acquireAccessToken() {

        switch ($this->_credentials->getCredentialType()) {
            case AzureAdTokenCredentialType::USER_SECRET_CREDENTIAL:
                return $this->_azureAdClient->acquireTokenWithUserCredentials(
                        $this->_credentials->getAzureEnvironment()->getMediaServicesResource(),
                        $this->_credentials->getAzureEnvironment()->getMediaServicesSdkClientId(),
                        $this->_credentials->getCredential()->getUsername(),
                        $this->_credentials->getCredential()->getPassword());

            case AzureAdTokenCredentialType::SERVICE_PRINCIPAL_WITH_CLIENT_SYMMETRIC_KEY:
                return $this->_azureAdClient->acquireTokenWithSymmetricKey(
                    $this->_credentials->getAzureEnvironment()->getMediaServicesResource(),
                    $this->_credentials->getCredential()->getClientId(),
                    $this->_credentials->getCredential()->getClientSecret());

            case AzureAdTokenCredentialType::SERVICE_PRINCIPAL_WITH_CERTIFICATE:
                return $this->_azureAdClient->acquireTokenWithAsymmetricKey(
                    $this->_credentials->getAzureEnvironment()->getMediaServicesResource(),
                    $this->_credentials->getCredential());

            case AzureAdTokenCredentialType::USER_CREDENTIAL:
                throw new \Symfony\Component\DependencyInjection\Exception\RuntimeException(
                    "Interactive user credential is currently not supported by the php sdk");

            default:
                throw new \Symfony\Component\DependencyInjection\Exception\RuntimeException(
                        "Unknown token credential type");
        }
    }
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,
        ];
    }
975018
public function getAuthority()
    {
        $authority = null;

        if (null !== $this->host) {

            if (null !== $this->userinfo) {
                $authority .= $this->userinfo . '@';
            }
            $authority .= $this->host;
            if (null !== $this->port) {
                $authority .= ':' . $this->port;
            }
        }

        return $authority;
    }
1076745
public function getRoleForSite($idSite)
    {
        if ($this->hasSuperUserAccess
            || in_array($idSite, $this->getSitesIdWithAdminAccess())
        ) {
            return 'admin';
        }

        if (in_array($idSite, $this->getSitesIdWithWriteAccess())) {
            return 'write';
        }

        if (in_array($idSite, $this->getSitesIdWithViewAccess())) {
            return 'view';
        }

        return 'noaccess';
    }
45010
@GET
    @Path("role")
    @Produces(MediaType.APPLICATION_JSON)
    @HttpCache
    public List<RRoleDto> getRoles()
    {
        DbConn cnx = null;
        try
        {
            cnx = Helpers.getDbSession();
            return MetaService.getRoles(cnx);
        }
        finally
        {
            Helpers.closeQuietly(cnx);
        }
    }
843153
@JsonIgnore
	public Map<String, String> getCredentials() {
		if (getId() == null) {
			return Collections.emptyMap();
		} else {
			Map<String, String> keys = new LinkedHashMap<String, String>(2);
			keys.put("accessKey", getId());
			keys.put("secretKey", getSecret());
			return keys;
		}
	}
465065
private function _getRememberMeCredentials()
    {
        $credentials = array();
        $remember = get_hash('AN_LOGIN_REMEMBER');

        if (isset($_COOKIE[$remember]) && !empty($_COOKIE[$remember])) {
            $key = get_hash('AN_LOGIN_REMEMBER', 'md5');
            $crypt = $this->getService('anahita:encrypter', array('key' => $key, 'cipher' => 'AES-256-CBC'));
            $cookie = $crypt->decrypt($_COOKIE[$remember]);

            try {
                $credentials = (array) unserialize($cookie);
            } catch (RuntimeException $e) {
                error_log($e->getMessage());
            }
        }

        return $credentials;
    }
1374370
public function getRoles()
    {
        $user       = $this;
        $comparator = function ($level) use ($user) {
            return $user->hasAccessLevel($level);
        };

        // Fallback for PHP < 5.6 which do not support ARRAY_FILTER_USE_KEY.
        if (version_compare(PHP_VERSION, '5.6', '<')) {
            $filtered = array_flip(array_filter(array_keys(self::$roleMap), $comparator));
            return array_values(array_intersect_key(self::$roleMap, $filtered));
        }

        return array_values(array_filter(self::$roleMap, $comparator, ARRAY_FILTER_USE_KEY));
    }
845852
public function getService($serviceClass, $clientCustomerId = null, $credentials = null)
    {
        $adwordsServices = new AdWordsServices();

        $session = $this->session($clientCustomerId, $credentials);

        return $adwordsServices->get($session, $serviceClass);
    }
54217
public function getAccessTokenCacheFile()
	{
		if (empty($this->accessTokenCacheFile))
			return null;

		return $this->accessTokenCacheFile . '_' . $this->siteToken() . '-' . $this->clientId();
	}
727556
public function setSiteAccess(SiteAccess $siteAccess = null)
    {
        if ($this->matcherFactory instanceof SiteAccessAware) {
            $this->matcherFactory->setSiteAccess($siteAccess);
        }
    }
1210036
public function serviceCredentials()
    {
        if (!isset($this->creds)) {
            $filepath = $this->getCredentialsFilepath();
            $this->creds = Json::parseFile($filepath);
        }
        return $this->creds;
    }
85000
def _find_credentials():
    '''
    
    '''
    usernames = []
    usernames.append(__pillar__['proxy'].get('admin_username', 'root'))
    if 'fallback_admin_username' in __pillar__.get('proxy'):
        usernames.append(__pillar__['proxy'].get('fallback_admin_username'))

    for user in usernames:
        for pwd in __pillar__['proxy']['passwords']:
            r = salt.modules.dracr.get_chassis_name(
                host=__pillar__['proxy']['host'],
                admin_username=user,
                admin_password=pwd)
            # Retcode will be present if the chassis_name call failed
            try:
                if r.get('retcode', None) is None:
                    __opts__['proxy']['admin_username'] = user
                    __opts__['proxy']['admin_password'] = pwd
                    return (user, pwd)
            except AttributeError:
                # Then the above was a string, and we can return the username
                # and password
                __opts__['proxy']['admin_username'] = user
                __opts__['proxy']['admin_password'] = pwd
                return (user, pwd)

    logger.debug('grains fx2.find_credentials found no valid credentials, using Dell default')
    return ('root', 'calvin')