#NEWLINE# def get_subject( self ) : #NEWLINE# #INDENT# ' The assertion must contain a Subject\n        ' #NEWLINE# assert self . assertion . subject #NEWLINE# subject = self . assertion . subject #NEWLINE# subjconf = [ ] #NEWLINE# for subject_confirmation in subject . subject_confirmation : #NEWLINE# #INDENT# _data = subject_confirmation . subject_confirmation_data #NEWLINE# if ( subject_confirmation . method == SCM_BEARER ) : #NEWLINE# #INDENT# if ( not self . _bearer_confirmed ( _data ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( subject_confirmation . method == SCM_HOLDER_OF_KEY ) : #NEWLINE# #INDENT# if ( not self . _holder_of_key_confirmed ( _data ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( subject_confirmation . method == SCM_SENDER_VOUCHES ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'Unknown subject confirmation method: %s' % ( subject_confirmation . method , ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# subjconf . append ( subject_confirmation ) #NEWLINE# #UNINDENT# if ( not subjconf ) : #NEWLINE# #INDENT# raise VerificationError ( 'No valid subject confirmation' ) #NEWLINE# #UNINDENT# subject . subject_confirmation = subjconf #NEWLINE# try : #NEWLINE# #INDENT# assert subject . name_id #NEWLINE# self . name_id = subject . name_id #NEWLINE# #UNINDENT# except AssertionError : #NEWLINE# #INDENT# if subject . encrypted_id : #NEWLINE# #INDENT# _name_id_str = self . sec . decrypt ( subject . encrypted_id . encrypted_data . to_string ( ) ) #NEWLINE# _name_id = saml . name_id_from_string ( _name_id_str ) #NEWLINE# self . name_id = _name_id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise VerificationError ( 'Missing NameID' ) #NEWLINE# #UNINDENT# #UNINDENT# logger . info ( ( 'Subject NameID: %s' % self . name_id ) ) #NEWLINE# return self . name_id