AuthenticationInterrupt + Groovy + autoRedirect

43 views
Skip to first unread message

Sébastien B

unread,
Jan 30, 2019, 9:26:21 AM1/30/19
to CAS Community
Hi,

I want to try Authentication Interrupt with a groovy ressource.

It is working well following documentation : https://apereo.github.io/cas/5.3.x/installation/Webflow-Customization-Interrupt.html#authentication-interrupt (i am on 5.3.7) but i want to configure autoRedirect and i am not able to, it seems that InterruptResponse class will not allow needed variable.

Is there any way to implement autoRedirect with Groovy script ?

Have a nice day :-)

Dmitriy Kopylenko

unread,
Jan 30, 2019, 9:47:41 AM1/30/19
to cas-...@apereo.org
Hi,

can you post an example of your Groovy interrupt script - how you construct and return InterrupResponse object in particular.

Cheers,
D.
--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/568249db-303d-4f66-9a48-b41a641b71b4%40apereo.org.

Sebastien BEAUDLOT

unread,
Jan 30, 2019, 9:53:34 AM1/30/19
to cas-user
I am trying something as simple as the documentation example :

import org.apereo.cas.interrupt.InterruptResponse

def run(final Object... args) {
    def uid = args[0]
    def attributes = args[1]
    def service = args[2]
    def logger = args[3]

    def message = "Test message"
    def block = true
    def ssoEnabled = true
    def redirectTo = ["Redirection" : "google.com"]

    return new InterruptResponse(message, redirectTo, block, ssoEnabled)
}

But how can i add a value for autoRedirect, as it seems this variable is not allowed to be passed as an argument ?


--
Sébastien BEAUDLOT

Administrateur système, réseaux et téléphonie

Direction Opérationnelle des Systèmes d'Information ( DOSI )
Pôle Infrastructures
Université d'Avignon et des Pays de Vaucluse

Tèl : 04.90.16.26.04
--


De: "Dmitriy Kopylenko" <dkopy...@unicon.net>
À: "cas-user" <cas-...@apereo.org>
Envoyé: Mercredi 30 Janvier 2019 15:47:37
Objet: Re: [cas-user] AuthenticationInterrupt + Groovy + autoRedirect

Dmitriy Kopylenko

unread,
Jan 30, 2019, 10:13:07 AM1/30/19
to cas-...@apereo.org
Hi.

there are getters setters methods (generated by Lombok) for each field in there. Then, it’s Groovy, so you could use a “map constructor”, e.g.

return new InterruptResponse(message: message, redirectTo: redirectTo, block: block, ssoEnabled: ssoEnabled, autoRedirect: true, autoRedirectAfterSeconds: 1)

or any combination of these properties. Please note that a positive value for autoRedirectAfterSeconds property is essential.

HTH,
D.

Sebastien BEAUDLOT

unread,
Jan 30, 2019, 10:49:18 AM1/30/19
to cas-user
Hi Dmitriy,

Thank you, i am new to Groovy and was not aware of "map constructor". It is working now !

Regards.

--
Sébastien BEAUDLOT

Administrateur système, réseaux et téléphonie

Direction Opérationnelle des Systèmes d'Information ( DOSI )
Pôle Infrastructures
Université d'Avignon et des Pays de Vaucluse

Tèl : 04.90.16.26.04
--


De: "Dmitriy Kopylenko" <dkopy...@unicon.net>
À: "cas-user" <cas-...@apereo.org>
Envoyé: Mercredi 30 Janvier 2019 16:13:02

Dmitriy Kopylenko

unread,
Jan 30, 2019, 11:30:58 AM1/30/19
to cas-...@apereo.org, Sebastien BEAUDLOT
Reply all
Reply to author
Forward
0 new messages