Beispiel #1
0
def ecommerce_profile():
    logger.debug("ecommerce_profile()")
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    user_info = get_userinfo()
    user_info2 = okta_admin.get_user(user_info["sub"])
    factors = get_enrolled_factors(user_info["sub"])

    if get_udp_ns_fieldname("consent") in user_info2["profile"]:
        consent = user_info2["profile"][get_udp_ns_fieldname("consent")]
        if consent.strip() == "":
            consent = ''
            session['appointment'] = "No Appointments Currently Set."
    else:
        consent = ''

    crediturl = ''
    app_info = okta_admin.get_applications_by_user_id(user_info["sub"])
    for item in app_info:
        if "credit Demo (Generated by UDP)" in item["label"]:
            domain = urlparse(
                item["settings"]["oauthClient"]["initiate_login_uri"]).netloc
            crediturl = "https://" + domain

    return render_template("ecommerce/profile.html",
                           id_token=TokenUtil.get_id_token(request.cookies),
                           access_token=TokenUtil.get_access_token(
                               request.cookies),
                           user_info=user_info,
                           user_info2=user_info2,
                           consent=consent,
                           factors=factors,
                           config=session[SESSION_INSTANCE_SETTINGS_KEY],
                           crediturl=crediturl)
Beispiel #2
0
def profile_bp():
    logger.debug("profile_bp_profile()")
    if request.args.get('refreshtoken') == 'true':
        okta_auth = OktaAuth(session[SESSION_INSTANCE_SETTINGS_KEY])

        auth_options = {
            "response_mode": "form_post",
            "prompt": "none",
            "scope": "openid profile email"
        }

        session["oidc_state"] = str(uuid.uuid4())
        session[FROM_URI_KEY] = request.url.replace(
            "http://", "{0}://".format(session[SESSION_INSTANCE_SETTINGS_KEY]
                                       ["app_scheme"])) + "profile"

        oauth_authorize_url = okta_auth.create_oauth_authorize_url(
            response_type="code",
            state=session["oidc_state"],
            auth_options=auth_options)

        return redirect(oauth_authorize_url)
    else:
        user_info = get_userinfo()
        factors = get_enrolled_factors(user_info["sub"])

        return render_template(
            "/profile.html",
            templatename=get_app_vertical(),
            id_token=TokenUtil.get_id_token(request.cookies),
            factors=factors,
            access_token=TokenUtil.get_access_token(request.cookies),
            user_info=get_userinfo(),
            config=session[SESSION_INSTANCE_SETTINGS_KEY])
Beispiel #3
0
def ecommerce_profile():
    logger.debug("ecommerce_profile()")
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    user_info = get_userinfo()
    user_info2 = okta_admin.get_user(user_info["sub"])
    factors = get_enrolled_factors(user_info["sub"])
    return render_template("ecommerce/profile.html",
                           id_token=TokenUtil.get_id_token(request.cookies),
                           access_token=TokenUtil.get_access_token(
                               request.cookies),
                           user_info=user_info,
                           user_info2=user_info2,
                           factors=factors,
                           config=session[SESSION_INSTANCE_SETTINGS_KEY])
Beispiel #4
0
def healthcare_profile():
    user_info = get_userinfo()
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    user = okta_admin.get_user(user_info["sub"])

    if get_udp_ns_fieldname("consent") in user["profile"]:
        logging.debug(user)
        consent = user["profile"][get_udp_ns_fieldname("consent")]
        logging.debug(consent)
        if consent.strip() == "":
            consent = ''
            session['appointment'] = "No Appointments Currently Set."
    else:
        consent = ''
    logging.debug(consent)

    factors = get_enrolled_factors(user["id"])

    id_token = TokenUtil.get_id_token(request.cookies)
    patientid = TokenUtil.get_single_claim_from_token(id_token, "extPatientId")

    is_evident_validated = ""
    if get_udp_ns_fieldname("is_evident_validated") in user["profile"]:
        is_evident_validated = user["profile"][get_udp_ns_fieldname(
            "is_evident_validated")]

    return render_template("healthcare/profile.html",
                           id_token=TokenUtil.get_id_token(request.cookies),
                           access_token=TokenUtil.get_access_token(
                               request.cookies),
                           user_info=get_userinfo(),
                           user_info2=user,
                           config=session[SESSION_INSTANCE_SETTINGS_KEY],
                           consent=consent,
                           factors=factors,
                           patientid=patientid,
                           is_evident_validated=is_evident_validated)