sregistry/main/registry/auth.py
def authorize(self, names, payload=None, request_type="push"):
    '''Authorize a client based on encrypting the payload with the client
       token, which should be matched on the receiving server'''

    if self.secrets is not None:

        if "registry" in self.secrets:

            # Use the payload to generate a digest   push|collection|name|tag|user
            timestamp = generate_timestamp()
            credential = generate_credential(self.secrets['registry']['username'])
            credential = "%s/%s/%s" %(request_type,credential,timestamp)

            if payload is None:
                payload = "%s|%s|%s|%s|%s|" %(request_type,
                                              names['collection'],
                                              timestamp,
                                              names['image'],
                                              names['tag'])

            signature = generate_signature(payload,self.secrets['registry']['token'])
            return "SREGISTRY-HMAC-SHA256 Credential=%s,Signature=%s" %(credential,signature)
def authorize(self, names, payload=None, request_type="push"):
    '''Authorize a client based on encrypting the payload with the client
       token, which should be matched on the receiving server'''

    if self.secrets is not None:

        if "registry" in self.secrets:

            # Use the payload to generate a digest   push|collection|name|tag|user
            timestamp = generate_timestamp()
            credential = generate_credential(self.secrets['registry']['username'])
            credential = "%s/%s/%s" %(request_type,credential,timestamp)

            if payload is None:
                payload = "%s|%s|%s|%s|%s|" %(request_type,
                                              names['collection'],
                                              timestamp,
                                              names['image'],
                                              names['tag'])

            signature = generate_signature(payload,self.secrets['registry']['token'])
            return "SREGISTRY-HMAC-SHA256 Credential=%s,Signature=%s" %(credential,signature)
def authorize ( self , names , payload = None , request_type = "push" ) : if self . secrets is not None : if "registry" in self . secrets : # Use the payload to generate a digest   push|collection|name|tag|user timestamp = generate_timestamp ( ) credential = generate_credential ( self . secrets [ 'registry' ] [ 'username' ] ) credential = "%s/%s/%s" % ( request_type , credential , timestamp ) if payload is None : payload = "%s|%s|%s|%s|%s|" % ( request_type , names [ 'collection' ] , timestamp , names [ 'image' ] , names [ 'tag' ] ) signature = generate_signature ( payload , self . secrets [ 'registry' ] [ 'token' ] ) return "SREGISTRY-HMAC-SHA256 Credential=%s,Signature=%s" % ( credential , signature )
Authorize a client based on encrypting the payload with the client
       token, which should be matched on the receiving server
Authorize a client based on encrypting the payload with the client token which should be matched on the receiving server