Now I'm stuck:

    def __init__(self, g,
                 urlbase = "https://web2py.com/cas/cas";,
                 actions=['login','check','logout'],
                 maps=dict(username=lambda v:v[2],
                           email=lambda v:v[1],
                           user_id=lambda v:v[0]),
                           casversion = 1,
                           casusername = 'cas:user'
              ):

I know what a lambda function is, but how is this dictionary
initialised? What executes the lambda function here? This python is
above my head. Any suggestions?

Thanks

On Apr 29, 3:04 pm, Stodge <sto...@gmail.com> wrote:
> I had to use:
>
> actions=['login','validate','logout']
>
> Now I'm getting:
>
>   File "/home/mike/Development/python/web2py/gluon/contrib/
> login_methods/cas_auth.py", line 80, in get_user
>     d[key]=self.maps[key](user)
>   File "/home/mike/Development/python/web2py/gluon/contrib/
> login_methods/cas_auth.py", line 45, in <lambda>
>     maps=dict(username=lambda v:v[2],
> IndexError: list index out of range
>
> Working on it!
>
> On Apr 29, 2:58 pm, Stodge <sto...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Ah, the CAS code is assuming that the provider supports at least three
> > actions:
>
> >         self.cas_login_url="%s/%s"%(self.urlbase,actions[0])
> >         self.cas_check_url="%s/%s"%(self.urlbase,actions[1])
> >         self.cas_logout_url="%s/%s"%(self.urlbase,actions[2])
>
> > actions=['login','check','logout']
>
> > I guess django-cas-providor doesn't support 'check'.
>
> > On Apr 29, 2:53 pm, Stodge <sto...@gmail.com> wrote:
>
> > > I added some debug to web2py:
>
> > > in _CAS_login:
>
> > >         print
> > >         print self.cas_login_url
> > >         print self.cas_my_url
> > >         print self.ticket
>
> > > I get:
>
> > >http://10.1.1.1:10000/cas/loginhttp://10.1.1.1:9000/myapp/default/use...
> > > None
> > > redirecting
>
> > >http://10.1.1.1:10000/cas/loginhttp://10.1.1.1:9000/myapp/default/use...
> > > ST-WFIMvjxwlEaSmUHP2rCtG4p89KQyi
> > > Got ticket
>
> > >http://10.1.1.1:10000/cas/loginhttp://10.1.1.1:9000/myapp/default/use...
> > > None
> > > redirecting
>
> > > So it gets the ticket from the CAS provider, but it still thinks it
> > > has to login again and redirects. Hmm.
>
> > > On Apr 29, 1:29 pm, Stodge <sto...@gmail.com> wrote:
>
> > > > I'm trying to get web2py to authenticate against a Django CAS
> > > > provider. The CAS provider is athttp://10.1.1.1:10000/cas. The CAS
> > > > provider works for Django based CAS consumers.
>
> > > > I commented out the existing auth code in my db.py and added this as
> > > > per the instructions onhttp://web2py.com/cas:
>
> > > > from gluon.contrib.login_methods.cas_auth import
> > > > CasAuth
> > > > auth.define_tables(username=True)
> > > > auth.settings.login_form=CasAuth(
>
> > > > globals(),
> > > >    urlbase = "http://10.1.1.1:10000/
> > > > cas",
> > > >    actions=['login','check','logout'])
>
> > > > web2py is available at:http://10.1.1.1:9000/myapp/default. When I
> > > > visithttp://10.1.1.1:9000/myapp/default/user/login, I get redirected
> > > > to the CAS provider at:
>
> > > >      
> > > > http://10.1.1.1:10000/cas/login/?service=http://10.1.1.1:9000/myapp/d...
>
> > > > I can submit the login form but I get an error in Firefox:
>
> > > >       "The page isn't redirecting properly"
>
> > > > Is the CAS provider redirecting back to the correct place? Did I miss
> > > > something silly? Thanks

Reply via email to