Exemple #1
0
def streamingservice_device_register():
    logger.debug("streamingservice_device_register()")
    client_id = session[SESSION_INSTANCE_SETTINGS_KEY]["settings"]["app_deviceflow_clientid"]
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    idplist = okta_admin.get_idps()
    facebook = ""
    google = ""
    linkedin = ""
    microsoft = ""
    idp = ""
    idptype = ""
    appname = session[SESSION_INSTANCE_SETTINGS_KEY]["settings"]["app_deviceflow_appname"]
    if appname is None:
        appname = ""

    for idp in idplist:
        if idp["type"] == "FACEBOOK":
            facebook = idp["id"]
            idp = "true"
        elif idp["type"] == "GOOGLE":
            google = idp["id"]
            idp = "true"
        elif idp["type"] == "LINKEDIN":
            linkedin = idp["id"]
            idp = "true"
        elif idp["type"] == "MICROSOFT":
            microsoft = idp["id"]
            idp = "true"
        elif idp["type"] == "SAML2":
            idptype = "SAML2"
            idp = "true"

    url = "https://d9qgirtrci.execute-api.us-east-2.amazonaws.com/default/prd-zartan-devicestate?state={0}".format(session["device_state"])
    headers = {
        "x-api-key": session[SESSION_INSTANCE_SETTINGS_KEY]["settings"]["aws_api_key"],
    }
    s3response = RestUtil.execute_get(url, headers=headers)
    del s3response['state']
    return render_template(
        "streamingservice/device_register.html",
        templatename=get_app_vertical(),
        config=session[SESSION_INSTANCE_SETTINGS_KEY],
        state=session["device_state"],
        facebook=facebook,
        google=google,
        linkedin=linkedin,
        microsoft=microsoft,
        idp=idp,
        idptype=idptype,
        appname=appname,
        client_id=client_id,
        deviceinfo=json.dumps(s3response, sort_keys=True, indent=4))
Exemple #2
0
def gbac_login():
    logger.debug("gbac_login()")
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    loginmethod = session[SESSION_INSTANCE_SETTINGS_KEY]["settings"][
        "app_loginmethod"]

    if (loginmethod == "hosted-widget"):
        response = make_response(
            redirect(get_oauth_authorize_url(prompt="login")))
        return response

    else:
        idplist = okta_admin.get_idps(None)
        facebook = ""
        google = ""
        linkedin = ""
        microsoft = ""
        idp = ""
        idptype = ""
        for idp in idplist:
            if idp["type"] == "FACEBOOK":
                facebook = idp["id"]
                idp = "true"
            elif idp["type"] == "GOOGLE":
                google = idp["id"]
                idp = "true"
            elif idp["type"] == "LINKEDIN":
                linkedin = idp["id"]
                idp = "true"
            elif idp["type"] == "MICROSOFT":
                microsoft = idp["id"]
                idp = "true"
            elif idp["type"] == "SAML2":
                idptype = "SAML2"
                idp = "true"
            elif idp["type"] == "OIDC":
                idptype = "OIDC"
                idp = "true"

        return render_template("/login.html",
                               templatename=get_app_vertical(),
                               config=session[SESSION_INSTANCE_SETTINGS_KEY],
                               state=str(uuid.uuid4()),
                               facebook=facebook,
                               google=google,
                               linkedin=linkedin,
                               microsoft=microsoft,
                               idp=idp,
                               idptype=idptype)
Exemple #3
0
def gbac_saml_idps():
    logger.debug("gbac_saml_idps()")
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    idp_list = okta_admin.get_idps()

    for idp in idp_list:
        if idp['type'] != 'SAML2':
            idp_list.remove(idp)

    logger.debug(idp_list)
    return render_template("/managesamlidps.html",
                           templatename=get_app_vertical(),
                           user_info=get_userinfo(),
                           idplist=idp_list,
                           config=session[SESSION_INSTANCE_SETTINGS_KEY])
Exemple #4
0
def streamingservice_device_register():
    logger.debug("streamingservice_device_register()")
    client_id = session[SESSION_INSTANCE_SETTINGS_KEY]["settings"][
        "app_deviceflow_clientid"]
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    idplist = okta_admin.get_idps()
    facebook = ""
    google = ""
    linkedin = ""
    microsoft = ""
    idp = ""
    idptype = ""
    appname = session[SESSION_INSTANCE_SETTINGS_KEY]["settings"][
        "app_deviceflow_appname"]
    if appname is None:
        appname = ""

    for idp in idplist:
        if idp["type"] == "FACEBOOK":
            facebook = idp["id"]
            idp = "true"
        elif idp["type"] == "GOOGLE":
            google = idp["id"]
            idp = "true"
        elif idp["type"] == "LINKEDIN":
            linkedin = idp["id"]
            idp = "true"
        elif idp["type"] == "MICROSOFT":
            microsoft = idp["id"]
            idp = "true"
        elif idp["type"] == "SAML2":
            idptype = "SAML2"
            idp = "true"

    return render_template("streamingservice/device_register.html",
                           templatename=get_app_vertical(),
                           config=session[SESSION_INSTANCE_SETTINGS_KEY],
                           state=session["device_state"],
                           facebook=facebook,
                           google=google,
                           linkedin=linkedin,
                           microsoft=microsoft,
                           idp=idp,
                           idptype=idptype,
                           appname=appname,
                           client_id=client_id)
Exemple #5
0
def gbac_saml_idps():
    logger.debug("gbac_saml_idps()")
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    idp_list = okta_admin.get_idps("SAML2")

    # Grab the runtime details we care about and stuff them into a JSON object
    # for easy display.
    for idp in idp_list:
        detail = {
            "acs_url": idp['_links']['acs']['href'],
            "metadata_url": idp['_links']['metadata']['href']
        }
        idp["detailJSON"] = json.dumps(detail)

    logger.debug(idp_list)
    return render_template("/managesamlidps.html",
                           templatename=get_app_vertical(),
                           user_info=get_userinfo(),
                           idplist=idp_list,
                           config=session[SESSION_INSTANCE_SETTINGS_KEY])
Exemple #6
0
def gbac_login():
    logger.debug("gbac_login()")
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    idplist = okta_admin.get_idps(None)
    facebook = ""
    google = ""
    linkedin = ""
    microsoft = ""
    idp = ""
    idptype = ""
    for idp in idplist:
        if idp["type"] == "FACEBOOK":
            facebook = idp["id"]
            idp = "true"
        elif idp["type"] == "GOOGLE":
            google = idp["id"]
            idp = "true"
        elif idp["type"] == "LINKEDIN":
            linkedin = idp["id"]
            idp = "true"
        elif idp["type"] == "MICROSOFT":
            microsoft = idp["id"]
            idp = "true"
        elif idp["type"] == "SAML2":
            idptype = "SAML2"
            idp = "true"
    return render_template(
        "/login.html",
        templatename=get_app_vertical(),
        config=session[SESSION_INSTANCE_SETTINGS_KEY],
        state=str(uuid.uuid4()),
        facebook=facebook,
        google=google,
        linkedin=linkedin,
        microsoft=microsoft,
        idp=idp,
        idptype=idptype)