[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pulp-list] user model added



On 07/08/2010 03:45 PM, Mike McCune wrote:
Added only the model + base API.

Also included certificate.py for parsing certs.  the API includes
ability to do:

      def test_user_with_certificate(self):
          # read in the test cert and extract the UID for the subject
          # so we can compare after the user is created that it matches
          test_cert = os.path.abspath(os.path.dirname(__file__)) +
"/data/test_cert.pem"
          idcert = Certificate()
          idcert.read(test_cert)
          subject = idcert.subject()
          cert_uid = subject['UID']

          # Read the cert into a string off disk and create a
          # user with said certificate.  We should get back a user with an
          # id that matches the UID in the cert.
          certfile = open(test_cert)
          certstring = certfile.read()
          user = self.uapi.create('cert-test', certificate=certstring)

          # Check that they match
          self.assertEquals(user['id'], cert_uid)

I'm not even entirely sure this is what we want todo but it should get
the ball rolling,
Mike


after a bit of thought and discussion with Jeff, the above is totally wrong wrt how and what I'm doing with the UID field. The above is the UID for the *Consumer* and not the admin user.

We need to parse the identity cert and associate the subject['UID'] field with our Consumer, not our User object.

So, essentially we should consider moving the above logic over to Consumer's create() call to take in a cert string and possibly extract the UID and store that as the ID for the consumer.

Mike
--
Mike McCune
mmccune AT redhat.com
Red Hat Engineering       | Portland, OR
Systems Management        | 650.254.4248


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]