63f0dbf Move openidc auth code into `login()` method

Authored and Committed by adamwill 6 years ago
    Move openidc auth code into `login()` method
    
    Once the auther is added, it seems to get used very quickly.
    Certainly just calling `self.site_init()` (which the parent
    `__init__` does at the end) causes authentication to happen.
    
    mwclient and wikitcms have never actually authenticated by
    default right at initialization, so we don't want it to start
    working that way now. To behave more similarly to how we've
    always behaved before, let's move the openidc logic into the
    `login()` method. Anything that uses wikitcms and wants to
    perform edits (or any other operation requiring auth) already
    must call `login()` explicitly - there's no magic which logs
    you in automatically when you call `save()`, or anything like
    that - so this should mirror existing behaviour quite closely.
    
    As a bonus, since it now happens after parent `__init__`, we
    can assume `self.version` is available and use the version to
    decide whether to use openidc or old-style auth, and this means
    I don't have to cut another release of wikitcms in a few days
    to switch to using openidc for the production wiki. This would
    break - probably crash - for a private wiki (wikis can be set
    up such that you have to be logged in to read *any* info from
    them), but in practice wikitcms is never really used with such
    wikis, so I'm not going to worry about it unless someone
    complains.
    
    Signed-off-by: Adam Williamson <awilliam@redhat.com>
    
        
file modified
+30 -34