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

Implicit dependencies on other middelware #12

Open
ingesolvoll opened this issue Nov 30, 2017 · 5 comments
Open

Implicit dependencies on other middelware #12

ingesolvoll opened this issue Nov 30, 2017 · 5 comments

Comments

@ingesolvoll
Copy link

This middleware assumes that the developer already applied wrap-session, wrap-cookie, wrap-params and possibly more. I struggled a bit today before remembering that. I guess this would be a blocker for less experienced ring users.

Would it be a good idea to insert a paragraph about those implicit dependencies in README.md? There already exists a reference to wrap-defaults, but that one is rather specific about a single problem.

@weavejester
Copy link
Owner

It requires wrap-session and wrap-params. A note in the README would be very useful, as I seem to have forgotten to do that!

@ingesolvoll
Copy link
Author

I can make a pull request if you want help

@Kah0ona
Copy link
Contributor

Kah0ona commented Feb 1, 2019

This has been added recenlty to the docs. Is this clear enough now? It mentions wrap-params, but not yet wrap-session.

@jcpsantiago
Copy link

jcpsantiago commented Oct 13, 2021

I don't see any changes in the README, it only mentions wrap-defaults but not explicit ordering. I may be having this issue, or maybe not.

          (http/run-server
            (-> (routes lagosta-routes)
                (wrap-oauth2 okta-attrs)
                (wrap-defaults (-> site-defaults (assoc-in [:session :cookie-attrs :same-site] :lax)))
                wrap-params)
            {:port 3434})))

does this look correct? I'm trying to use Okta and going to my :launch-uri does nothing i.e. I'm not redirected to Okta's authorize-uri

SOLVED: it wasn't related, but maybe a bug? my :launch-uri was defined as an absolute url http://localhost:3434/login which didn't work, but /login does. README says

It can be any relative URI as long as it is unique. It can also be an absolute URI like

@weavejester
Copy link
Owner

          (http/run-server
            (-> (routes lagosta-routes)
                (wrap-oauth2 okta-attrs)
                (wrap-defaults (-> site-defaults (assoc-in [:session :cookie-attrs :same-site] :lax)))
                wrap-params)
            {:port 3434})))

does this look correct?

Yes, except that wrap-params is also added by wrap-defaults, so you can omit it.

README says

It can be any relative URI as long as it is unique. It can also be an absolute URI like

That's the documentation for the redirect URI:

The redirect URI provides the internal callback. It can be any relative URI as long as it is unique. It can also be an absolute URI like

It's probably a good idea to mention that the launch-uri must be a relative URI, since it adds a route associated with that URI.

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

4 participants