def __init__(self): log.info("Identity visit plugin initialised") get = gearshift.config.get self.provider = create_default_provider() # When retrieving identity information from the form, use the following # form field names. These fields will be removed from the post data to # prevent the controller from receiving unexpected fields. self.user_name_field = get('tools.identity.form.user_name', 'user_name') self.password_field = get('tools.identity.form.password', 'password') self.submit_button_name = get('tools.identity.form.submit', 'login') # Sources for identity information and the order in which they should be # checked. These terms are mapped to methods by prepending # "identity_from_". sources = get('tools.identity.source', 'form,http_auth,visit').split(',') self.identity_sources = list() for s in sources: try: source_method = getattr(self, 'identity_from_' + s) except AttributeError: raise IdentityConfigurationException( "Invalid identity source: %s" % s) self.identity_sources.append(source_method)
def create_extension_model(): provider = create_default_provider() provider.create_provider_model()