Skip to content

Instantly share code, notes, and snippets.

@wendelicious
wendelicious / authTokenConfiguration.java
Created September 14, 2016 17:41
Auth token fluent configuration
public static ServletModule infusionsoftIdApplication(String... anonymousPaths) {
final String[] antPaths;
if (null == anonymousPaths) {
antPaths = new String[0];
} else {
antPaths = anonymousPaths;
}
final InfusionsoftIdCasAuthenticator casAuthenticator = new InfusionsoftIdCasAuthenticator();
PancakesAppSecurity.module()
.anonymousByDefault()
.authenticate("/profile", "/account")
.and()
.domainAuthentication()
.usingJsonWebTokens()
.usingFirebase(keyCache)
.forAppId("url-shortening-app")
authBuilder
.verifiesClaimsBy(
c -> firebaseApplicationName.equals(c.getAudience())
)
.verifiesClaimsBy(
c -> (ISSUER_PREFIX + firebaseApplicationName).equals(c.getIssuer())
)
.verifiesClaimsBy(
c -> {
// we may not need this once we have our own signin provider proxied by Firebase
@wendelicious
wendelicious / guice-injector-with-security.java
Last active February 11, 2019 18:44
Create Guice Injector using a Security Builder
@Override
protected Injector getInjector() {
return PancakesGuiceInjector.builder()
.addModule(new SuccessCenterApiModule())
.addModule(new LocalSuccessCenterApiModule(), DeploymentEnvironment.DEV)
.addModule(new GoogleCloudSuccessCenterApiModule(), DeploymentEnvironment.excludingEnvironments(DeploymentEnvironment.DEV))
.addModule(new SuccessCenterPolicyServletModule())
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<polymer-element name="my-element">
<template>
@wendelicious
wendelicious / gist:3408bc199c9342522f53
Last active September 10, 2015 16:32
Create a Pancake Service Interactively
Do this: https://github.com/infusionsoft/pancakesw/blob/master/pankacesw
@wendelicious
wendelicious / gist:ed82c995d01a58e6913c
Created September 20, 2014 07:11
Listen for metrics publishing on localhost
#!/bin/sh
while [ 1 ]; do
echo "Listening at `date` on port 2003. <CTRL>-C to quit"
nc -l 2003
done
package com.infusionsoft.mobileInteraction.config.cassandra;
import com.infusionsoft.mobileInteraction.config.CassandraConnectionService;
import com.infusionsoft.mobileInteraction.config.cassandra.CassandraConfiguration.ClusterProperties;
import com.infusionsoft.priscilla.PriscillaPropertyChangeListener;
import com.infusionsoft.priscilla.PropertyDefinition;
import com.infusionsoft.priscilla.configurator.PriscillaConfigurator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
package com.dietsodasoftware.configuration.archaius;
import com.netflix.config.ConfigurationManager;
import com.netflix.config.PollResult;
import com.netflix.config.PolledConfigurationSource;
import com.netflix.config.sources.URLConfigurationSource;
import com.netflix.config.util.ConfigurationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@wendelicious
wendelicious / ConnectionStabilizer
Created May 2, 2014 00:33
Decompiled Java from Joseph
mport com.infusion.databridge.BridgeException;
import com.infusion.databridge.ConInfo;
import com.infusion.databridge.Rst;
import com.infusion.util.Joiner;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.util.Date;