Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Problem with error redirections (auth.interceptor.client.service.js) #1068

Closed
0xNacho opened this issue Nov 23, 2015 · 12 comments
Closed

Problem with error redirections (auth.interceptor.client.service.js) #1068

0xNacho opened this issue Nov 23, 2015 · 12 comments
Assignees
Milestone

Comments

@0xNacho
Copy link

0xNacho commented Nov 23, 2015

For some reason, when you get an app error you are unable to get back to the previous page (because of interceptor catch the previous error and redirects again to the error page).

@0xNacho 0xNacho changed the title Problem with errors (auth.interceptor.client.service.js) Problem with error redirections (auth.interceptor.client.service.js) Nov 23, 2015
@mleanos
Copy link
Member

mleanos commented Nov 24, 2015

@0xNacho Can you provide a step by step on how to reproduce this issue?

Also, what type of app error are you referring to?

@wansco
Copy link
Contributor

wansco commented Dec 3, 2015

I just created an issue (#1086) that is loosely related to this. I think the problem is that auth.interceptor caught some sort of a login issue on the previous page, so going back only re-triggers that 401/403 error which then dumps you back through the rejection to either the signin page, or forbidden.

The signin page makes sense (I haven't checked the latest versions, as I know there was some code added to redirect to the previous page added recently)

The /forbidden page is causing a lot of confusion, because that is either "legitimately forbidden, but still logged in" or "forbidden because you were logged out on the server, but the client-side still thinks you're logged in"

see issue #1086 for steps to get you into the latter condition on the /forbidden page.

@trainerbill
Copy link
Contributor

@wansco Can you pull in the JWT PR and see if it fixes this?

@wansco
Copy link
Contributor

wansco commented Feb 4, 2016

I think this might still be an issue, although the forbidden part is gone. Basically it doesn't appear to be respecting the server policy. Steps to reproduce:

  • Clean install
  • Modify modules/articles/server/policies/articles.server.policy.js line 34 (change the role 'guest' to something else i.e. 'xguestx'. This should eliminate views from non-users or non-admins)
  • Go to the List Articles page (when you are NOT logged in)

Before, this would send you to /forbidden and the back button would loop you back to the /forbidden page.

Now it appears that the page is served up without an issue... but the modified roles defined in the server policy should prevent non-logged in user

I haven’t thoroughly investigated this, but I did just test the before and after behaviour described above.

@mleanos
Copy link
Member

mleanos commented Feb 4, 2016

I'm seeing the correct behavior on the latest master branch; also, checked on the JWT PR branch & @wansco's steps reproduces the described behavior.

@trainerbill What changes in the JWT PR would be causing this?

@trainerbill
Copy link
Contributor

I really don't get it... why would you want to change the guest ACL there? Just remove the get from the / route, or require the user role for it. Why does this happen in JWT, because the isAllowed is gone as they are public routes... I guess I can add it back, I just figured if they are public routes why even go through the ACL check... but now I see your point as someone may want to limit it.

@wansco
Copy link
Contributor

wansco commented Feb 4, 2016

Sorry, that was just a test for an unauthorized route. You wouldn't do that in practice, but that was the easiest way I came up with to simplify the "steps to repeat." Also, I wanted to test the user roles, rather than the route.

Good work on the JWT by the way.

@mleanos
Copy link
Member

mleanos commented Feb 4, 2016

@trainerbill It's only public (server-side) because the ACL allow's it on the adhoc "guest" role. The steps demonstrate that the ACL policy isn't being applied correctly in that case.

@trainerbill
Copy link
Contributor

@mleanos fixed it already

@mleanos
Copy link
Member

mleanos commented Feb 9, 2016

@0xNacho Can you verify that this issue has been resolved in the latest master?

@lirantal lirantal self-assigned this Feb 13, 2016
@lirantal lirantal added this to the 0.5.0 milestone Feb 13, 2016
@lirantal
Copy link
Member

I can't reproduce this either by manual steps in the client-side, I just get redirected to the login page.

@lirantal
Copy link
Member

Closing this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants