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

isAuthorized not working for WaiSubsite #1393

Closed
mchaver opened this issue May 11, 2017 · 8 comments
Closed

isAuthorized not working for WaiSubsite #1393

mchaver opened this issue May 11, 2017 · 8 comments

Comments

@mchaver
Copy link
Contributor

mchaver commented May 11, 2017

I'm trying to add a servant API behind Yesod that requires authentication as provided by the main Yesod app using this example project.

https://github.com/parsonsmatt/yo-dawg

/api ServantPersistentR WaiSubsite getServantPersistent
instance Yesod App where
    ....
    isAuthorized (AuthR _) _ = return Authorized
    isAuthorized (ServantPersistentR _) _ = return $ Unauthorized "unauthorized"
    isAuthorized _ _              = return AuthenticationRequired

However, using curl or a browser I can still access the servant routes.

@snoyberg
Copy link
Member

Please see #1286

@mchaver
Copy link
Contributor Author

mchaver commented May 11, 2017

@snoyberg
I did see that but I am not quite sure what I need to add to get it to work. An instance of YesodSubDispatch WaiSubsite (HandlerT master IO)?

Edit: hmm, I guess that musn't be it since that instance is defined in Yesod.Core.Class.Dispatch.

@snoyberg
Copy link
Member

snoyberg commented May 11, 2017 via email

@mchaver
Copy link
Contributor Author

mchaver commented May 11, 2017

that sounds like a reasonable solution

@mchaver
Copy link
Contributor Author

mchaver commented May 11, 2017

I figured it out. I'll make a PR

@snoyberg
Copy link
Member

snoyberg commented May 11, 2017 via email

@mchaver
Copy link
Contributor Author

mchaver commented May 11, 2017

#1394

@jezen
Copy link
Member

jezen commented Aug 23, 2019

This appears to be resolved by the merged PR, so I will close this issue.

@jezen jezen closed this as completed Aug 23, 2019
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

No branches or pull requests

3 participants