puiterwijk/flask-oidc

Why custom callback is bound with custom state?

kkzxak47 opened this issue · 0 comments

Is there a way to enable custom callback and still use auto generated state?
Currently I'm using a self modified version of flask-oidc, added a parameter to custom_callback decorator, so I can control whether to use custom or auto state:

    def custom_callback(self, statefield='custom'):
        def _custom_callback(view_func):
            """
            Wrapper function to use a custom callback.
            The custom OIDC callback will get the custom state field passed in with
            redirect_to_auth_server.
            """
            @wraps(view_func)
            def decorated(*args, **kwargs):
                plainreturn, data = self._process_callback(statefield)
                if plainreturn:
                    return data
                else:
                    return view_func(data, *args, **kwargs)
            self._custom_callback = decorated
            return decorated
        return _custom_callback

But I was wondering what's the rationale of current implementation?