@@ -34,8 +34,8 @@ class OneLogin_Saml2_Metadata(object):
3434 TIME_VALID = 172800 # 2 days
3535 TIME_CACHED = 604800 # 1 week
3636
37- @staticmethod
38- def builder (sp , authnsign = False , wsign = False , valid_until = None , cache_duration = None , contacts = None , organization = None ):
37+ @classmethod
38+ def builder (cls , sp , authnsign = False , wsign = False , valid_until = None , cache_duration = None , contacts = None , organization = None ):
3939 """
4040 Builds the metadata of the SP
4141
@@ -61,7 +61,7 @@ def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=N
6161 :type organization: dict
6262 """
6363 if valid_until is None :
64- valid_until = int (time ()) + OneLogin_Saml2_Metadata .TIME_VALID
64+ valid_until = int (time ()) + cls .TIME_VALID
6565 if not isinstance (valid_until , basestring ):
6666 if isinstance (valid_until , datetime ):
6767 valid_until_time = valid_until .timetuple ()
@@ -72,7 +72,7 @@ def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=N
7272 valid_until_str = valid_until
7373
7474 if cache_duration is None :
75- cache_duration = OneLogin_Saml2_Metadata .TIME_CACHED
75+ cache_duration = cls .TIME_CACHED
7676 if not isinstance (cache_duration , compat .str_type ):
7777 cache_duration_str = 'PT%sS' % cache_duration # Period of Time x Seconds
7878 else :
@@ -228,8 +228,8 @@ def __add_x509_key_descriptors(root, cert, signing):
228228 x509_certificate .text = OneLogin_Saml2_Utils .format_cert (cert , False )
229229 key_descriptor .set ('use' , ('encryption' , 'signing' )[signing ])
230230
231- @staticmethod
232- def add_x509_key_descriptors (metadata , cert = None , add_encryption = True ):
231+ @classmethod
232+ def add_x509_key_descriptors (cls , metadata , cert = None , add_encryption = True ):
233233 """
234234 Adds the x509 descriptors (sign/encryption) to the metadata
235235 The same cert will be used for sign/encrypt
@@ -260,6 +260,6 @@ def add_x509_key_descriptors(metadata, cert=None, add_encryption=True):
260260 raise Exception ('Malformed metadata.' )
261261
262262 if add_encryption :
263- OneLogin_Saml2_Metadata .__add_x509_key_descriptors (sp_sso_descriptor , cert , False )
264- OneLogin_Saml2_Metadata .__add_x509_key_descriptors (sp_sso_descriptor , cert , True )
263+ cls .__add_x509_key_descriptors (sp_sso_descriptor , cert , False )
264+ cls .__add_x509_key_descriptors (sp_sso_descriptor , cert , True )
265265 return OneLogin_Saml2_XML .to_string (root )
0 commit comments