Package pulp :: Package server :: Package api :: Module auth
[hide private]
[frames] | no frames]

Source Code for Module pulp.server.api.auth

 1  #!/usr/bin/python 
 2  # 
 3  # Copyright (c) 2010 Red Hat, Inc. 
 4  # 
 5  # This software is licensed to you under the GNU General Public License, 
 6  # version 2 (GPLv2). There is NO WARRANTY for this software, express or 
 7  # implied, including the implied warranties of MERCHANTABILITY or FITNESS 
 8  # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 
 9  # along with this software; if not, see 
10  # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 
11  # 
12  # Red Hat trademarks are not licensed under GPLv2. No permission is 
13  # granted to use or replicate Red Hat trademarks that are incorporated 
14  # in this software or its documentation. 
15   
16  import logging 
17   
18  from pulp.server.api.base import BaseApi 
19  from pulp.server.auditing import audit 
20  import pulp.server.auth.auth as principal 
21  import pulp.server.auth.cert_generator as cert_generator 
22   
23   
24  LOG = logging.getLogger(__name__) 
25 26 27 -class AuthApi(BaseApi):
28
29 - def __init__(self):
30 BaseApi.__init__(self)
31
32 - def _getcollection(self):
33 # We're not using the DB features of BaseApi, so just return None here 34 return None
35 36 @audit()
37 - def admin_certificate(self):
38 ''' 39 Generates an admin authentication certificate for the currently logged in 40 user. 41 42 @return: tuple of the private key and certificate 43 @rtype: (string, string) 44 ''' 45 46 # Get the currently logged in user 47 user = principal.get_principal() 48 49 private_key, cert = cert_generator.make_admin_user_cert(user) 50 return private_key, cert
51