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 / ClassicMFA.html
Last active June 2, 2025 20:46
Auth0 classic MFA page with disabled country selection
<!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; }
@saltukalakus
saltukalakus / index.html
Last active June 2, 2025 20:46
Custom Classic Universal Login Page with Email validation.
<!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">
<script src="https://unpkg.com/validator@latest/validator.min.js"></script>
</head>
@saltukalakus
saltukalakus / update_client.md
Created April 19, 2022 15:42
Custom classic login page per application
PATCH Auth0-domain/api/v2/clients/[client-id]
{
    "custom_login_page": "<!DOCTYPE\nhtml> <html> <head> \n<meta\ncharset=\"utf-8\"> \n<meta\nhttp-equiv=\"X-UA-Compatible\"\ncontent=\"IE=edge,chrome=1\"> \n<title>Sign\nIn\nwith\nAuth0</title> \n<meta\nname=\"viewport\"\ncontent=\"width=device-width,\ninitial-scale=1.0\"\n/> \n<link\nrel=\"stylesheet\"\nhref=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\"> </head> \n<style> \nbody,\nhtml\n{ \nheight:\n100%; \nbackground-color:\n#f9f9f9; \n} \n.login-container\n{ \nposition:\nrelative; \nheight:\n100%; \n} \n.login-box\n{ \nposition:\nabsolute; \ntop:\n50%; \ntransform:\ntranslateY(-50%); \npadding:\n15px; \nbackground-color:\n#fff; \nbox-shadow:\n0px\n5px\n5px\n#ccc; \nborder-radius:\n5px; \nborder-top:\n1px\nsolid\n#e9e9e9; \n} \n.login-header\n{ \ntext-align:\ncenter; \n} \n.login-header\nimg\n{ \nwidth:\n75px; \n} \n#error-message\n{ \ndisplay:\nnone; \nwhite-space:\nbreak-spaces; \n} \n</style> <body> \n<div\nclass=\"login-co
@saltukalakus
saltukalakus / RefreshTokenStepUpRule.js
Last active June 2, 2025 20:46
Step up authentication with refresh tokens.
function (user, context, callback) {
// Only applied for the refresh token flow along with the special scope (e.g.: transfer:funds) that
// will trigger the MFA step up.
if (context.protocol === "oauth2-refresh-token" &&
context.request.body &&
context.request.body.scope &&
context.request.body.scope.indexOf('transfer:funds') > -1) {
// Insert a custom claim in id token which would be checked along with amr claim
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'],
<!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 / 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>
@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 / 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 / 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() {