Skip to content

Instantly share code, notes, and snippets.

package antisamy;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/Apache24/docs/myexample.com"
ServerName myexample.com
ErrorLog "logs/myexample.com-error.log"
CustomLog "logs/myexample.com-access.log" common
ProxyHTMLEnable On
ProxyPassMatch "/test1/(.*)" "http://localhost:8080/$1"
var express = require('express')
const path = require('path')
const https = require('https');
const fs = require('fs');
var app = express()
app.get('/index.html', function (req, res) {
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = myexample.com
DNS.2=sub.myexample.com
DNS.3=myexample1.com
DNS.4=localhost
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[dn]
C=US
ST=MN
L=Eagan

Create an RSA-2048 key and save it to a file rootCA.key

openssl genrsa -des3 -out rootCA.key 2048

Create a root certificate through the key generated

openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1460 -out rootCA.pem

Create a private key and CSR for local Certificare

openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key -config server.csr.cnf

Issue a certificate via the root SSL certificate and the CSR

#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
#### Test Site1 Configuration Starts ###
##### Test Site1 301 ###
wget http://localhost:4502/content/redirectmanager/test-site1/_jcr_content.301.txt -O /tmp/redirectmap-testsite1-301.txt > /var/log/update-redirect-map-testsite1-301.log 2>&1
httxt2dbm -v -f db -i /tmp/redirectmap-testsite1-301.txt -o /etc/httpd/conf.dispatcher.d/redirectmaps/redirectmap-testsite1-301_temp.db >> /var/log/update-redirect-map-testsite1-301.log 2>&1
cp -rf /etc/httpd/conf.dispatcher.d/redirectmaps/redirectmap-testsite1-301.db /etc/httpd/conf.dispatcher.d/redirectmaps/redirectmap-testsite1-301.db_`date -I`
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.servlets.HttpConstants;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import org.apache.sling.resource.filter.ResourceFilterStream;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.propertytypes.ServiceDescription;
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title=" Open Html/Script"
sling:resourceType="cq/gui/components/authoring/dialog">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<column
@techforum-repo
techforum-repo / CustomAuthenticationInfoPostProcessor.java
Last active February 18, 2021 15:24
Custom AuthenticationInfoPostProcessor update the last logged in timestamp to the user profile
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.jcr.Session;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;