Beispiel #1
0
def test_handle_login():
    # no messages in the beginning
    assert not flaskg._login_messages
    test_user1 = handle_login(flaskg.user,
                              login_username='******',
                              login_password='******',
                              stage='moin')
    test_login_message = [u'Invalid username or password.']
    assert flaskg._login_messages == test_login_message
    assert test_user1.name0 == ANON
    assert not test_user1.valid
    # pop the message
    flaskg._login_messages.pop()
    # try with a valid user
    givenauth_obj = GivenAuth()
    flaskg.user.auth_method = 'given'
    givenauth_obj.user_name = u'Test_User'
    create_user(u'Test_User', u'test_pass', u'*****@*****.**')
    test_user, bool_value = givenauth_obj.request(flaskg.user)
    test_user2 = handle_login(test_user,
                              login_username='******',
                              login_password='******',
                              stage='moin')
    assert not flaskg._login_messages
    assert test_user2.name == [
        u'Test_User',
    ]
    assert test_user2.valid
Beispiel #2
0
 def test_transform_username(self):
     givenauth_obj = GivenAuth()
     givenauth_obj.strip_maildomain = True
     givenauth_obj.strip_windomain = True
     givenauth_obj.titlecase = True
     givenauth_obj.remove_blanks = True
     result = givenauth_obj.transform_username(
         u'testDomain\\test [email protected]')
     assert result == 'TestName'
Beispiel #3
0
def test_handle_login():
    # no messages in the beginning
    assert not flaskg._login_messages
    test_user1 = handle_login(flaskg.user, login_username='******', login_password='******', stage='moin')
    test_login_message = [u'Invalid username or password.']
    assert flaskg._login_messages == test_login_message
    assert test_user1.name0 == ANON
    assert not test_user1.valid
    # pop the message
    flaskg._login_messages.pop()
    # try with a valid user
    givenauth_obj = GivenAuth()
    flaskg.user.auth_method = 'given'
    givenauth_obj.user_name = u'Test_User'
    create_user(u'Test_User', u'test_pass', u'*****@*****.**')
    test_user, bool_value = givenauth_obj.request(flaskg.user)
    test_user2 = handle_login(test_user, login_username='******', login_password='******', stage='moin')
    assert not flaskg._login_messages
    assert test_user2.name == [u'Test_User', ]
    assert test_user2.valid
Beispiel #4
0
 def test_request(self):
     givenauth_obj = GivenAuth()
     flaskg.user.auth_method = 'given'
     givenauth_obj.user_name = u'testDomain\\[email protected]'
     givenauth_obj.strip_maildomain = True
     givenauth_obj.strip_windomain = True
     givenauth_obj.titlecase = True
     givenauth_obj.remove_blanks = True
     create_user(u'Test_User', u'test_pass', u'*****@*****.**')
     test_user, bool_value = givenauth_obj.request(flaskg.user)
     assert test_user.valid
     assert test_user.name == [
         u'Test_User',
     ]
Beispiel #5
0
 def test_transform_username(self):
     givenauth_obj = GivenAuth()
     givenauth_obj.strip_maildomain = True
     givenauth_obj.strip_windomain = True
     givenauth_obj.titlecase = True
     givenauth_obj.remove_blanks = True
     result = givenauth_obj.transform_username(u'testDomain\\test [email protected]')
     assert result == 'TestName'
Beispiel #6
0
 def test_request(self):
     givenauth_obj = GivenAuth()
     flaskg.user.auth_method = 'given'
     givenauth_obj.user_name = u'testDomain\\[email protected]'
     givenauth_obj.strip_maildomain = True
     givenauth_obj.strip_windomain = True
     givenauth_obj.titlecase = True
     givenauth_obj.remove_blanks = True
     create_user(u'Test_User', u'test_pass', u'*****@*****.**')
     test_user, bool_value = givenauth_obj.request(flaskg.user)
     assert test_user.valid
     assert test_user.name == [u'Test_User', ]
Beispiel #7
0
 def test_decode_username(self):
     givenauth_obj = GivenAuth()
     result1 = givenauth_obj.decode_username('test_name')
     assert result1 == u'test_name'
     result2 = givenauth_obj.decode_username(123.45)
     assert result2 == 123.45
Beispiel #8
0
 def __init__(self, *args, **kwargs):
     logging.warning(
         "DEPRECATED use of MoinMoin.auth.http.HTTPAuth, please read instructions there or docs/CHANGES!"
     )
     GivenAuth.__init__(self, *args, **kwargs)
Beispiel #9
0
 def __init__(self):
     GivenAuth.__init__(self, env_var="HTTP_X_FORWARDED_USER")
     self.log = log.getLogger(__name__)
Beispiel #10
0
 def test_decode_username(self):
     givenauth_obj = GivenAuth()
     result1 = givenauth_obj.decode_username('test_name')
     assert result1 == u'test_name'
     result2 = givenauth_obj.decode_username(123.45)
     assert result2 == 123.45
Beispiel #11
0
 class Config(wikiconfig.Config):
     auth = [GivenAuth(user_name=u'JoeDoe', autocreate=True)]
Beispiel #12
0
 def __init__(self, *args, **kwargs):
     logging.warning("DEPRECATED use of MoinMoin.auth.http.HTTPAuth, please read instructions there or docs/CHANGES!")
     GivenAuth.__init__(self, *args, **kwargs)
Beispiel #13
0
class FarmConfig(multiconfig.DefaultConfig):

    # Critical setup  ---------------------------------------------------

    # The URL prefix we use to access the static stuff (img, css, js).
    # Note: moin runs a static file server at url_prefix_static path (relative
    # to the script url).
    # If you run your wiki script at the root of your site (/), just do NOT
    # use this setting and it will automatically work.
    # If you run your wiki script at /mywiki, you need to use this:
    #url_prefix_static = '/mywiki' + url_prefix_static
    # If you need different url_prefix_static setups for your wikis,
    # you'll have to do it in each wiki's config.

    # Security ----------------------------------------------------------

    # This is checked by some rather critical and potentially harmful actions,
    # like despam or PackageInstaller action:
    #superuser = [u"YourName", ]

    # IMPORTANT: grant yourself admin rights! replace YourName with
    # your user name. See HelpOnAccessControlLists for more help.
    # All acl_rights_xxx options must use unicode [Unicode]
    #acl_rights_before = u"YourName:read,write,delete,revert,admin"

    # Link spam protection for public wikis (uncomment to enable).
    # Needs a reliable internet connection.
    #from MoinMoin.security.antispam import SecurityPolicy


    # Mail --------------------------------------------------------------

    # Configure to enable subscribing to pages (disabled by default) or
    # sending forgotten passwords.

    # The return address, e.g u"Wiki <*****@*****.**>" [Unicode]
    mail_from = u"Moin Wiki <*****@*****.**>"

    # SMTP server, e.g. "mail.provider.com" (empty or None to disable mail)
    #mail_smarthost = ""

    # "user pwd" if you need to use SMTP AUTH
    #mail_login = ""

    mail_sendmail = "/usr/sbin/sendmail -t -i"

    # preload user subscribed pages with this page list:
    #subscribed_pages_default = []

    # User interface ----------------------------------------------------

    # Add your wikis important pages at the end. It is not recommended to
    # remove the default links.  Leave room for user links - don't use
    # more than 6 short items.
    # You MUST use Unicode strings here, but you need not use localized
    # page names for system and help pages, those will be used automatically
    # according to the user selected language. [Unicode]
    navi_bar = [
        # If you want to show your page_front_page here:
        #u'%(page_front_page)s',
        u'RecentChanges',
        u'FindPage',
        u'HelpContents',
    ]

    # The default theme anonymous or new users get
    theme_default = 'modern'


    # Language options --------------------------------------------------

    # See http://moinmo.in/ConfigMarket for configuration in
    # YOUR language that other people contributed.

    # The main wiki language, set the direction of the wiki pages
    language_default = 'en'

    # the following regexes should match the complete name when used in free text
    # the group 'all' shall match all, while the group 'key' shall match the key only
    # e.g. CategoryFoo -> group 'all' ==  CategoryFoo, group 'key' == Foo
    # moin's code will add ^ / $ at beginning / end when needed
    # You must use Unicode strings here [Unicode]
    page_category_regex = ur'(?P<all>Category(?P<key>\S+))'
    page_dict_regex = ur'(?P<all>(?P<key>\S+)Dict)'
    page_group_regex = ur'(?P<all>(?P<key>\S+)Group)'
    page_template_regex = ur'(?P<all>(?P<key>\S+)Template)'

    # Content options ---------------------------------------------------

    # Show users hostnames in RecentChanges
    show_hosts = 1

    # Show the interwiki name (and link it to page_front_page) in the Theme,
    # nice for farm setups or when your logo does not show the wiki's name.
    show_interwiki = 1
    logo_string = u''

    # Enable graphical charts, requires gdchart.
    #chart_options = {'width': 600, 'height': 300}

    # See http://moinmo.in/HelpOnAuthentication
    auth = [GivenAuth(autocreate=True, env_var='REMOTE_USER', strip_maildomain=True, titlecase=True)]

    xapian_search = True
    xapian_index_history = True
    xapian_stemming = True