Commit 3d47f92b authored by Gao, Shang's avatar Gao, Shang
Browse files

testing remote auth script

parent f57e06aa
Loading
Loading
Loading
Loading
+27 −14
Original line number Diff line number Diff line
@@ -81,12 +81,14 @@ class crossbowGlobus(crossbowBase):
    '''

    def __init__(self,api_key,CKAN_url="http://128.219.185.145:5000",
                 user_agent='crossbow',token_file='refresh-tokens.json'):
                 user_agent='crossbow',token_file='refresh-tokens.json',
                 init=True):
        
        self.client_id = '18270179-b498-4032-9187-ca646d6e29af'
        #self.cadesdtn = 'e6bcd4fa-ac1b-11e6-9aee-22000a1e3b52'
        self.cadesdtn = '586dc9b6-189a-11e7-bb9f-22000b9a448b'

        if init:
            try:
                # if we already have tokens, load and use them
                tokens = self._load_tokens_from_file(token_file)
@@ -136,6 +138,17 @@ class crossbowGlobus(crossbowBase):
        # return a set of tokens, organized by resource server name
        return token_response.by_resource_server
        
    def _get_authorize_url(self,client_id):
        """
        returns the authorization url for native app authentication
        """
        client = globus_sdk.NativeAppAuthClient(client_id=client_id)
        # pass refresh_tokens=True to request refresh tokens
        client.oauth2_start_flow(refresh_tokens=True)

        authorize_url = client.oauth2_get_authorize_url()
        return authorize_url
        
    def _activate_endpoint(self,ep_id):
        """
        function for manually activating an endpoint
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ class crossbowOlcf(object):
        
        #get tokens
        ssh_stdin, ssh_stdout, ssh_stderr = \
            self.ssh.exec_command("cd crossbow/crossbow; python test.py")
            self.ssh.exec_command("cd crossbow/crossbow; python remote_auth_1.py")
        print ssh_stdout.readlines()
        
if __name__ == "__main__":
+5 −0
Original line number Diff line number Diff line
from crossbowGlobus import crossbowGlobus

cbow = crossbowGlobus(api_key="eaabd7d9-3cb4-4014-85fe-73736e658472",init=False)
url = cbow._get_authorize_url(self,cbow.client_id)
print url

crossbow/test.py

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
print "hello world"