Fix example in documentation.
The example lacked the import of keystone.common.wsgi that could be misleading for new developers. Change-Id: I20be59f5792507a775d033867a69d31c5216633c
This commit is contained in:
parent
a2fe23613e
commit
31c6cd80e4
@ -66,6 +66,8 @@ be issued.
|
|||||||
Your code should set the ``REMOTE_USER`` if the user is properly authenticated,
|
Your code should set the ``REMOTE_USER`` if the user is properly authenticated,
|
||||||
following the semantics below::
|
following the semantics below::
|
||||||
|
|
||||||
|
from keystone.common import wsgi
|
||||||
|
|
||||||
class MyMiddlewareAuth(wsgi.Middleware):
|
class MyMiddlewareAuth(wsgi.Middleware):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(MyMiddlewareAuth, self).__init__(*args, **kwargs)
|
super(MyMiddlewareAuth, self).__init__(*args, **kwargs)
|
||||||
@ -84,7 +86,7 @@ following the semantics below::
|
|||||||
# User is authenticated
|
# User is authenticated
|
||||||
request.environ['REMOTE_USER'] = username
|
request.environ['REMOTE_USER'] = username
|
||||||
else:
|
else:
|
||||||
# User is not authenticated
|
# User is not authenticated, render exception
|
||||||
raise exception.Unauthorized("Invalid user")
|
raise exception.Unauthorized("Invalid user")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user