Hello there!

Need Help? We are right here!

miniOrange Email Support
success

Thanks for your inquiry.

If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com

Search Results:

×

Authenticate Python with JWT
miniOrange provides a ready to use code in python for solution. Use the following python code with any SAML IDP or any other social or enterprise credential store using JWT.

Python Single Sign On with SAML IDP using JWT


Follow the Step-by-Step Guide given below to integrate your Python code with SAML IDP using JWT.

Step 1: Set up an Identity Source in miniOrange

Step 2: Configure miniOrange as relying party in your SAML IDP

Step 3: Creating an external app in miniOrange

Step 4: Fetching the Customer Key and Customer Token Key

Step 5: Adding the request page

request.py
from Crypto.Cipher import AES
import base64
import webbrowser
import urllib
import time
 
key = <CUSTUMER_KEY>
customer_id=<CUSTUMER_ID>
app_secret=<APP_SECRET>
return_url = 'http://localhost:5000'
timestamp= long(round(time.time()*1000))
text=str(timestamp)+":"+app_secret
cipher = AES.new(key, AES.MODE_ECB)
padSize = 16 - (len(text) % 16);
for i in range(0,padSize):
    text += chr(padSize)
msg =cipher.encrypt(text)
cipher_text=(base64.b64encode(msg)).encode("utf-8")
webbrowser.open("https://mytest.miniorange.in/moas/broker/login/jwt/"+customer_id+"/"+"?token="+urllib.quote_plus(cipher_text)+"&returnUrl="+urllib.quote_plus(return_url), new=2)

Step 6: Adding the response page

callback.py
from flask import Flask,request
import urlparse
import base64
import json
import time 

app = Flask(__name__)

@app.route("/")
def main():
  if request.method == 'GET':
    parsed = urlparse.urlparse(request.url)
    id_token=urlparse.parse_qs(parsed.query)['id_token']
    id_array=str(id_token).split(".")
    id_array[1] += "=" * ((4 - len(id_array[1]) % 4) % 4)
    j=json.loads(base64.b64decode(id_array[1]))
    if j['exp']>long(round(time.time()/1000)):
      return j['NameID']
    else:
      return "Response expired. Try login again."

if __name__ == "__main__":
  app.run()

Why Our Customers choose miniOrange Secure Identity Solutions ?


24/7 Support

miniOrange provides 24/7 support for all the Secure Identity Solutions. We ensure high quality support to meet your satisfaction.

Try Now

Affordable Pricing

miniorange provides most affordable Secure Identity Solutions for all type of use cases and offers different packages based on customer's requirement.

Request A Quote


We offer Secure Identity Solutions for Single Sign-On, Two Factor Authentication, Adaptive MFA, Provisioning, and much more. Please contact us at -

   +1 978 658 9387 (US)   ,   +91 97178 45846 (India)    |       info@xecurify.com