This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function login(email, password, callback) { | |
const jwt = require('jsonwebtoken'); | |
const axios = require('axios'); | |
const transformRequest = (jsonData = {}) => Object.entries(jsonData).map(x => `${encodeURIComponent(x[0])}=${encodeURIComponent(x[1])}`).join('&'); | |
const adfs_domain = '[YOUR ADFS DOMAIN]'; | |
const client_id = '[YOUR ADFS APP CLIENT ID]'; | |
const client_secret = '[YOUR ADFS CLIENT SECRET]'; | |
const url = `https://${adfs_domain}/adfs/oauth2/token`; | |
const input = { | |
client_id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html>{% if prompt.screen.name == "device-code-activation-allowed" %}<html><head><meta http-equiv="refresh" content="0;url=http://example.com" /></head><body></body></html>{% else %}<html><head>{%- auth0:head -%}<title>{{ prompt.screen.texts.pageTitle }}</title></head><body class="_widget-auto-layout">{%- auth0:widget -%}</body></html>{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function addUuidToNewUsers (user, context, callback) { | |
const { v4: uuidv4 } = require('uuid'); | |
user.app_metadata = user.app_metadata || {}; | |
// check to see if the user has a uuid in app metadata | |
if (user.app_metadata.uuid) { | |
return callback(null, user, context); | |
} | |
// generate uuid and store in user's app metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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, maximum-scale=1, user-scalable=0" /> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stepUpMFA(user, context, callback) { | |
// Check if has done MFA in the last 10 minutes | |
const completedMfa = | |
context.authentication && | |
!!context.authentication.methods.find(method => { | |
if (method.name === 'mfa') { | |
// Require MFA every 10 minutes | |
const requireMFAAt = method.timestamp + 600 * 1000; | |
return requireMFAAt > Date.now(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM openresty/openresty:alpine-fat | |
RUN mkdir /var/log/nginx | |
RUN apk add --no-cache openssl-dev | |
RUN apk add --no-cache git | |
RUN apk add --no-cache gcc | |
RUN luarocks install lua-resty-openidc | |
RUN luarocks install lua-resty-session | |
ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
// Roles should only be set on verified users. | |
if (!user.email || !user.email_verified) { | |
return callback(null, user, context); | |
} | |
request.get('https://API_URL', { | |
qs: { | |
email: user.email, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
const audience = context.request.query.audience || false; | |
if ( !audience || '<API_AUDIENCE>' !== audience) { | |
callback(null, user, context); | |
} | |
// Do something with an authentication request that matches <API_AUDIENCE> | |
// ... | |
callback(null, user, context); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
// Roles should only be set to verified users. | |
if (!user.email || !user.email_verified) { | |
return callback(null, user, context); | |
} | |
if (user.app_metadata.drupal_role) { | |
context.idToken['https://example.com/drupal_role'] = user.app_metadata.drupal_role; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |