anchor.diff:  
   ;;; Bindings for OpenStack Keystone identity API are defined here
   
  -;;; Helper functions
  +(defvar *service-catalog* nil
  +  "An alist map of service catalog endpoints, the value of which will
  +  be set when the OpenStack token object is initialized.")
  +
  +(defun get-public-url (service &key (endpoints *service-catalog*))
  +  "Retrieves a public URL of an OpenStack service endpoint from an
  +alist map of currently active endpoints."
  +  (alexandria:assoc-value
  +   (alexandria:assoc-value
  +    (alexandria:assoc-value endpoints service :test #'string=)
  +    "endpoints" :test #'string=)
  +   "public-url" :test #'string=))
  +
  +(defvar *openstack-token* nil
  +  "The default global OpenStack token object.")
   
   (defun parse-endpoints (service-catalog-jso)
  -  "Parses a JSON containing currently active service endpoints."
  +  "Parses a JSON containing currently active service endpoints into an
  +alist map."
     (mapcar
      #'(lambda (jso)
          (cons (st-json:getjso "name" jso)
  
positive.code:                                       "password" (password ,os-c)))))))))
       ,@body))
  
  (defun make-credential (hostname username password &optional tenant-name)
    "Makes and returns a new instant of os-credential class."
    (make-instance 'os-credential
                   :keystone-hostname hostname
                   :username username
                   :password password
                   :tenant-name tenant-name))
  
  (defclass connection ()
    ((credential :initarg :credential
                 :reader credential)
     (service-endpoints :accessor service-endpoints)
     (token :accessor token)
     (token-expiration-time :accessor token-expiration-time))
    (:documentation "A connection object containing the currently active
  service endpoints as well as an authentication token along with all
  the necessary information to reacquire the token once it expires.
  
  Only requires an instant of user credential payload, other slots will
  be initialized when we instantiate the object."))
  
  (defmethod initialize-instance :after ((conn connection) &key)
    "Uses an instant of user credential payload to authenticate and
  retrieve the currently active service endpoints, a token and its
  expiration time, then store three of them into their respective
  slots."
    (with-accessors ((os-c credential) (endpoints service-endpoints) (token token)
                     (token-expiration-time token-expiration-time)) conn
      (with-keystone-response response (os-c)
        (let* ((access-jso (st-json:getjso "access" (st-json:read-json response)))
               (token-jso (st-json:getjso "token" access-jso))
               (service-catalog-jso (st-json:getjso "serviceCatalog" access-jso)))
          (setf endpoints (parse-endpoints service-catalog-jso))
          (setf token (st-json:getjso "id" token-jso))
          (setf token-expiration-time
                (local-time:parse-timestring (st-json:getjso "expires" token-jso)))))))
  
  (defmethod token :before ((conn connection))
    "Before reading a value of the token's slot, check if it has already
  expired. If it does, then uses the credential payload to
  re-authenticate and reacquire the token."
    (with-accessors ((os-c credential) (token token)
                     (token-expiration-time token-expiration-time)) conn
      (when (local-time:timestamp>= (local-time:now) token-expiration-time)
        (with-keystone-response response (os-c)
          (let ((token-jso (st-json:getjso
  
negative.code:           (setf token-expiration-time
                  (local-time:parse-timestring (st-json:getjso "expires" token-jso))))))))
  
  (defun make-openstack-token (keystone-hostname username password &optional tenant-name)
    "Creates and returns a new instant of the OpenStack token object."
    (let ((os-c (make-openstack-credential keystone-hostname
                                           username
                                           password
                                           tenant-name)))
      (make-instance 'openstack-token :credential os-c)))
  
  (defun authenticate (keystone-hostname username password &optional tenant-name)
    "Authenticates a user, and initializes the default global special
  variables."
    (setf *openstack-token*
          (make-openstack-token keystone-hostname username password tenant-name)))
  