Пример #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)
Пример #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:

        return render_template(
            "/profile.html",
            templatename=get_app_vertical(),
            id_token=TokenUtil.get_id_token(request.cookies),
            access_token=TokenUtil.get_access_token(request.cookies),
            user_info=get_userinfo(),
            config=session[SESSION_INSTANCE_SETTINGS_KEY])
Пример #3
0
def travelagency_profile():
    return render_template("travelagency/profile.html",
                           id_token=TokenUtil.get_id_token(request.cookies),
                           access_token=TokenUtil.get_access_token(
                               request.cookies),
                           user_info=get_userinfo(),
                           config=session[SESSION_INSTANCE_SETTINGS_KEY])
Пример #4
0
def credit_profile():
    logger.debug("credit_profile()")
    return render_template("credit/profile.html",
                           id_token=TokenUtil.get_id_token(request.cookies),
                           access_token=TokenUtil.get_access_token(
                               request.cookies),
                           user_info=get_userinfo(),
                           config=session[SESSION_INSTANCE_SETTINGS_KEY])
Пример #5
0
def sample_profile():
    logger.debug("sample_profile()")
    return render_template("{0}/profile.html".format(get_app_vertical()),
                           templatename=get_app_vertical(),
                           id_token=TokenUtil.get_id_token(request.cookies),
                           access_token=TokenUtil.get_access_token(
                               request.cookies),
                           user_info=get_userinfo(),
                           config=session[SESSION_INSTANCE_SETTINGS_KEY])
Пример #6
0
def developer_profile():
    logger.debug("developer_profile()")

    return render_template(
        "developer/profile.html",
        id_token=TokenUtil.get_id_token(request.cookies),
        access_token=TokenUtil.get_access_token(request.cookies),
        templatename=get_app_vertical(),
        user_info=get_userinfo(),
        config=session[SESSION_INSTANCE_SETTINGS_KEY],
        _scheme=session[SESSION_INSTANCE_SETTINGS_KEY]["app_scheme"])
Пример #7
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])
Пример #8
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)
Пример #9
0
def b2b_profile():
    logger.debug("b2b_profile()")
    user_info = get_userinfo()
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    user = okta_admin.get_user(user_info["sub"])
    app_info = okta_admin.get_applications_by_user_id(user["id"])

    return render_template("{0}/profile.html".format(get_app_vertical()),
                           templatename=get_app_vertical(),
                           id_token=TokenUtil.get_id_token(request.cookies),
                           access_token=TokenUtil.get_access_token(
                               request.cookies),
                           user_info=get_userinfo(),
                           config=session[SESSION_INSTANCE_SETTINGS_KEY],
                           applist=app_info)
Пример #10
0
def get_userinfo():
    logger.debug("get_userinfo()")
    user_info = None
    session[SESSION_INSTANCE_SETTINGS_KEY][GET_NEW_TOKEN_URL] = ""

    if TokenUtil.is_valid_remote(TokenUtil.get_access_token(request.cookies),
                                 session[SESSION_INSTANCE_SETTINGS_KEY]):
        logger.debug("valid")
        user_info = TokenUtil.get_claims_from_token(
            TokenUtil.get_id_token(request.cookies))
    else:
        logger.debug("notvalid")
        session[SESSION_INSTANCE_SETTINGS_KEY][
            GET_NEW_TOKEN_URL] = get_oauth_authorize_url()
    return user_info
Пример #11
0
def healthcare_schedule():
    logger.debug("healthcare_schedule")
    user_info = get_userinfo()
    okta_admin = OktaAdmin(session[SESSION_INSTANCE_SETTINGS_KEY])
    user = okta_admin.get_user(user_info["sub"])
    dob = ""
    gender = ""
    if get_udp_ns_fieldname("dob") in user["profile"]:
        dob = user["profile"][get_udp_ns_fieldname("dob")]
    if get_udp_ns_fieldname("gender") in user["profile"]:
        gender = user["profile"][get_udp_ns_fieldname("gender")]

    return render_template(
        "healthcare/schedule.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],
        dob=dob,
        gender=gender)
Пример #12
0
def gbac_id_tokenp():
    token = TokenUtil.get_id_token(request.cookies)
    decodedToken = TokenUtil.get_claims_from_token(token)
    return json.dumps(decodedToken)