This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// A peggy grammar for the Condition expressions used in Apigee. | |
// | |
// | |
// Copyright 2015 Apigee Corp, 2024 Google LLC. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "9b8ac0ff-cfa9-46da-b8f2-4d133a772ce0", | |
"name": "GCP Token", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | |
"_exporter_id": "22976572" | |
}, | |
"item": [ | |
{ | |
"name": "1. get JS-RSA-sign module", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = `<Foo> | |
<Bar baz='17'>textvalue</Bar> | |
<Baz>hello,world</Baz> | |
</Foo>`; | |
const xmldom = require('@xmldom/xmldom'), | |
DOMParser = xmldom.DOMParser, | |
xpath = require('xpath'), | |
doc = new DOMParser().parseFromString(data), | |
attr = xpath.select('/Foo/Bar/@baz', doc)[0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// createKeyPair.js | |
// ------------------------------------------------------------------ | |
// | |
// created: Thu Feb 28 15:49:15 2019 | |
// last saved: <2023-March-29 14:19:28> | |
/* jshint esversion:9, node: true */ | |
/* global process, console, Buffer, require */ | |
const crypto = require('crypto'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TargetEndpoint name="target-1"> | |
<PreFlow name="PreFlow"> | |
<Request> | |
<Step> | |
<Name>AM-Query</Name> | |
</Step> | |
</Request> | |
<Response> | |
<Step> | |
<Name>AM-Clean-Response-Headers</Name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GenerateGcpAccessTokenForServiceAccount.java | |
// ------------------------------------------------------------------ | |
// | |
// Requires Java 11 or later | |
// | |
// compile: javac -cp | |
// lib/nimbus-jose-jwt-8.22.jar:lib/json-smart-1.3.2.jar:lib/bcprov-jdk15on-1.64.jar:lib/bcpkix-jdk15on-1.64.jar %f | |
// | |
// run: java -classpath | |
// lib/nimbus-jose-jwt-8.22.jar:lib/json-smart-1.3.2.jar:lib/bcprov-jdk15on-1.64.jar:lib/bcpkix-jdk15on-1.64.jar %n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// weightedRandomSelector.js | |
// | |
// This is a simple weighted random selector, works in Rhino, can use within an | |
// Apigee JavaScript step. | |
// | |
// last saved: <2021-December-02 13:11:16> | |
// | |
// -------------------------------------------------------- | |
(function (){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bouncycastle.asn1.ASN1EncodableVector; | |
import org.bouncycastle.asn1.ASN1Integer; | |
import org.bouncycastle.asn1.ASN1Sequence; | |
import org.bouncycastle.asn1.DERSequence; | |
import java.math.BigInteger; | |
private static byte[] toP1363(byte[] asn1EncodedSignature) throws Exception { | |
ASN1Sequence seq = ASN1Sequence.getInstance(asn1EncodedSignature); | |
BigInteger r = ((ASN1Integer) seq.getObjectAt(0)).getValue(); | |
BigInteger s = ((ASN1Integer) seq.getObjectAt(1)).getValue(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion:6, node:false, strict:implied */ | |
/* global print, context */ | |
function createPartialCopy(obj, partialPropertyList) { | |
// create new "partial copy" with only a subset of properties | |
return partialPropertyList.reduce(function(a, prop) { | |
a[prop] = obj[prop]; | |
return a; | |
}, {}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# uncomment to debug | |
# set -x | |
usage() { | |
printf "%s: display subject and issuer of certificates in the chain that a host presents\n" $0 | |
printf "usage:\n" | |
printf " %s HOSTNAME\n" $0 | |
printf " show cert subject and issuer\n\n" |