Skip to content

Instantly share code, notes, and snippets.

View ryanbrainard's full-sized avatar

Ryan Brainard ryanbrainard

View GitHub Profile

Java configuration with Maven

The New Relic Java agent is available as a Maven dependency that can be automatically downloaded and installed during your project's build. This has the advantage of not having to check the agent into your project's source control and makes it easier to change versions in the future.

Add New Relic to your POM

  1. Add newrelic-java as a dependency. Check Maven Central for the latest version:

     <dependency>
    

com.newrelic.agent.java

function processSignedRequest($signedRequest, $secret) {
$sep = strpos($signedRequest, '.');
$encodedSig = substr($signedRequest, 0, $sep);
$encodedEnv = substr($signedRequest, $sep + 1);
$calcedSig = base64_encode(hash_hmac("sha256", $encodedEnv, $secret, true));
if ($calcedSig != $encodedSig) {
throw new Exception("Signed request authentication failed");
}