Skip to content

Refactor wai-middleware-auth to be more convenient #10

@silky

Description

@silky

wai-middleware-auth is specialised to Wai.Response in how it throws errors and attempts redirects.

Moreover, it's quite hard to get out the loginUrl (unless you go via the handleLogin path, which is a bit overkill, as it needs an entire route dedicated to it, kind of.)

The task here is to do a significant refactor of the wai library so that it, perhaps, supports both Servant (Handler's) and raw Wai Responses. This would at least let it continued to be used by raw wai applications (i.e. yesod or otherwise) and servant ones.

Alternatively, we could just completely fork it and just change it to be suitable for servant. While this is less work, I'm more reluctant to do it, because it needlessly partitions the codebase; so that if there are bugfixes in one they won't get adopted in the other.

The main goal would be to eliminate the kind of hacky transformations you see here: https://github.com/tweag/servant-oauth2/blob/main/src/Servant/OAuth2.hs#L122 and here https://github.com/tweag/servant-oauth2/blob/main/src/Servant/OAuth2/Hacks.hs#L49

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions