#NEWLINE# def signed_userinfo( self , client_info , userinfo , session ) : #NEWLINE# #INDENT# '\n        Will create a JWS with the userinfo as payload.\n\n        :param client_info: Client registration information\n        :param userinfo: An OpenIDSchema instance\n        :param session: Session information\n        :return: A JWS containing the userinfo as a JWT\n        ' #NEWLINE# try : #NEWLINE# #INDENT# algo = client_info [ 'userinfo_signed_response_alg' ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# algo = self . jwx_def [ 'signing_alg' ] [ 'userinfo' ] #NEWLINE# #UNINDENT# if ( algo == 'none' ) : #NEWLINE# #INDENT# key = [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if algo . startswith ( 'HS' ) : #NEWLINE# #INDENT# key = self . keyjar . get_signing_key ( alg2keytype ( algo ) , client_info [ 'client_id' ] , alg = algo ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# key = self . keyjar . get_signing_key ( alg2keytype ( algo ) , '' , alg = algo ) #NEWLINE# #UNINDENT# if ( not key ) : #NEWLINE# #INDENT# return self . _error ( error = 'access_denied' , descr = 'Missing signing key' ) #NEWLINE# #UNINDENT# #UNINDENT# jinfo = userinfo . to_jwt ( key , algo ) #NEWLINE# if ( 'userinfo_encrypted_response_alg' in client_info ) : #NEWLINE# #INDENT# jinfo = self . encrypt ( jinfo , client_info , session [ 'client_id' ] , 'userinfo' , 'JWT' ) #NEWLINE# #UNINDENT# return jinfo