Exemplo n.º 1
0
def user_openid_login():

    try:
        params = "resource_id=%s&redirect_uri=%s&state=%s" % \
            ( request.GET[ "resource_id" ],
              request.GET[ "redirect_uri" ],
              request.GET[ "state" ], )
    except:
        params = ""

    try:
        username = request.GET["username"]
    except:
        username = None

    try:
        provider = request.GET["provider"]
    except:
        return template("login_page_template",
                        REALM=REALM,
                        user=None,
                        params=params)
    try:
        url = OpenIDManager.process(realm=REALM,
                                    return_to=REALM + "/checkauth?" +
                                    urllib.quote(params),
                                    provider=provider,
                                    username=username,
                                    web_proxy=WEB_PROXY)
    except Exception, e:
        log.error(e)
        return user_error(e)
Exemplo n.º 2
0
def user_openid_authenticate():

    #o = OpenIDManager.Response( request.GET )
    o = OpenIDManager.Response(request.args)

    #check to see if the user logged in succesfully
    if (o.is_success()):

        user_id = o.get_user_id()
        email = o.get_user_email()

        #if so check we received a viable claimed_id
        if user_id:
            try:

                session['logged_in'] = True
                #user = db.user_fetch_by_id( user_id )

                #if this is a new user add them
                #if ( not user ):
                #    db.user_insert( o.get_user_id() )
                #    user_name = None
                #else :
                #    user_name = user.user_name

                #_set_authentication_cookie( user_id, user_name  )

            except Exception, e:
                return user_error(e)

        #if they don't something has gone horribly wrong, so mop up
        else:
            _delete_authentication_cookie()
Exemplo n.º 3
0
def authenticate():

    o = OpenIDManager.Response(request.GET)

    #check to see if the user logged in succesfully
    if (o.is_success()):

        user_id = o.get_user_id()

        #if so check we received a viable claimed_id
        if user_id:

            try:

                user = datadb.fetch_user_by_id(user_id)

                #if this is a new user add them
                if (not user):
                    datadb.insert_user(o.get_user_id())
                    datadb.commit()
                    user_name = None
                else:
                    user_name = user["user_name"]

                set_authentication_cookie(user_id, user_name)

            except Exception, e:
                return error(e)

        #if they don't something has gone horribly wrong, so mop up
        else:
            delete_authentication_cookie()
Exemplo n.º 4
0
def user_openid_login():

    try:
        params = "resource_id=%s&redirect_uri=%s&state=%s" % \
            ( request.GET[ "resource_id" ],
              request.GET[ "redirect_uri" ], 
              request.GET[ "state" ], )
    except:
        params = ""
    
    try: 
        username = request.GET[ "username" ]    
    except: 
        username = None
     
    try:      
        provider = request.GET[ "provider" ]
    except: 
        return template( 
            "login_page_template", 
            REALM=REALM, user=None, params=params )    
    try:
        url = OpenIDManager.process(
            realm=REALM,
            return_to=REALM + "/checkauth?" + urllib.quote( params ),
            provider=provider,
            username=username
        )
    except Exception, e:
        return user_error( e )
Exemplo n.º 5
0
def login():

    provider = request.args.get('provider', None)
    params = ""

    try:
        url = OpenIDManager.process(realm=REALM,
                                    return_to=REALM + "/checkauth?" +
                                    urllib.quote(params),
                                    provider=provider)
    except Exception, e:
        app.logger.error(e)
        return user_error(e)
Exemplo n.º 6
0
def login():

    provider = request.args.get('provider', None)  
    params=""
    
    try:
        url = OpenIDManager.process(
            realm=REALM,
            return_to=REALM + "/checkauth?" + urllib.quote( params ),
            provider=provider
        )
    except Exception, e:
        app.logger.error( e )
        return user_error( e )
Exemplo n.º 7
0
def openID_login():

    try:
        username = request.GET['username']
    except:
        username = None

    try:
        provider = request.GET['provider']
    except:
        return template('login_page_template', user=None)

    try:
        url = OpenIDManager.process(realm=REALM,
                                    return_to=REALM + "/checkauth",
                                    provider=provider,
                                    username=username)
    except Exception, e:
        return error(e)
Exemplo n.º 8
0
def openIDlogin():

    try: 
        username = request.GET[ 'username' ]
    except: 
        username = None
    
    try: 
        provider = request.GET[ 'provider' ]
    except: 
        return error( "provider must be supplied" )
    
    url = OpenIDManager.process(
        realm=REALM,
        return_to=REALM + "/checkauth",
        provider=provider,
        username=username
    )
    
    redirect( url )
Exemplo n.º 9
0
def openID_login():
    
    try: 
        username = request.GET[ 'username' ]    
    except: 
        username = None
     
    try:      
        provider = request.GET[ 'provider' ]
    except: 
        return template( 'login_page_template', user=None )
    
    try:
        url = OpenIDManager.process(
            realm=REALM,
            return_to=REALM + "/checkauth",
            provider=provider,
            username=username
        )
    except Exception, e:
        return error( e )