#NEWLINE# def client_authentication_required( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# 'Determine if client authentication is required for current request.\n\n        According to the rfc6749, client authentication is required in the\n        following cases:\n\n        Resource Owner Password Credentials Grant: see `Section 4.3.2`_.\n        Authorization Code Grant: see `Section 4.1.3`_.\n        Refresh Token Grant: see `Section 6`_.\n\n        .. _`Section 4.3.2`: http://tools.ietf.org/html/rfc6749#section-4.3.2\n        .. _`Section 4.1.3`: http://tools.ietf.org/html/rfc6749#section-4.1.3\n        .. _`Section 6`: http://tools.ietf.org/html/rfc6749#section-6\n        ' #NEWLINE# if ( request . grant_type == 'password' ) : #NEWLINE# #INDENT# client = self . _clientgetter ( request . client_id ) #NEWLINE# return ( ( not client ) or ( client . client_type == 'confidential' ) or client . client_secret ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( request . grant_type == 'authorization_code' ) : #NEWLINE# #INDENT# client = self . _clientgetter ( request . client_id ) #NEWLINE# return ( ( not client ) or ( client . client_type == 'confidential' ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ( ( 'Authorization' in request . headers ) and ( request . grant_type == 'refresh_token' ) )