Skip to content

Instantly share code, notes, and snippets.

View aaronanderson's full-sized avatar

Aaron Anderson aaronanderson

  • Dallas, Texas, USA
View GitHub Profile
Here is the process to generate a static Azure AD SAML Service Provider (SP) Link that forces reauthentication(forceAuthN), similar to the oauth prompt=login setting:
1. Edit the following single line XML, replacing the acme-prod value with whatever Entity ID value was setup in the Azure AD SAML application. Notice the presence of the ForceAuthn attribute. The ID and IssueInstant can be any valid value.
<samlp:AuthnRequest xmlns="urn:oasis:names:tc:SAML:2.0:metadata" ID="workday_azure_ad_saml" Version="2.0" ForceAuthn="true" IssueInstant="2000-01-01T00:00:00.0000000Z" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"><Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">http://www.workday.com/acme-prod</Issuer></samlp:AuthnRequest&gt;
2. Go to https://developers.onelogin.com/saml/online-tools/code-decode/deflate-base64-encode and deflate and encode the request.
3. Copy the encoded value and URL encode it using any online URL encoding site
@aaronanderson
aaronanderson / OutlookMsgParser.java
Last active November 23, 2021 05:52
Apache POI HSMF Outlook Calendar/Appointment Metadata extraction including recurrence settings
package outlook;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.security.MessageDigest;
import java.time.format.DateTimeFormatter;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@aaronanderson
aaronanderson / SFTPList.java
Created May 6, 2020 22:48
JSCH with OpenSSH keys
String result = "";
String user = "XXXX";
String host = "XXXX.XXX";
int port = 22;
String directory = "/";
String sshPrivateKeyPath ="id-rsa.priv";
String sshPrivateKeyPassword ="XXXXX";
String sshPublicKeyPath ="id-rsa.pub";
int timeout = 10000;
@aaronanderson
aaronanderson / EDIToXML.java
Created February 23, 2020 05:22
StaEDI - EDI X12 832 to XML and back to EDI
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
@aaronanderson
aaronanderson / ExcelEmeddedFileTest.java
Created December 7, 2019 22:47
Apache POI Excel XSSF Workbook - Embedded File Example
//Simple example of embedding an arbitrary file in Excel using Apache POI mimicing the Office Insert Object functionality.
import java.io.ByteArrayOutputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.xssf.usermodel.XSSFObjectData;
package quarkus.graphql.test;
import java.util.Set;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import javax.websocket.Endpoint;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
@aaronanderson
aaronanderson / MappingSheetHandler.java
Last active November 24, 2022 13:47
Apache POI Excel SAX Handler for large Excel files
//Example handler, in this case Excel rows are stored into an Apache Ignite cache
public class MappingSheetHandler extends SheetHandler {
IgniteCache<BinaryObject, BinaryObject> mappingCache;
protected Map<String, String> headerRowMapping = new HashedMap<>();
protected LocationSheetHandler() {
mappingCache = ignite.cache("mappings").withKeepBinary();
}
@aaronanderson
aaronanderson / DynamoDBUtil.java
Created January 23, 2018 16:03
DynamoDBUtil AttributeValue to Json mapper with a transformer
package com.mercer.digital.wd.intlibrary;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@aaronanderson
aaronanderson / nexus.txt
Created January 23, 2018 02:36
Nexus Maven repository setup in AWS
Nexus setup
https://medium.com/@betz.mark/ten-tips-for-debugging-docker-containers-cde4da841a1d
https://github.com/sonatype/docker-nexus3
create cluster
nexus-maven-repository-cluster
use existing VPS, select any of the subnets, create a new security group
T2 small instance, VM requires 1.2GB
@aaronanderson
aaronanderson / DynamoDBUtil.java
Created January 5, 2018 02:43
Amazon AWS Java SDK 2.0 DynamoDB utility class to convert between AttributeValue and json-p 1.0 javax.json objects
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonArrayBuilder;