from django.http import HttpResponseRedirect

# This example uses the django web framework, but you can adapt it for your
# own framework if needed. Simply take the ssoUrl set in startSso() and
# send an HTTP 302 response to that location.

# The saasid value is the GUID associated with the application. This is displayed in parentheses below 
# the application name on the My Applications page.
# You will need to replace the saasid value in "${saasId}" in the sample below with the GUID for your application. 
# For example: saasid = "18a6ada7-8f37-4d77-86f4-173046796193";
def startSso(request):
    idpid = getIdpId()
    saasid = "${saasId}"
    ssoUrl = "${tokenServiceBaseUrl}/sso/sp/initsso?saasid={0}&idpid={1}".format(saasid, idpid)
    return HttpResponseRedirect(ssoUrl)

# Implement me!
def getIdpId():
    return ""