Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

albu-diku
Copy link

@albu-diku albu-diku commented Jun 23, 2024

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.

@albu-diku albu-diku marked this pull request as draft June 23, 2024 11:13
@jonasbardino jonasbardino added enhancement New feature or request unit test labels Jun 27, 2024
@jonasbardino jonasbardino self-assigned this Jun 27, 2024
@jonasbardino
Copy link
Contributor

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
Copy link
Author

albu-diku commented Jun 27, 2024

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
Copy link
Contributor

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 albu-diku force-pushed the refactor/autocreate-constants branch from 8fd39fc to 62169f8 Compare July 5, 2024 07:52
@albu-diku albu-diku marked this pull request as ready for review July 9, 2024 13:57
@albu-diku albu-diku requested a review from jonasbardino July 9, 2024 13:57
@albu-diku
Copy link
Author

@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 :)

@albu-diku albu-diku force-pushed the refactor/autocreate-constants branch 2 times, most recently from 29b9d6c to 30495dc Compare July 19, 2024 08:44
@albu-diku albu-diku mentioned this pull request Jul 30, 2024
The validation of openid auth parameters is achieved by the use of a
generic validation routine which is passed differing dictionaries based
on which authentication 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 that codepaths take action based on which
of the set is in use.

Make the auth mode an enumerated constant. Use the existing starting
values of the auth constants as the enum values which are themselves
defines as string subclasses such that they can be used interchangably
in cases where the originals were used to support gradual replacement.

Add the concept of named constants whose intent is to allow definition
of an an immutable key-value structure whose keys are a know set of
values. Use this to define and expose the default autocreate openid
validation dicts against their enum constant.
@albu-diku albu-diku force-pushed the refactor/autocreate-constants branch from 30495dc to 6452b7f Compare October 16, 2024 19:13
@albu-diku albu-diku removed the rebased label Nov 12, 2024
@albu-diku albu-diku closed this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants