#NEWLINE# def __init__( self , secret , key_provider , server_name , token_lifetime = 60 , now_func = time . time , lowest_supported_version = 0 ) : #NEWLINE# #INDENT# '\n        Constructs a new AuthServer object, with the given parameters.\n\n        @param secret a string containing the secret data used to authenticate\n        requests\n\n        @param key_provider a subclass of KeyProvider\n\n        @param server_name a text string included in the challenge that needs\n        to match the host that the client connects to\n\n        @param token_lifetime the number of seconds that a token issued by\n        this instance should be valid for\n\n        @param now_func a function that returns current time in unix seconds.\n        Used for testing\n\n        @lowest_supported_version an integer that indicates the lowest protocol\n        version that is supported, 0 represents the unversioned first protocol\n        ' #NEWLINE# self . token_lifetime = token_lifetime #NEWLINE# self . secret = secret #NEWLINE# self . key_provider = key_provider #NEWLINE# self . urandom = open ( '/dev/urandom' , 'r' ) #NEWLINE# if ( not re . match ( '^[a-zA-Z0-9.-]+$' , server_name ) ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Invalid server name, can only contain letters, numbers, dot (.) and hyphen (-): ' + server_name ) ) #NEWLINE# #UNINDENT# if ( len ( server_name ) > 255 ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Too long length of server_name: ' + len ( server_name ) ) ) #NEWLINE# #UNINDENT# self . server_name = server_name #NEWLINE# self . now_func = now_func #NEWLINE# self . lowest_supported_version = lowest_supported_version