Skip to content

Instantly share code, notes, and snippets.

View zamd's full-sized avatar

Zulfiqar Ahmed zamd

View GitHub Profile
@zamd
zamd / saml-connection-creation-with-metadata.md
Created June 1, 2017 04:02
Sample request to create Auth0 Saml connection with samlp metadata

#Saml-connection creation

###Payload

curl -H "Authorization: Bearer ..-yiSm0uYkVArSrXYojrkhwvI1dPzcZRlDQ---" -X POST  -H "Content-Type: application/json" -d '{"name":"pkr-tenant","strategy":"samlp","options":{"metadataUrl":"https://pkr.myauth0.com/samlp/metadata/vj4HB0DougzOsvUOQrLE6mLSyTl9GeIY"}}' https://zulfiqar.myauth0.com/api/v2/connections`
{
@zamd
zamd / verify-linked-account.js
Created May 24, 2017 13:28
verify-linked-account
function (user, context, callback) {
var rp = require('request-promise');
var ManagementClient = require('auth0@2.0.0').ManagementClient;
var management;
var ACCOUNT_LINKING_ENABLED_CLIENTS =
[
'Wy1MwWNQlnqy9o24q6cWnl6iFnJBgSfs', //self-care mobile
'if9yMTsPw5s4jQVvbbVa1hYuMnNcFgIu' // identity registration website
];
@zamd
zamd / letsencrypt.md
Last active July 20, 2018 10:21
letsencrypt certs

##Free Public CA certficate

Certbot tool works with any ACME compliant CA to automate certificate acquistion process.

We can use certbot to generate the certificates using following process:

  • Setup a basic nginx web server as CA authenticator in AWS with HTTP access:
  • SSH into nginx and create .well-known folder

mkdir /tmp/.well-known

@zamd
zamd / sms-gateway.json
Last active October 11, 2017 03:36
Custom sms gateway with auth0 - passwordless
{
"options": {
"strategy": "sms",
"provider": "sms_gateway",
"gateway_url": "http://requestb.in/wrls9twr",
"gateway_authentication": {
"method": "bearer",
"subject": "urn:Auth0",
"audience": "urn:MySmsGateway",
"secret": "shhhh"
@zamd
zamd / wsfedwebtask.js
Created March 20, 2017 16:21
ws-fed server webtask
const express = require('express'),
passport =require('passport'),
wsfed = require('wsfed'),
ejs = require('ejs'),
auth0 = require('auth0'),
selfsigned = require('selfsigned'),
session = require('express-session'),
LocalStrategy = require('passport-local'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),

Letsencrypt certficates are issued by valid public CAs Certbot tool works with any ACME compliant CA to automate certificate acquistion process.

Setup a basic nginx web server as CA authenticator in AWS with HTTP access: SSH into nginx and create .well-known folder mkdir /tmp/.well-known

Modify nginx conf to add following section. The webroot plugin in certbot uses this folder structure to authenticate the domain ownership.

server {
module.exports = function (options, cb) {
var request = require('request');
var url ='http://requestb.in/1bck9t61'
request(url, function (error, response, body) {
if (!error) {
console.log(body);
}
});
return cb(null, function (cb) {