Modifying the logout flow in 5.3.0

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Modifying the logout flow in 5.3.0

Fredrik Jönsson-2
Hi, we have in our environment using CAS 4.x, for reasons, modified our flow to add a cookie to the response on login and remove it again on logout.

I'm trying to reimplement this using CAS 5.3.0, and I can modify the login flow as mentioned in documentation, but I seem unable to get the logout flow and modify it in any similar manner.

I have to beans:

    @ConditionalOnMissingBean(name = "ssoCookieLoginWebflowConfigurer")

    @Bean

    public CasWebflowConfigurer ssoCookieLoginWebflowConfigurer() {

        final SSOCookieLoginWebflowConfigurer w = new SSOCookieLoginWebflowConfigurer(flowBuilderServices,

                    loginFlowDefinitionRegistry, applicationContext, casProperties,

                    sendSSOCookieAction, removeSSOCookieAction);

        w.initialize();

        return w;

    }


    @ConditionalOnMissingBean(name = "ssoCookieLogoutWebflowConfigurer")

    @Bean

    public CasWebflowConfigurer ssoCookieLogoutWebflowConfigurer() {

        final SSOCookieLogoutWebflowConfigurer w = new SSOCookieLogoutWebflowConfigurer(flowBuilderServices,

                    loginFlowDefinitionRegistry, applicationContext, casProperties,

                    removeSSOCookieAction);

        w.initialize();

        return w;

    }


First one works fine, second one,


public class SSOCookieLogoutWebflowConfigurer extends AbstractCasWebflowConfigurer {

    final Action removeSSOCookieAction;


    public SSOCookieLogoutWebflowConfigurer(FlowBuilderServices flowBuilderServices,

                                       FlowDefinitionRegistry flowDefinitionRegistry,

                                       ApplicationContext applicationContext,

                                       CasConfigurationProperties casProperties,

                                       RemoveSSOCookieAction removeSSOCookieAction) {

        super(flowBuilderServices, flowDefinitionRegistry, applicationContext, casProperties);

        this.removeSSOCookieAction = removeSSOCookieAction;

    }


    @Override

    protected void doInitialize() {

        final Flow flow = super.getLogoutFlow();

        State sendTgt = flow.getStateInstance(CasWebflowConstants.STATE_ID_DO_LOGOUT);

        sendTgt.getEntryActionList().add(removeSSOCookieAction);

    }

}


Does not, but gives:


2018-01-30 08:42:21,368 ERROR [org.apereo.cas.web.flow.configurer.AbstractCasWebflowConfigurer] - <Logout flow registry is not configured correctly.>

2018-01-30 08:42:21,368 ERROR [org.apereo.cas.web.flow.configurer.AbstractCasWebflowConfigurer] - <null>

java.lang.NullPointerException: null

at se.kth.infosys.login.SSOCookieLogoutWebflowConfigurer.doInitialize(SSOCookieLogoutWebflowConfigurer.java:28) ~[classes!/:?]

at org.apereo.cas.web.flow.configurer.AbstractCasWebflowConfigurer.initialize(AbstractCasWebflowConfigurer.java:126) ~[cas-server-core-webflow-api-5.3.0-RC2-SNAPSHOT.jar!/:5.3.0-RC2-SNAPSHOT]

at se.kth.infosys.login.SSOCookieWebflowConfiguration.ssoCookieLogoutWebflowConfigurer(SSOCookieWebflowConfiguration.java:54) ~[classes!/:?]

at se.kth.infosys.login.SSOCookieWebflowConfiguration$$EnhancerBySpringCGLIB$$79cab2e9.CGLIB$ssoCookieLogoutWebflowConfigurer$1(<generated>) ~[classes!/:?]


I've been looking at this for a while, and I'm currently unable to understand if and how this is supposed to work. The logout flow seem to be initialized rather differently than the login flow. I don't understand how the logoutFlowDefinitionRegistry is set in AbstractCasWebflowConfigurer, or if it is at all?


Regards,

/Fredrik

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/cas-dev/.
Reply | Threaded
Open this post in threaded view
|

Re: Modifying the logout flow in 5.3.0

Fredrik Jönsson-2
Tried to add a constructor to AbstractCasWebflowConfigurer in order to allow me to set the logoutFlowDefinitionRegistry in similar manner as loginFlowDefinitionRegistry is set, but now I can't build the server anymore due to some gradle crap:

> Could not find method buildScan() for arguments [build_6d8lwis77nl8oupapr7z6mdqq$_run_closure3@4991c91a] on root project 'cas-server' of type org.gradle.api.Project.


Don't know if it is me trying to do this on Mac OS X, or something else. I could build it a couple of days ago.

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/cas-dev/.
Reply | Threaded
Open this post in threaded view
|

Re: Modifying the logout flow in 5.3.0

Fredrik Jönsson-2
Seems I may be able to build again after reverting commit e644771d0e82c1d86c9f476515dbce3a47f4d83c

On Tuesday, 30 January 2018 09:59:50 UTC+1, Fredrik Jönsson wrote:
Tried to add a constructor to AbstractCasWebflowConfigurer in order to allow me to set the logoutFlowDefinitionRegistry in similar manner as loginFlowDefinitionRegistry is set, but now I can't build the server anymore due to some gradle crap:

> Could not find method buildScan() for arguments [build_6d8lwis77nl8oupapr7z6mdqq$_run_closure3@4991c91a] on root project 'cas-server' of type org.gradle.api.Project.


Don't know if it is me trying to do this on Mac OS X, or something else. I could build it a couple of days ago.

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/cas-dev/.
Reply | Threaded
Open this post in threaded view
|

Re: Modifying the logout flow in 5.3.0

Fredrik Jönsson-2
In reply to this post by Fredrik Jönsson-2
Anyway, adding a constructor to AbstractCasWebflowConfigurer which allows me to set the logoutFlowDefinitionRegistry in this way works.

I'll be adding a pull request to this effect, can take the discussion there.

On Tuesday, 30 January 2018 09:59:50 UTC+1, Fredrik Jönsson wrote:
Tried to add a constructor to AbstractCasWebflowConfigurer in order to allow me to set the logoutFlowDefinitionRegistry in similar manner as loginFlowDefinitionRegistry is set, but now I can't build the server anymore due to some gradle crap:

> Could not find method buildScan() for arguments [build_6d8lwis77nl8oupapr7z6mdqq$_run_closure3@4991c91a] on root project 'cas-server' of type org.gradle.api.Project.


Don't know if it is me trying to do this on Mac OS X, or something else. I could build it a couple of days ago.

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/cas-dev/.
Reply | Threaded
Open this post in threaded view
|

Re: Modifying the logout flow in 5.3.0

Fredrik Jönsson-2
In reply to this post by Fredrik Jönsson-2
Related pull request: https://github.com/apereo/cas/pull/3171

/Fredrik

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/cas-dev/.