def demoSkinnyJwt(verticalType, classId, objectId): print(''' ############################# # # Generates a signed "skinny" JWT. # 2 REST calls are made: # x1 pre-insert one classes # x1 pre-insert one object which uses previously inserted class # # This JWT can be used in JS web button. # This is the shortest type of JWT; recommended for Android intents/redirects. # ############################# ''') skinnyJwt = services.makeSkinnyJwt(verticalType, classId, objectId) if skinnyJwt is not None: print('This is an "skinny" jwt:\n%s\n' % (skinnyJwt.decode('UTF-8'))) print( 'you can decode it with a tool to see the unsigned JWT representation:\n%s\n' % ('https://developers.google.com/pay/passes/support/testing#test-and-debug-a-jwt' )) print('Try this save link in your browser:\n%s%s\n' % (SAVE_LINK, skinnyJwt.decode('UTF-8'))) print( 'this is the shortest type of JWT; recommended for Android intents/redirects\n' ) return
def demoSkinnyJwt(verticalType, classId, objectId): # Modify connection info based on your environment ip = "trak.australiasoutheast.cloudapp.azure.com" port = 1972 namespace = "PASS" username = "******" password = "******" # create database connection and IRIS instance connection = irisnative.createConnection(ip, port, namespace, username, password) dbnative = irisnative.createIris(connection) print("Generates a signed skinny JWT.") Globalname = dbnative.get("name") Globalmrn = dbnative.get("mrn") Globalemail = dbnative.get("email") Globaldate = dbnative.get("date") Globaldoctor = dbnative.get("doctor") Globalhospital = dbnative.get("hospital") Globalhospitalphone = dbnative.get("hospitalphone") Globalhospitaladdress = dbnative.get("hospitaladdress") Globallocation = dbnative.get("location") Globalservice = dbnative.get("service") skinnyJwt = services.makeSkinnyJwt(verticalType, classId, objectId, Globalname, Globalmrn, Globaldate, Globaldoctor, Globalhospital, Globalhospitalphone, Globalhospitaladdress, Globallocation, Globalservice) if skinnyJwt is not None: print('This is an "skinny" jwt:\n%s\n' % (skinnyJwt.decode('UTF-8'))) print( 'you can decode it with a tool to see the unsigned JWT representation:\n%s\n' % ('https://jwt.io')) print("[1. Setting and getting a global]") dbnative.set(SAVE_LINK + skinnyJwt.decode('UTF-8'), "PassLink") Globallink = dbnative.get("PassLink") print("The value of testglobal is ", Globallink) return