Create structured constants for validation dicts used for openid auth. #71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 backportedenum34
package to add enum to Python 2 and base the new type onUse 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.