Example #1
0
def login_begin(request,
                template_name='openid/login.html',
                login_complete_view='openid:openid-complete',
                form_class=ShibbolethOpenIDLoginForm,
                render_failure=default_render_failure,
                redirect_field_name=REDIRECT_FIELD_NAME):

    LOG.debug('new login begin')

    if request.user.is_authenticated():
        return shortcuts.redirect(get_user_home(request.user))

    if "openid_identifier" not in request.POST and "entityid" in request.POST:
        response = HttpResponseRedirect(
            "/Shibboleth.sso/Login?%s" %
            urlencode({
                "entityID": request.POST["entityid"],
                "target": request.POST.get("next", default="/project/")
            }))
        response.set_cookie("entityid_cookie", request.POST["entityid"])

        return response

    return old_login_begin(
        request,
        settings.ROOT_PATH + '/../tukey/templates/osdc/openid_login.html',
        login_complete_view, curry(form_class, request), render_failure,
        redirect_field_name)
Example #2
0
def login_begin(request, template_name='openid/login.html',
                login_complete_view='openid:openid-complete',
                form_class=ShibbolethOpenIDLoginForm,
                render_failure=default_render_failure,
                redirect_field_name=REDIRECT_FIELD_NAME):

    LOG.debug('new login begin')

    if request.user.is_authenticated():
        return shortcuts.redirect(get_user_home(request.user))

    if "openid_identifier" not in request.POST and "entityid" in request.POST:
        response = HttpResponseRedirect(
            "/Shibboleth.sso/Login?%s" % urlencode(
                {"entityID": request.POST["entityid"],
                    "target": request.POST.get("next", default="/project/")}
            )
        )
        response.set_cookie("entityid_cookie", request.POST["entityid"])

        return response

    return old_login_begin(request,
        settings.ROOT_PATH + '/../tukey/templates/osdc/openid_login.html',
        login_complete_view, curry(form_class, request), render_failure,
            redirect_field_name)
Example #3
0
def totpSubmit(request):
    """
	TOTP submit call. This will get the submitted TOTP from request and call keystone for TOTP validation.
	@param : request object
	"""
    LOG.info('totpSubmit function')
    res = callKeystone(request)
    LOG.info(request)
    if res:
        LOG.info('Will be redirected to dashboard page')
        response = shortcuts.redirect(get_user_home(request.user))
        return response
    else:
        LOG.info('Will be redirected to totp page itself')
        response = shortcuts.redirect('/dashboard/totp')
        return response
Example #4
0
def login_begin(request,
                template_name='openid/login.html',
                login_complete_view='openid:openid-complete',
                form_class=ShibbolethOpenIDLoginForm,
                render_failure=default_render_failure,
                redirect_field_name=REDIRECT_FIELD_NAME):

    #    req = requests.get("https://www.opensciencedatacloud.org/Shibboleth.sso/DiscoFeed")
    #    #req = requests.get(request.build_absolute_uri("/Shibboleth.sso/DiscoFeed"))
    #
    #    disco_feed = req.json()
    #
    #    print disco_feed
    #
    #    idps = ["urn:mace:incommon:lbl.gov", "urn:mace:incommon:uchicago.edu"]
    #
    #    idp_info = [(org["entityID"], org["DisplayNames"][0]["value"]) for org in
    #        disco_feed if org["entityID"] in idps]
    #
    #    form_class.entityid.choices = idp_info

    LOG.debug('new login begin')

    if request.user.is_authenticated():
        return shortcuts.redirect(get_user_home(request.user))

    if "openid_identifier" not in request.POST and "entityid" in request.POST:
        response = HttpResponseRedirect(
            "https://www.opensciencedatacloud.org/Shibboleth.sso/Login?%s" %
            urlencode({
                "entityID": request.POST["entityid"],
                "target": request.POST.get("next", default="/project/")
            }))
        response.set_cookie("entityid_cookie", request.POST["entityid"])

        return response

    return old_login_begin(
        request,
        settings.ROOT_PATH + '/../tukey/templates/osdc/openid_login.html',
        login_complete_view, curry(form_class, request), render_failure,
        redirect_field_name)
Example #5
0
def login_begin(request, template_name='openid/login.html',
                login_complete_view='openid:openid-complete',
                form_class=ShibbolethOpenIDLoginForm,
                render_failure=default_render_failure,
                redirect_field_name=REDIRECT_FIELD_NAME):


#    req = requests.get("https://www.opensciencedatacloud.org/Shibboleth.sso/DiscoFeed")
#    #req = requests.get(request.build_absolute_uri("/Shibboleth.sso/DiscoFeed"))
#
#    disco_feed = req.json()
#
#    print disco_feed
#
#    idps = ["urn:mace:incommon:lbl.gov", "urn:mace:incommon:uchicago.edu"]
#
#    idp_info = [(org["entityID"], org["DisplayNames"][0]["value"]) for org in
#        disco_feed if org["entityID"] in idps]
#
#    form_class.entityid.choices = idp_info

    LOG.debug('new login begin')

    if request.user.is_authenticated():
        return shortcuts.redirect(get_user_home(request.user))

    if "openid_identifier" not in request.POST and "entityid" in request.POST:
        response = HttpResponseRedirect(
            "https://www.opensciencedatacloud.org/Shibboleth.sso/Login?%s" % urlencode(
                {"entityID": request.POST["entityid"],
                    "target": request.POST.get("next", default="/project/")}
            )
        )
        response.set_cookie("entityid_cookie", request.POST["entityid"])

        return response
    
    return old_login_begin(request, 
        settings.ROOT_PATH + '/../tukey/templates/osdc/openid_login.html',
        login_complete_view, curry(form_class, request), render_failure,
            redirect_field_name)