Last active
February 19, 2022 21:09
-
-
Save StephenKing/4531841 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:443> | |
ServerName review.typo3.org | |
ServerAlias | |
DocumentRoot /var/www | |
SSLEngine on | |
SSLProxyEngine on | |
SSLCertificateFile /etc/ssl_certs/....crt | |
SSLCertificateKeyFile /etc/ssl_certs/....key | |
LogLevel info | |
ErrorLog /var/log/apache2/review.typo3.org-error.log | |
CustomLog /var/log/apache2/review.typo3.org-access.log combined | |
AddExternalAuth typo3org-auth /var/gerrit/scripts/typo3org-authentication.php | |
SetExternalAuthMethod typo3org-auth pipe | |
ProxyRequests Off | |
ProxyVia Off | |
ProxyPreserveHost On | |
<Proxy *> | |
Order deny,allow | |
Allow from all | |
</Proxy> | |
<Location "/login/"> | |
AuthType Basic | |
AuthName "Review System - Please log in with your typo3.org username and passwords." | |
AuthBasicProvider external | |
AuthExternal typo3org-auth | |
Require valid-user | |
</Location> | |
ProxyPass / http://localhost:8080/ | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName review.typo3.org | |
ServerAlias | |
RewriteEngine On | |
RewriteRule (.*) https://%{HTTP_HOST}$1 | |
</VirtualHost> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$credentials['apiKey'] = 'xxxx'; | |
$fp = fopen('php://stdin', 'rb'); | |
$credentials['username'] = trim(fgets($fp, 4096)); | |
$credentials['password'] = trim(fgets($fp, 4096)); | |
fclose($fp); | |
// Build Http query using params | |
$postData = http_build_query($credentials); | |
$header = array( | |
"Connection: close", | |
"Content-Length: " . strlen($postData), | |
"Content-Type: application/x-www-form-urlencoded", | |
"User-agent: Gerrit Code Review typo3org-authentication.php", | |
); | |
// Create Http context details | |
$contextData = array ( | |
'method' => 'POST', | |
'header' => implode("\r\n", $header) . "\r\n", | |
'content' => $postData | |
); | |
// Create context resource for our request | |
$context = stream_context_create (array('http' => $contextData)); | |
$url = 'https://example.com/authenticate.php'; | |
if (file_get_contents($url, false, $context) === '1') { | |
exit(0); | |
} else { | |
exit(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment