Skip to content

Instantly share code, notes, and snippets.

function (user, context, callback) {
if (context.clientID === '{{auth0-application-client-id}}') {
const RULE_NAME = 'talentlms-samlmappings';
const CLIENTNAME = context.clientName;
console.log(`${RULE_NAME} started by ${CLIENTNAME}`);
if (!user.user_metadata.given_name || _.isEmpty(user.user_metadata.given_name) ||
!user.user_metadata.family_name || _.isEmpty(user.user_metadata.family_name))
@drovani
drovani / progressive-profiling.js
Last active January 3, 2020 14:03
Auth0 Progressive Profiling rule
function (user, context, callback) {
const RULE_NAME = 'Progressive Profiling';
console.log(`${RULE_NAME} started.`);
// skip if this application doesn't need progressive profiling
if (!context.clientMetadata || !context.clientMetadata.progressive_profiling_url) {
return callback(null, user, context);
}
user.user_metadata = user.user_metadata || {};
@drovani
drovani / index.html
Last active December 24, 2019 17:09
Auth0 Progressive Profiling Proof-of-concept
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>Auth0 Progressive Profiling</title>
<style>
body{
max-width: 900px;
margin-left: auto;
margin-right: auto;
}
@drovani
drovani / auth0-rule-shopify-multipass.js
Last active January 30, 2024 19:52
Auth0 Rule to Generate a Multipass token and redirect the user back to the Shopify store
function (user, context, callback) {
if (context.clientMetadata && context.clientMetadata.shopify_domain && context.clientMetadata.shopify_multipass_secret)
{
const RULE_NAME = 'shopify-multipasstoken';
const CLIENTNAME = context.clientName;
console.log(`${RULE_NAME} started by ${CLIENTNAME}`);
const now = (new Date()).toISOString();
let shopifyToken = {
email: user.email,
@drovani
drovani / shopify-multipass-demo.cs
Last active February 18, 2022 10:19
Sample C# Code to Generate Shopify Multipass Url
string secret = "[shopify-multipass-secret]";
string store = "[shopify-store]";
var json = System.Text.Json.JsonSerializer.Serialize(new {
email = "[customer-email]",
created_at = DateTime.Now.ToString("O"),
identifier = "[customer-uid]",
//remote_ip = ""
});
var hash = System.Security.Cryptography.SHA256.Create().ComputeHash(Encoding.UTF8.GetBytes(secret));
@drovani
drovani / NotImplementedAttribute.cs
Created April 30, 2015 21:57
NotImplementedAttribute
using System;
namespace Vigil.Data.Core.Attributes
{
public class NotImplementedAttribute : Attribute
{
public NotImplementedAttribute()
{
throw new NotImplementedException();
}
@drovani
drovani / keybase.md
Last active February 10, 2020 13:33
keybase.md

Keybase proof

I hereby claim:

  • I am drovani on github.
  • I am drovani (https://keybase.io/drovani) on keybase.
  • I have a public key whose fingerprint is 64F9 0D22 4C9F F734 B71F 4670 9CBA 8286 1AE8 65D4

To claim this, I am signing this object:

@drovani
drovani / BaseController.cs
Last active August 29, 2015 14:01
Using ASP.NET Identity with an Int for a primary key.
using System;
using System.Security.Claims;
using System.Web.Mvc;
using Vigil.Data;
namespace Vigil.Web.Controllers
{
public abstract class BaseController : Controller, IDisposable
{
public VigilClaimsPrincipal CurrentUser