# SSO keeps redirecting suspended users

**URL:** https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452
**Category:** Bug
**Created:** [10월 20, 2017, 8:45오전 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452 "2017-10-20T08:45:26Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sebastien](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@sebastien](https://meta.discourse.org/u/sebastien)
#### Post date: [10월 20, 2017, 8:45오전 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452/1 "2017-10-20T08:45:26Z")

</div>

Hi,

Once a user suspended, the ideal scenario would be to redirect him to a page like “Your account is currently suspended until …”.

Currently, suspended users cause an infinite loop:

- Discourse redirects the user to the login page (normal).
- Then the Login page redirects the user to Discourse and normally he should see an error or our community main page..
- However if the user is suspended, then Discourse will redirect again the user to the login page.
- As the user is already logged in, he will be redirected to discourse

And so on… In the end, it goes back and forward from the login server to discourse until the browser decides to raise an exception (Too many redirections…).

Is there a way to work around this issue?

Thank you,  
Seb

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10월 23, 2017, 12:45오전 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452/2 "2017-10-23T00:45:16Z")

</div>

My guess is that this only happens if your site requires login.

It does sound like a legit bug, workarounds are a bit hard, but perhaps listen on a web hook for suspend and then don’t send them back into Discourse if they are suspended.

---

<div class="post-metadata">

### Author: ![sebastien](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@sebastien](https://meta.discourse.org/u/sebastien)
#### Post date: [10월 24, 2017, 10:06오전 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452/3 "2017-10-24T10:06:07Z")

</div>

Thank you for your answer. Any chance of getting a fix?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [10월 25, 2017, 8:52오후 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452/5 "2017-10-25T20:52:52Z")

</div>

It’s fairly easy to fix on the SSO provider end, but if it’s not fixed there the forum will appear to be broken.

For fixing it on Discourse, it’s possible to check if the user is suspended and login is required in the `sso_login` method. If true, redirect them back to the SSO provider, either to an `sso_suspended_url` that’s added as a site setting, or to the `sso_url` with some query parameters that the SSO provider can make use of.

---

<div class="post-metadata">

### Author: ![sebastien](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@sebastien](https://meta.discourse.org/u/sebastien)
#### Post date: [10월 30, 2017, 9:52오전 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452/6 "2017-10-30T09:52:22Z")

</div>

Do you think it would be possible to get this fixed?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11월 14, 2017, 5:52오전 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452/7 "2017-11-14T05:52:56Z")

</div>

This should do it:

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/3/e319db387a0298926f1477110613955e5c4d7620.png)

[https://github.com/discourse/discourse/commit/4b42a0abc9f0fc106db7c928caca593c6052266f](https://github.com/discourse/discourse/commit/4b42a0abc9f0fc106db7c928caca593c6052266f)

---

<div class="post-metadata">

### Author: ![sebastien](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@sebastien](https://meta.discourse.org/u/sebastien)
#### Post date: [11월 14, 2017, 6:14오전 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452/8 "2017-11-14T06:14:34Z")

</div>

Thx Sam! It would be perfect!

Regards,  
Seb

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11월 15, 2017, 7:00오전 UTC](https://meta.discourse.org/t/sso-keeps-redirecting-suspended-users/72452/9 "2017-11-15T07:00:07Z")

</div>

This topic was automatically closed after 25 hours. New replies are no longer allowed.
