PHP code example of cirrusidentity / simplesamlphp-module-ratelimit
1. Go to this page and download the library: Download cirrusidentity/simplesamlphp-module-ratelimit library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cirrusidentity / simplesamlphp-module-ratelimit example snippets
$config = [
// Sample authsource prior to using rate limiting
'sample' => [
'ldap:Ldap',
//Other ldap:LDAP options
],
// Sample authsource after moving to rate limiting
'sample-ratelimit' => [ // Authsource name stays the same
'ratelimit:RateLimitUserPass',
'delegate' => 'sample',
'ratelimit' => [
0 => [
'device',
'window' => 'P28D',
'limit' => 10,
],
1 => [
'user',
'window' => 'PT5M',
'limit' => 20
],
2 => [
'password',
'window' => 'PT5M',
'limit' => 20
],
3 => [
'ip',
'window' => 'PT5M',
'limit' => 100,
'whitelist' => [
'1.2.3.4',
'5.6.7.0/24',
],
],
],
]
];
$config = [
// Sample authsource prior to using rate limiting
// 'sample' => [
// 'ldap:Ldap',
// //Other ldap:LDAP options
// ],
// Sample authsource after moving to rate limiting
'sample' => [ // Authsource name stays the same
'ratelimit:RateLimitUserPass',
'delegate' => [ // Previous authsource configuration for 'sample' moves here
'ldap:Ldap',
//Other ldap:LDAP options
],
'ratelimit' => [
0 => [
'device',
'window' => 'P28D',
'limit' => 10,
],
1 => [
'user',
'window' => 'PT5M',
'limit' => 20
],
2 => [
'password',
'window' => 'PT5M',
'limit' => 20
],
3 => [
'ip',
'window' => 'PT5M',
'limit' => 100,
'whitelist' => [
'1.2.3.4',
'5.6.7.0/24',
],
],
],
]
];
WARNING [c854ab328b] LoopDetection: Only 0 seconds since last SSO for this user from the SP 'https://ratelimit.local.stack-dev.cirrusidentity.com/simplesaml/module.php/saml/sp/metadata.php/loop-test' LoopDetectionCount 5