Skip to content

Instantly share code, notes, and snippets.

View saltukalakus's full-sized avatar
🐢
Rust & Cryptography

saltukalakus

🐢
Rust & Cryptography
View GitHub Profile
@saltukalakus
saltukalakus / rule.js
Created January 26, 2021 10:27
Multiple attributes to a single attribute in SAML response when Auth0 is the SAML IdP
function (user, context, callback) {
// Execute the rule only for the required Apps's client ID
var samlIdpClientId = 'LYkMiVolEzhDzaTQJPg6mRI468blVFU4';
if (context.clientID !== samlIdpClientId) {
return callback(null, user, context);
}
user.tmpMemberOf = "";
function appendMember(memberOf) {
@saltukalakus
saltukalakus / account_link_extension_rule_sample.js
Created January 23, 2021 13:54
Account linking extension rule sample
@saltukalakus
saltukalakus / tls_troubleshoot.sh
Created January 21, 2021 10:15
TLS troubleshoot
# Check if a custom domain supports TLS 1_x
openssl s_client -connect saltukalakus-cd-27cmr6vn4orkxckx.edge.tenants.auth0.com:443 -servername demo.saltukalakus.com -tls1_1
openssl s_client -connect saltukalakus-cd-27cmr6vn4orkxckx.edge.tenants.auth0.com:443 -servername demo.saltukalakus.com -tls1_2
@saltukalakus
saltukalakus / Sample_user_profile.json
Last active June 2, 2025 20:33
Auth0 SAML IdP mapping attributes from within arrays
{
"id": "118028435727952686478",
"primaryEmail": "[email protected]",
"name": "John Dough",
"isAdmin": false,
"isDelegatedAdmin": false,
"lastLoginTime": "2021-01-05T13:27:25.000Z",
"creationTime": "2016-10-03T15:55:40.000Z",
"addresses": [
{
@saltukalakus
saltukalakus / calculate-sha1-sha256.js
Created December 24, 2020 20:21
Calculate domain fingerprints
"use strict";
const openssl = require('openssl-nodejs');
const crypto = require('crypto');
function handler(domain)
{
return openssl(['s_client', '-connect', domain, '-showcerts'], function (err, buffer) {
const res = getCertificateFingerprintSha256(buffer.toString());
console.log("sha - 256", res);
@saltukalakus
saltukalakus / rules.js
Last active June 2, 2025 20:33
Insert intersectional permissions and additional ones
function (user, context, callback) {
var ManagementClient = require('[email protected]').ManagementClient;
var req = context.request;
var audience = req.query.audience;
var scopes = (req.query && req.query.scope) || (req.body && req.body.scope);
var permissionNames = [];
// Limit the rule execution for the realted API identifier
@saltukalakus
saltukalakus / test.py
Created December 16, 2020 18:23
Test script to prevent timeouts
#!/usr/bin/env python3
import time
import requests
import socket
from datetime import datetime
from functools import lru_cache
from urllib3.connection import HTTPConnection
class KeepaliveAdapter(requests.adapters.HTTPAdapter):
@saltukalakus
saltukalakus / login_template.html
Created December 7, 2020 22:06
Show a message after successful signup before attempting to login
<!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" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<style>
@saltukalakus
saltukalakus / SAML.template
Last active June 2, 2025 20:34
How to insert AssertionConsumerServiceURL (ACS) in AuthN when Auth0 is the SAML service provider. (a.k.a. SAML enterprise connection)
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
@@AssertServiceURLAndDestination@@
AssertionConsumerServiceURL="https://demo-saml-sp.auth0.com/login/callback"
ID="@@ID@@"
IssueInstant="@@IssueInstant@@"
ProtocolBinding="@@ProtocolBinding@@" Version="2.0">
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">@@Issuer@@</saml:Issuer>
</samlp:AuthnRequest>
@saltukalakus
saltukalakus / .env
Last active June 2, 2025 20:34
A sample showing how to use role claim with Auth0 using express-openid-connect library
# conf
PORT=3000
ISSUER_BASE_URL=https://your-account.[region].auth0.com
CLIENT_ID=your-client-id
CLIENT_SECRET=your-client-secret
BASE_URL=http://localhost:3000
SECRET=LONG_RANDOM_VALUE