ucphhpc / migrid-sync

MiGrid workspace where master branch is kept strictly in sync with SF upstream svn repo. Any development or experiments should use a branch. You probably want to fork your own clone or work e.g. on the edge branch if you wish to contribute.
GNU General Public License v2.0
3 stars 4 forks source link

Create structured constants for validation dicts used for openid auth. #71

Open albu-diku opened 3 months ago

albu-diku commented 3 months ago

The validation of openid auth parameters is achieved by the use of a generic validation routine which is passed differing 'definition' dictionaries based on which open id auth mode is in use.

Previously these dictionaries were buried cases within what amounted to a switch over the auth mode. In addition we note the auth mode is an enumerated set of values and a large number of codepaths take action based on which of the set is activated.

Make the auth mode an enumerated constant. In order to support add an AsciiEnum type which is based on the official documentation suggested implementation for an enumeration whose values behave as strings within comparisons. We use the officially backported enum34 package to add enum to Python 2 and base the new type on

Use the existing constants as the values of the new auth constants such that they can be used interchangeably in cases where the originals were used to support gradual replacement. Use the cases of this enumeration as keys into a dictionary which maps them to the relevant validation definition dictionary.

jonasbardino commented 3 months ago

I suppose this one still needs further care regarding the failed py2 CI job. Please just request a review or ping me when I should have a look at merging @albu-diku .

albu-diku commented 3 months ago

I suppose this one still needs further care regarding the failed py2 CI job. Please just request a review or ping me when I should have a look at merging @albu-diku .

Yah, that's right - this was marked as a draft PR while that stuff is sorted out, mentioning as it's a convention I will be following going forward to hopefully keep review candidates somewhat obvious 'at a glance".

jonasbardino commented 3 months ago

Alright, yes I did read your notes about sharing early and generally think that it's a good idea, but perhaps I missed the draft tag here. All good.

albu-diku commented 2 months ago

@jonasbardino if you do look at this before I push again, ignore what's in envhelp/python3 - those bits are unrelated and probably want their own lttle PR as and when :)