summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul W. Frields <stickster@gmail.com>2010-07-11 12:37:46 -0400
committerPaul W. Frields <stickster@gmail.com>2010-07-11 22:26:52 -0400
commitf6f3c48d263191a262e9d9c63fe701384bbae9ab (patch)
tree24825bdbe9942e6a59af01e2f31a467cf84df162
parentf0b1a11c34e871f9bd35382ff4e46efde059be9b (diff)
downloaddrupal-authfas-6x-f6f3c48d263191a262e9d9c63fe701384bbae9ab.tar.gz
drupal-authfas-6x-f6f3c48d263191a262e9d9c63fe701384bbae9ab.tar.xz
drupal-authfas-6x-f6f3c48d263191a262e9d9c63fe701384bbae9ab.zip
Use username and password for FAS URL verify
-rw-r--r--authfas.module9
1 files changed, 6 insertions, 3 deletions
diff --git a/authfas.module b/authfas.module
index 434df8c..560998e 100644
--- a/authfas.module
+++ b/authfas.module
@@ -124,10 +124,13 @@ function authfas_admin_validate($form, &$form_state) {
$ch = curl_init();
$fasurl = $form_state['values']['authfas_fasurl'];
+ $username = $form_state['values']['fas_username'];
+ $password = $form_state['values']['fas_password'];
// Expect a JSON interface to be present
- curl_setopt($ch, CURLOPT_URL, 'https://' . $fasurl . '/json');
+ curl_setopt($ch, CURLOPT_URL, 'https://'.$fasurl.'/json/');
curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, "Auth_FAS 0.9");
+ curl_setopt($ch, CURLOPT_USERAGENT, "Drupal AuthFAS 0.1");
+ curl_setopt($ch, CURLOPT_POSTFIELDS, "username=".urlencode($username)."&user_name=".urlencode($username)."&password=".urlencode($password)."&login=Login");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// The following two lines need to be enabled when using a test FAS
// with an invalid cert. Otherwise they should be commented (or
@@ -138,7 +141,7 @@ function authfas_admin_validate($form, &$form_state) {
curl_close ($ch);
if (!isset($response["help"])) {
- form_set_error("authfas_fasurl", 'No JSON interface present at https://' .$fasurl. '/json');
+ form_set_error("authfas_fasurl", 'No JSON interface present at https://'.$fasurl.'/json/ or could not verify username "'.$username.'".');
return FALSE;
}
return TRUE;