librelist archives

« back to archive

Http basic auth logout

Http basic auth logout

From:
Chris Fane
Date:
2012-12-14 @ 10:31
Hi,
I've been using the 'http basic auth' snippet as the basis for
constructing a simple authentication system.

One think I've struggled to find any information on is the creation of
a logout method.

My request object is always passed to me with an authorization
property, but I can't find anyway of un-authenticating. The
authorization property doesn't appear in the flask request documents,
so I assume is something that comes from the wsgi layer.

Any help would be most appreciated.

Thanks

Chris

Re: [flask] Http basic auth logout

From:
Matthew Brown
Date:
2012-12-14 @ 10:42
Hi Chris,

Assuming you mean this snippet: http://flask.pocoo.org/snippets/8/, there 
is no need for a logout method as such. 
Every request is authenticated against the username and password sent 
using with the request. If you were to not send credentials or if the 
credentials were incorrect at 401: Authorization Required error would be 
returned.

FYI The request.authorization property (and a lot of other useful stuff) 
comes from werkzeug (the underlying library used by flask) 
http://werkzeug.pocoo.org/docs/wrappers/#werkzeug.wrappers.AuthorizationMixin.authorization


Hope that helps a little :)
Cheers,
Matthew


-- 
Matthew Brown
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Friday, 14 December 2012 at 8:31 PM, Chris Fane wrote:

> Hi,
> I've been using the 'http basic auth' snippet as the basis for
> constructing a simple authentication system.
> 
> One think I've struggled to find any information on is the creation of
> a logout method.
> 
> My request object is always passed to me with an authorization
> property, but I can't find anyway of un-authenticating. The
> authorization property doesn't appear in the flask request documents,
> so I assume is something that comes from the wsgi layer.
> 
> Any help would be most appreciated.
> 
> Thanks
> 
> Chris 

Re: [flask] Http basic auth logout

From:
Chris Fane
Date:
2012-12-14 @ 11:25
Thanks, I'll have a look in the werkzeug docs.

Chris

On 14 Dec 2012, at 10:45, Matthew Brown <mnbbrown@gmail.com> wrote:

Hi Chris,

Assuming you mean this snippet: http://flask.pocoo.org/snippets/8/, there
is no need for a logout method as such.
Every request is authenticated against the username and password sent using
with the request. If you were to not send credentials or if the credentials
were incorrect at 401: Authorization Required error would be returned.

FYI The request.authorization property (and a lot of other useful stuff)
comes from werkzeug (the underlying library used by flask)

http://werkzeug.pocoo.org/docs/wrappers/#werkzeug.wrappers.AuthorizationMixin.authorization


Hope that helps a little :)
Cheers,
Matthew

-- 
Matthew Brown
Sent with Sparrow <http://www.sparrowmailapp.com/?sig>

On Friday, 14 December 2012 at 8:31 PM, Chris Fane wrote:

Hi,
I've been using the 'http basic auth' snippet as the basis for
constructing a simple authentication system.

One think I've struggled to find any information on is the creation of
a logout method.

My request object is always passed to me with an authorization
property, but I can't find anyway of un-authenticating. The
authorization property doesn't appear in the flask request documents,
so I assume is something that comes from the wsgi layer.

Any help would be most appreciated.

Thanks

Chris

Re: [flask] Http basic auth logout

From:
Xuanyi Chew
Date:
2012-12-14 @ 10:44
http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication

Basic Auth was not designed to handle logouts

Xuanyi Chew
+61403928398





On Fri, Dec 14, 2012 at 9:31 PM, Chris Fane <chris@chrisfane.co.uk> wrote:

> Hi,
> I've been using the 'http basic auth' snippet as the basis for
> constructing a simple authentication system.
>
> One think I've struggled to find any information on is the creation of
> a logout method.
>
> My request object is always passed to me with an authorization
> property, but I can't find anyway of un-authenticating. The
> authorization property doesn't appear in the flask request documents,
> so I assume is something that comes from the wsgi layer.
>
> Any help would be most appreciated.
>
> Thanks
>
> Chris
>

Re: [flask] Http basic auth logout

From:
Chris Fane
Date:
2012-12-14 @ 11:25
It sounds as if I might be best to look at another approach then. Thanks
for your help.

Chris

On 14 Dec 2012, at 10:49, Xuanyi Chew <chewxy@gmail.com> wrote:


http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication

Basic Auth was not designed to handle logouts

Xuanyi Chew
+61403928398





On Fri, Dec 14, 2012 at 9:31 PM, Chris Fane <chris@chrisfane.co.uk> wrote:

> Hi,
> I've been using the 'http basic auth' snippet as the basis for
> constructing a simple authentication system.
>
> One think I've struggled to find any information on is the creation of
> a logout method.
>
> My request object is always passed to me with an authorization
> property, but I can't find anyway of un-authenticating. The
> authorization property doesn't appear in the flask request documents,
> so I assume is something that comes from the wsgi layer.
>
> Any help would be most appreciated.
>
> Thanks
>
> Chris
>

Re: [flask] Http basic auth logout

From:
Owein Reese
Date:
2012-12-14 @ 20:23
What about the beautiful little flask-login library? It pretty much solves
a lot of issues while remaining fairly impk agnostic.
On Dec 14, 2012 6:32 AM, "Chris Fane" <chris@chrisfane.co.uk> wrote:

> It sounds as if I might be best to look at another approach then. Thanks
> for your help.
>
> Chris
>
> On 14 Dec 2012, at 10:49, Xuanyi Chew <chewxy@gmail.com> wrote:
>
>
> 
http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication
>
> Basic Auth was not designed to handle logouts
>
> Xuanyi Chew
> +61403928398
>
>
>
>
>
> On Fri, Dec 14, 2012 at 9:31 PM, Chris Fane <chris@chrisfane.co.uk> wrote:
>
>> Hi,
>> I've been using the 'http basic auth' snippet as the basis for
>> constructing a simple authentication system.
>>
>> One think I've struggled to find any information on is the creation of
>> a logout method.
>>
>> My request object is always passed to me with an authorization
>> property, but I can't find anyway of un-authenticating. The
>> authorization property doesn't appear in the flask request documents,
>> so I assume is something that comes from the wsgi layer.
>>
>> Any help would be most appreciated.
>>
>> Thanks
>>
>> Chris
>>
>
>

Re: [flask] Http basic auth logout

From:
Matthew Brown
Date:
2013-04-15 @ 05:34
Ahh yes… never again shall I answer a question 

-- 
Matthew Brown
Sent with Sparrow

On Friday, 14 December 2012 at 8:44 PM, Xuanyi Chew wrote:

> 
http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication
> 
> Basic Auth was not designed to handle logouts
> 
> Xuanyi Chew
> +61403928398
> 
> 
> 
> 
> 
> On Fri, Dec 14, 2012 at 9:31 PM, Chris Fane <chris@chrisfane.co.uk> wrote:
>> Hi,
>> I've been using the 'http basic auth' snippet as the basis for
>> constructing a simple authentication system.
>> 
>> One think I've struggled to find any information on is the creation of
>> a logout method.
>> 
>> My request object is always passed to me with an authorization
>> property, but I can't find anyway of un-authenticating. The
>> authorization property doesn't appear in the flask request documents,
>> so I assume is something that comes from the wsgi layer.
>> 
>> Any help would be most appreciated.
>> 
>> Thanks
>> 
>> Chris