Skip to content

Commit b69aa29

Browse files
committed
[FIX] Solucionar error TOO_MANY_REDIRECTS SSO in portlet
1 parent 7269f70 commit b69aa29

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/genweb6/core/portlets/login/login.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ class gwLogin(LoginRenderer, LoginUtils):
1414

1515
def cas_login_URL(self):
1616
login_url = login_URL(self.context, self.request)
17+
18+
# Si tiene el ticket en la url, quiere decir que es un usuario válido pero no tiene permisos.
19+
# Por tanto, redirigimos a la página de error para evitar el bucle infinito del SSO
20+
# En el log vemos Unauthorized(m) - zExceptions.unauthorized.Unauthorized: You are not authorized to access this resource.
21+
if 'ticket' in getattr(self.request, 'came_from', ''):
22+
return self.request.response.redirect(
23+
self.context.absolute_url() + '/insufficient-privileges')
24+
1725
url = self.context.absolute_url()
1826
if any(x in url for x in ['localhost', 'fepre.upc.edu', '.pre.upc.edu']):
1927
return False

0 commit comments

Comments
 (0)