Re: how to write our own handler to handle login in cherryPY

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
Dharmendra Shaw wrote:
> I am using cherrypy for my web app for authentication we are using
>  "tools.session_auth.login_screen " and
>  "tools.session_auth.check_username_and_password" handlers for login
> authentication
>  Now I have a need to support  login  to app using REST api call
> something like below url using basic authentication call from another
> app     login?username=username&password=test

First, a very picky terminology issue.  "Basic authentication" is the
name for the default HTTP authentication scheme that is handled directly
by the browser.  If you are doing the authentication yourself (which
session_auth does), that's different.

If your login_screen code expects the username and password in the field
names you have there, then that login URL ought to work.  In response to
that, Python will send you a cookie identifying your session.  Your REST
calls need to pass that cookie back with every request they send, using
standard cookie handling.  If your REST code doesn't expect cookies,
that's probably the problem.

I would point out that sending username and password in clear text is
not secure.  I don't know what information you're protecting there, but
if it is valuable at all, you will probably want to find a different scheme.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.