Gets the ZAP API URL to a challenge endpoint.

@param challenge the last segment of the path for the challenge endpoint
@return a ZAP API URL to access the the challenge endpoint
350157
public String getCallbackUrl(String challenge) {
        return "http://"
                + Model.getSingleton().getOptionsParam().getProxyParam().getProxyIp() + ":"
                + Model.getSingleton().getOptionsParam().getProxyParam().getProxyPort() + "/"
                + getPrefix() + "/"
                + challenge;
    }
979142
public static byte[] serialize(Challenge challenge, byte[] hmacSecret) {
    MiniMessagePack.Packer packer = new MiniMessagePack.Packer();
    packer.pack(VERSION);
    packer.pack(CHALLENGE_MAGIC);
    packer.pack(challenge.getUniqueData());
    packer.pack(challenge.getValidFromTimestamp());
    packer.pack(challenge.getValidToTimestamp());
    packer.pack(challenge.getFingerprint().getBytes());
    packer.pack(challenge.getServerName());
    packer.pack(challenge.getUserName());
    byte[] bytes = packer.getBytes();
    byte[] mac = getAuthenticationCode(hmacSecret, bytes);
    packer.pack(mac);
    return packer.getBytes();
  }
84239
private Boolean supportsMessageProtection(String url, Map<String, String> challengeMap) {

        if (!"true".equals(challengeMap.get("supportspop"))) {
            return false;
        }

        // Message protection is enabled only for subset of keys operations.
        if (!url.toLowerCase().contains("/keys/")) {
            return false;
        }

        String[] tokens = url.split("\\?")[0].split("/");
        return supportedMethods.contains(tokens[tokens.length - 1]);
    }
114402
def challenge_response(self, challenge, mode='HMAC', slot=1, variable=True, may_block=True):
        
        if not self.capabilities.have_challenge_response(mode):
            raise yubikey_base.YubiKeyVersionError("%s challenge-response unsupported in YubiKey %s" % (mode, self.version()) )
        return self._challenge_response(challenge, mode, slot, variable, may_block)
192855
def open_url(zap_helper, url):
    """"""
    console.info('Accessing URL {0}'.format(url))
    zap_helper.open_url(url)
309190
public function getChallengeApi()
    {
        if (!$this->apis->has('challenge')) {
            $this->apis->set('challenge', new Challenge($this));
        }

        return $this->apis->get('challenge');
    }
7389
def get_cert(zappa_instance, log=LOGGER, CA=DEFAULT_CA):
    
    out = parse_account_key()
    header = get_boulder_header(out)
    accountkey_json = json.dumps(header['jwk'], sort_keys=True, separators=(',', ':'))
    thumbprint = _b64(hashlib.sha256(accountkey_json.encode('utf8')).digest())

    # find domains
    domains = parse_csr()

    # get the certificate domains and expiration
    register_account()

    # verify each domain
    for domain in domains:
        log.info("Verifying {0}...".format(domain))

        # get new challenge
        code, result = _send_signed_request(CA + "/acme/new-authz", {
            "resource": "new-authz",
            "identifier": {"type": "dns", "value": domain},
        })
        if code != 201:
            raise ValueError("Error requesting challenges: {0} {1}".format(code, result))

        challenge = [ch for ch in json.loads(result.decode('utf8'))['challenges'] if ch['type'] == "dns-01"][0]
        token = re.sub(r"[^A-Za-z0-9_\-]", "_", challenge['token'])
        keyauthorization = "{0}.{1}".format(token, thumbprint).encode('utf-8')

        # sha256_b64
        digest = _b64(hashlib.sha256(keyauthorization).digest())

        zone_id = zappa_instance.get_hosted_zone_id_for_domain(domain)
        if not zone_id:
            raise ValueError("Could not find Zone ID for: " + domain)
        zappa_instance.set_dns_challenge_txt(zone_id, domain, digest)  # resp is unused

        print("Waiting for DNS to propagate..")

        # What's optimal here?
        # import time  # double import; import in loop; shadowed import
        time.sleep(45)

        # notify challenge are met
        code, result = _send_signed_request(challenge['uri'], {
            "resource": "challenge",
            "keyAuthorization": keyauthorization.decode('utf-8'),
        })
        if code != 202:
            raise ValueError("Error triggering challenge: {0} {1}".format(code, result))

        # wait for challenge to be verified
        verify_challenge(challenge['uri'])

        # Challenge verified, clean up R53
        zappa_instance.remove_dns_challenge_txt(zone_id, domain, digest)

    # Sign
    result = sign_certificate()
    # Encode to PEM format
    encode_certificate(result)

    return True
983465
public GetStatTopUrlResponse getStatTopUrl(GetStatTopUrlRequest request) {
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, STAT, "topn", "url");
        
        if (request.getStartTime() != null) {
            internalRequest.addParameter("startTime", DateUtils.formatAlternateIso8601Date(request.getStartTime()));
        }
        
        if (request.getEndTime() != null) {
            internalRequest.addParameter("endTime", DateUtils.formatAlternateIso8601Date(request.getEndTime()));
        }
        
        if (request.getDomain() != null) {
            internalRequest.addParameter("domain", request.getDomain());
        }
        
        if (request.getPeriod() != null) {
            internalRequest.addParameter("period", String.valueOf(request.getPeriod()));
        }
        
        return this.invokeHttpClient(internalRequest, GetStatTopUrlResponse.class);
    }
1273742
def get_sid(self):
        """"""
        base_url = u'%s/login_sid.lua' % self.__fritz_url
        get_challenge = None
        try:
            get_challenge = urllib2.urlopen(base_url).read().decode('ascii')
        except urllib2.HTTPError as exception:
            print('HTTPError = ' + str(exception.code))
        except urllib2.URLError as  exception:
            print('URLError = ' + str(exception.reason))
        except Exception as exception:
            print('generic exception: ' + str(exception))
            raise


        challenge = get_challenge.split(
            '<Challenge>')[1].split('</Challenge>')[0]
        challenge_b = (
            challenge + '-' + self.__password).encode().decode('iso-8859-1').encode('utf-16le')

        md5hash = hashlib.md5()
        md5hash.update(challenge_b)

        response_b = challenge + '-' + md5hash.hexdigest().lower()
        get_sid = urllib2.urlopen('%s?%sresponse=%s' % (base_url, self.__username_query, response_b)).read().decode('utf-8')
        self.sid = get_sid.split('<SID>')[1].split('</SID>')[0]
899000
def _extract_params(self):
        
        # Because in this endpoint we handle both GET
        # and POST request.
        query_dict = (self.request.POST if self.request.method == 'POST'
                      else self.request.GET)

        self.params['client_id'] = query_dict.get('client_id', '')
        self.params['redirect_uri'] = query_dict.get('redirect_uri', '')
        self.params['response_type'] = query_dict.get('response_type', '')
        self.params['scope'] = query_dict.get('scope', '').split()
        self.params['state'] = query_dict.get('state', '')
        self.params['nonce'] = query_dict.get('nonce', '')

        self.params['prompt'] = self._allowed_prompt_params.intersection(
            set(query_dict.get('prompt', '').split()))

        self.params['code_challenge'] = query_dict.get('code_challenge', '')
        self.params['code_challenge_method'] = query_dict.get('code_challenge_method', '')
821561
public function getChallenge()
    {
        if (empty($this->_challenge))
        {
            $output = $this->postRequest(
                'identification/securitytoken/challenge',
                [
                    'useEasyLogin'        => false,
                    'generateEasyLoginId' => false,
                    'userId'              => $this->_username,
                ]
            );

            if (!isset($output->links->next->uri))
                throw new Exception('Cannot fetch control number. Check if the username is correct.', 10);

            $this->_challenge          = $output->challenge;
            $this->_useOneTimePassword = (bool)$output->useOneTimePassword;
        }

        return $this->_challenge;
    }
668310
def get_tile_url(self, force_http=False):
        
        base_url = self.base_http_url if force_http else self.base_url
        url = '{}tiles/{}/{}/{}/'.format(base_url, self.tile_name[0:2].lstrip('0'), self.tile_name[2],
                                         self.tile_name[3:5])
        date_params = self.date.split('-')
        for param in date_params:
            url += param.lstrip('0') + '/'
        return url + str(self.aws_index)
677827
public byte[] getAnsiHash( byte[] challenge ) {
        if( hashesExternal ) {
            return ansiHash;
        }
        switch (LM_COMPATIBILITY) {
        case 0:
        case 1:
            return getPreNTLMResponse( password, challenge );
        case 2:
            return getNTLMResponse( password, challenge );
        case 3:
        case 4:
        case 5:
            if( clientChallenge == null ) {
                clientChallenge = new byte[8];
                RANDOM.nextBytes( clientChallenge );
            }
            return getLMv2Response(domain, username, password, challenge,
                    clientChallenge);
        default:
            return getPreNTLMResponse( password, challenge );
        }
    }
132929
ClientChallenge challenge() throws GeneralSecurityException {
    this.authNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE);
    SecretKeySpec authKey = generateKey(conf.keyFactoryAlgorithm(), conf.keyFactoryIterations(),
      authNonce, conf.encryptionKeyLength());
    initializeForAuth(conf.cipherTransformation(), authNonce, authKey);

    this.challenge = randomBytes(conf.encryptionKeyLength() / Byte.SIZE);
    return new ClientChallenge(new String(appId, UTF_8),
      conf.keyFactoryAlgorithm(),
      conf.keyFactoryIterations(),
      conf.cipherTransformation(),
      conf.encryptionKeyLength(),
      authNonce,
      challenge(appId, authNonce, challenge));
  }
94587
public List<ChallengeHandler> lookup(String location) {
        List<ChallengeHandler> result = Collections.emptyList();
        if (location != null) {
            Node<ChallengeHandler, UriElement> resultNode = findBestMatchingNode(location);
            if (resultNode != null) {
                return resultNode.getValues();
            }
        }
        return result;
    }
774822
protected static String getNonSecureAbsoluteUrl(String resource) {
        if (resource.startsWith("/" + WonderPush.API_VERSION)) {
            resource = resource.substring(1 + WonderPush.API_VERSION.length());
        }
        return WonderPush.getNonSecureBaseURL() + resource;
    }
206142
public static String getSmallLayerIconUrl(Layer<?> layer) {
		ClientExtraLayerInfo eli = (ClientExtraLayerInfo) layer.getLayerInfo().getWidgetInfo(
				ClientExtraLayerInfo.IDENTIFIER);
		if (eli != null && eli.getSmallLayerIconUrl() != null && !"".equals(eli.getSmallLayerIconUrl())) {
			return eli.getSmallLayerIconUrl();
		} else {
			return null;
		}
	}