Exemplo n.º 1
0
def signon():
    def nav():
        if 'login_redir' in session:
            return redirect(session.pop('login_redir'))

        return redirect('/')

    user_name = request.args.get('user')

    if user_name:
        # This is a backdoor, probably shouldn't be here on production...
        #if not PRODUCTION:
        ServiceApi.signon_user_testmode(user_name)
        return nav()

    # carriage returns were removed on the cilogon portal side,
    # restore them before processing
    raw_cert = request.args.get('cert')
    if not raw_cert:
        return nav()

    certificate = base64.b64decode(raw_cert)

    # call backend to signon user
    # will stash user id, expiry, is_registered and roles in session
    ServiceApi.signon_user(certificate)

    return nav()
Exemplo n.º 2
0
def signon():
    def nav():
        if 'login_redir' in session:
            return redirect(session.pop('login_redir'))

        return redirect('/')

    user_name = request.args.get('user')
    
    if user_name:
        if not PRODUCTION:
            ServiceApi.signon_user_testmode(user_name)
        return nav()

    # carriage returns were removed on the cilogon portal side,
    # restore them before processing
    raw_cert = request.args.get('cert')
    if not raw_cert:
        return nav()

    certificate = base64.b64decode(raw_cert)

    # call backend to signon user
    # will stash user id, expiry, is_registered and roles in session
    ServiceApi.signon_user(certificate)

    return nav()
Exemplo n.º 3
0
def signon():
    user_name = request.args.get('user')
    if user_name:
        ServiceApi.signon_user_testmode(user_name)
        return redirect('/')

    # carriage returns were removed on the cilogon portal side,
    # restore them before processing
    raw_cert = request.args.get('cert')
    if not raw_cert:
        return redirect('/')

    certificate = base64.b64decode(raw_cert)

    # call backend to signon user
    # will stash user id, expiry, is_registered and roles in session
    ServiceApi.signon_user(certificate)

    if session['is_registered'] == False:
        # redirect to registration screen
        return redirect('/userprofile')
    else:
        return redirect('/')
Exemplo n.º 4
0
Arquivo: main.py Projeto: seman/ion-ux
def signon():
    user_name = request.args.get('user')
    if user_name:
        ServiceApi.signon_user_testmode(user_name)
        return redirect('/')
    
    # carriage returns were removed on the cilogon portal side,
    # restore them before processing
    raw_cert = request.args.get('cert')
    if not raw_cert:
        return redirect('/')

    certificate = base64.b64decode(raw_cert)

    # call backend to signon user
    # will stash user id, expiry, is_registered and roles in session
    ServiceApi.signon_user(certificate)    

    if session['is_registered'] == False:
        # redirect to registration screen
        return redirect('/userprofile')
    else:
        return redirect('/')