Skip to content
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

Option to configure leeway for claims validation #229

Closed
1zg12 opened this issue May 5, 2020 · 0 comments · Fixed by #228
Closed

Option to configure leeway for claims validation #229

1zg12 opened this issue May 5, 2020 · 0 comments · Fixed by #228

Comments

@1zg12
Copy link
Contributor

1zg12 commented May 5, 2020

Is your feature request related to a problem? Please describe.

At the moment, the existing validate method allows a passed in parameter to set the leeway.

For example:

def validate(self, now=None, leeway=0):

However, this has been hardcoded to 2 minutes in the invocation method.

For example:

claims.validate(leeway=120)

This will leave developers stuck at 2 minutes leeway, which could be very critical for some highly sensitive applications.

Describe the solution you'd like

A solution to give developers an option to pass in the leeway as designated.

For example, when we call the parse_id_token, in addition to the existing option

        try:
           # this has a default leeway of 2 minutes
            userinfo = oauth.keycloak.parse_id_token(token) 
        except Exception as e:
            log.error(f"Got a malformed response", e)

we can also set up

        try:
           # this has a configured leeway of 0 minutes
            userinfo = oauth.keycloak.parse_id_token(token, leeway=0) 
        except Exception as e:
            log.error(f"Got a malformed response", e)

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@1zg12 1zg12 changed the title Option to enable developers choose leeway for token and claims validation Option to configure leeway for token and claims validation May 5, 2020
@1zg12 1zg12 changed the title Option to configure leeway for token and claims validation Option to configure leeway for claims validation May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant