#NEWLINE# def unauthorized( self , response ) : #NEWLINE# #INDENT# ' Given a response, change it to ask for credentials ' #NEWLINE# if response . serve_challenge_on_401 : #NEWLINE# #INDENT# realm = current_app . config . get ( 'HTTP_BASIC_AUTH_REALM' , 'flask-restful' ) #NEWLINE# challenge = '{0} realm="{1}"' . format ( 'Basic' , realm ) #NEWLINE# response . headers [ 'WWW-Authenticate' ] = challenge #NEWLINE# #UNINDENT# return response