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 / 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 / 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 / account_link_extension_rule_sample.js
Created January 23, 2021 13:54
Account linking extension rule sample
@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 / sample.java
Created February 9, 2021 12:59
Java sample to reset connections every 30 seconds
object PoolingHttpClientFactory {
private val poolingConnectionManager = PoolingHttpClientConnectionManager().apply {
maxTotal = 40
defaultMaxPerRoute = 40
}
// called every 30 seconds from a scheduled task
fun cleanupConnections() {
@saltukalakus
saltukalakus / m2m_action.js
Created March 16, 2021 16:56
Sample Auth0 action to execute on a specific API and Application for adding a custom claim.
/** @type {CredentialsExchangeAction} */
module.exports = async (event, context) => {
// This action works for an API with the API audience https://example.com/api along with an application with the
// client id 5drbxrf5qMc1KTFNEw6Wjrbw319pOiyW
if (event.audience === "https://example.com/api" && event.client.id === "5drbxrf5qMc1KTFNEw6Wjrbw319pOiyW") {
return {
customClaims: {
"https://www.customnamespace.com/some_key": "some value"
}
};
@saltukalakus
saltukalakus / rule.js
Created March 25, 2021 16:25
Prevents users from logging in if email isn't shared in their Facebook account.
function (user, context, callback) {
if (context.connection === "facebook" && !user.email) {
return callback(new UnauthorizedError("We can't access your email. Please enable sharing your e-mail from Facebook apps settings and re-try."));
}
return callback(null, user, context);
}
@saltukalakus
saltukalakus / classic-hosted-page.html
Last active June 2, 2025 20:46
The passwordless and regular login with lock on the same universal page.
<!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>
<!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>
module.exports = function (raw_data) {
var profile = {
id: raw_data.objectGUID || raw_data.uid || raw_data.cn,
displayName: raw_data.displayName,
name: {
familyName: raw_data.sn,
givenName: raw_data.givenName
},
nickname: raw_data['sAMAccountName'] || raw_data['cn'] || raw_data['commonName'],
groups: raw_data['groups'],