From 606ff23435d99a76ed10e98a1b9be98a68163363 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 25 Aug 2011 18:10:38 +0200 Subject: [PATCH] feature #754: Update authenticate to make use of new x509 auth class --- src/authm_mad/remotes/x509/authenticate | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/authm_mad/remotes/x509/authenticate b/src/authm_mad/remotes/x509/authenticate index 735e2d8ba6..bd593ee9a4 100755 --- a/src/authm_mad/remotes/x509/authenticate +++ b/src/authm_mad/remotes/x509/authenticate @@ -37,14 +37,20 @@ secret = ARGV[2] # Base64 encoded text and certificate chain text:cert_0:cert_1: #OpenNebula.log_debug("Authenticating #{user}, with password #{pass} (#{secret})") -#TODO Check errors in these operations +begin + dsecret = Base64::decode64(secret) + asecret = dsecret.split(':') -dsecret = Base64::decode64(secret) -certs_pem = dsecret.split(':') + token = asecret[0] + certs = asecret[1..-1] -x509_auth = X509Auth.new(:cert=>cert) + x509_auth = X509Auth.new(:certs_pem=>certs) -rc = x509_auth.authenticate(user, pass,proxy) + rc = x509_auth.authenticate(user, pass, token) +rescue => e + OpenNebula.error_message e.message + exit -1 +end if rc == true exit 0