Skip to content

Instantly share code, notes, and snippets.

View sandrinodimattia's full-sized avatar
🏠
Working from home

Sandrino Di Mattia sandrinodimattia

🏠
Working from home
View GitHub Profile
@sandrinodimattia
sandrinodimattia / connection.js
Last active July 24, 2023 15:43
Create SAML connection
const { AuthenticationClient, ManagementClient } = require("auth0");
const publicKey = `-----BEGIN CERTIFICATE-----
MIIC/zCCAeegAwIBAgIJHqZ8xG7fkm2bMA0GCSqGSIb3DQEBCwUAMB0xGzAZBgNV
BAMTEnNhbWwtaWRwLmF1dGgwLmNvbTAeFw0xNzA4MDMxNDE0MTBaFw0zMTA0MTIx
NDE0MTBaMB0xGzAZBgNVBAMTEnNhbWwtaWRwLmF1dGgwLmNvbTCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAOzFui1uCqya7hcEW6TwLQn4kfw0gXDoZ018
VYVA9U45GQGuJPOVjXlNYDxwysjZXP9mOn322wL7AQGejavdrwsGFgiLZ23/X9DP
TsyGTcNuQtFCbW16xQcBB7PuLy3iluFXi50c+dvU/iSdBG9xEhndQ9mVtwbFMMFf
q8WNY4arU3PmnxFAhZIXgTmJih9a8hknGL82pgpcmK4iQof6Uw35x2Gg9X4zbbyt
@sandrinodimattia
sandrinodimattia / index.js
Last active February 5, 2022 02:29
Export Google Chrome History to a CSV file
import fs from 'fs';
import path from 'path';
import { v4 } from 'uuid';
import each from 'p-each-series';
import Database from 'sqlite-async';
/**
* Find all of the Chrome History files.
*/
function getHistoryFiles(startPath, targetFile) {
@sandrinodimattia
sandrinodimattia / generate-certs.js
Created January 29, 2018 08:52
Generate self signed certificates with the selfsigned library and validate those with OpenSSL 1.1
const fs = require('fs');
const ursa = require('ursa');
const async = require('async');
const faker = require('faker');
const util = require('util');
const spawn = require('child_process').spawn;
const selfsigned = require('selfsigned');
const total = Array.from(Array(10000).keys());
@sandrinodimattia
sandrinodimattia / README.md
Last active May 2, 2019 16:36
Upload custom signing certificate in Auth0 Generic SAML-P Connection

Upload custom signing certificate in Auth0 Generic SAML-P Connection

Get or generate a new signing certificate:

openssl req -x509 -nodes -sha256 -days 3650 -newkey rsa:2048 -keyout saml.key -out saml.crt

Update the script and update the following settings:

@sandrinodimattia
sandrinodimattia / auth0-with-azure-b2c.md
Last active May 19, 2018 06:09
Connect Auth0 with Azure B2C

Connect Auth0 with Azure AD B2C

Configuration

  1. Create an Azure AD B2C Directory
  2. Create a Regular Web Application (set the url here to https://YOUR_AUTH0_ACCOUNT/login/callback)
  3. Create a key
  4. Take note of the Application ID and the Key
  5. Create a sign in policy (you will have a name like B2C_1_signing)
@sandrinodimattia
sandrinodimattia / install-authorization-extension-beta.md
Last active November 17, 2016 19:31
Installing the Authorization Extension Beta

This document explains how you can test the new authorization extension in a US account. Keep into account that, once available in the Extension Gallery, all these steps will not be required.

Configure Webtask

Go to this page and follow the steps to connect to your webtask account: https://manage.auth0.com/#/account/webtasks

Configure your Auth0 Account

Start by creating a new client: https://manage.auth0.com/#/clients

@sandrinodimattia
sandrinodimattia / README.md
Last active September 20, 2016 22:01
Extensions Development

Finding your extensions

  1. Go to https://manage.auth0.com/#/extensions
  2. Copy the link of an installed extension
  3. Get the ID from the link (8d6f0f0711daedc87d1a6d595771015a)
https://sandbox.it.auth0.com/api/run/sandrino-dev/8d6f0f0711daedc87d1a6d595771015a?webtask_no_cache=1
@sandrinodimattia
sandrinodimattia / rule.js
Created August 4, 2016 09:36
Promises and Node version in Auth0 Rules
function (user, context, callback) {
var Promise = require('bluebird');
Promise.resolve('foo')
.then(function(result) {
console.log('Node version:', process.env.NODE_VERSION);
console.log('Promise result:', result);
callback(null, user, context);
});
}
@sandrinodimattia
sandrinodimattia / README.md
Last active June 28, 2016 14:55
Auth0 Source Control Integration with GitHub

Auth0 Source Control Integration with GitHub

The Github Deploy extension allows you to deploy rules and database connections from GitHub to Auth0 (currently only for the public cloud as extensions are not yet supported in the appliance).

  • Repositories: public and private repos (using GitHub Personal Access Tokens)
  • Rules: Supports the actual code + status (enable/disabled), stage and order
  • Database Connections: all scripts

Everything is convention based and a sample repository is available here: https://github.com/auth0-samples/github-source-control-integration

@sandrinodimattia
sandrinodimattia / lock-switch-to-signup.html
Created May 31, 2016 17:34
Auth0 Lock example that shows how to switch to the Login page when a certain condition is met
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
html, body { padding: 0; margin: 0; }