Skip to content

Instantly share code, notes, and snippets.

@abbaspour
abbaspour / dl-wistia.sh
Last active August 1, 2019 05:51
download videos from wistia.com
#!/bin/bash
set -euo pipefail
[[ "$#" -lt 1 ]] && { echo "$0 http://someurl" && exit 1; }
which curl >/dev/null || { echo >&2 "Error: you need curl"; exit 2; }
which jq >/dev/null || { echo >&2 "Error: you need jq"; exit 2; }
which awk >/dev/null || { echo >&2 "Error: you need awk"; exit 2; }
@abbaspour
abbaspour / Guardian-Hosted-Page.html
Last active May 8, 2022 12:32
Auth0 MFA Widget i18n
<!DOCTYPE html>
<html>
<head>
<title>2nd Factor Authentication</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
html, body { padding: 0; margin: 0; }
@abbaspour
abbaspour / rule.js
Last active October 10, 2018 21:24
extend access token
function (user, context, callback) {
let role = user.app_metadata.role || 'limied-authority';
if (role === 'legal-lessee' || role === 'full-authority')
context.accessToken.scope = ['read:usage', 'read:bill', 'pay:bill', 'update:email'];
else
context.accessToken.scope = ['read:bill'];
context.accessToken['http://custom.ns/role'] = role; // plain text role, for audit
@abbaspour
abbaspour / lock.js
Created August 29, 2018 02:40
Auth0 Lock Plugin Example
var myPlugin = (function () {
var _webAuth
var ctor = function MyPlugIn() {
var _this = this
this.args = arguments
this.supports = function (extensibilityPoint) {
console.log(extensibilityPoint)
return false
}
@abbaspour
abbaspour / 01-global-functions.js
Last active August 13, 2018 04:23
Global Functions in Auth0 Rules
function (user, context, callback) {
if (!global.myFunc) {
global.myFunc = function (param) {
return true;
};
}
callback(null, user, context);
}
@abbaspour
abbaspour / login.js
Created August 1, 2018 10:32
Auth0 Lock Display Error Message from Custom DB or Rules
function login (email, password, callback) {
return callback(new UnauthorizedError('custom db error to display in HLP Lock flashMessage'));
}
@abbaspour
abbaspour / login.js
Created October 22, 2017 21:34
Auth0 Migration Custom Database - Login Script
function login (username, password, callback){
request({
url: 'https://' + configuration.Domain + '/oauth/token',
method: 'POST',
form: {
grant_type: 'password',
scope: 'openid', // todo: add name to scope
audience: configuration.Audience,
client_id: configuration.Client_ID,
client_secret: configuration.Client_Secret,
@abbaspour
abbaspour / nb_to_mvn.pl
Created April 22, 2013 08:57
Convert a NetBeans project to Maven
#!/usr/bin/perl
# generates Maven pom.xml based on nbproject
# d640492
use strict;
use warnings;
use File::Basename;
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>oes-demo</groupId>
<artifactId>authorization-client-rmi</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
package oes.rmi.client;
import com.bea.security.ssmrmi.services.RMIAuthorizationService;
import com.bea.security.ssmrmi.socket.SocketConfiguration;
import com.bea.security.ssmrmi.socket.SocketFactory;
import com.bea.security.ssmrmi.types.*;
import weblogic.security.principal.WLSGroupImpl;
import weblogic.security.principal.WLSUserImpl;
import weblogic.security.spi.IdentityAssertionException;
import javax.naming.ServiceUnavailableException;