Cas 5 : How can I modify default flow

305 views
Skip to first unread message

Gokhan Mansuroglu

unread,
Dec 22, 2016, 2:41:07 AM12/22/16
to CAS Community
Hello,

In the following default flow I need to change the viewGenericLoginSuccess transition. As far as I can see, I can only add new transtions and modifying an existing one is not possible. Is there any solution ?

Thank you.

2016-12-22 09:36:03,065 DEBUG [DecisionState] - <Entering state 'serviceCheck' of flow 'login'>
2016-12-22 09:36:03,065 DEBUG [Transition] - <Executing [Transition@a6925f on = *, to = viewGenericLoginSuccess]>
2016-12-22 09:36:03,065 DEBUG [Transition] - <Exiting state 'serviceCheck'>
2016-12-22 09:36:03,065 DEBUG [EndState] - <Entering state 'viewGenericLoginSuccess' of flow 'login'>



Ray Bon

unread,
Dec 22, 2016, 11:26:20 AM12/22/16
to cas-...@apereo.org
Gokhan,

You can, of course, modify the classes for viewGenericLoginSuccess or create your own phase and modify the webflow.xml to point to your classes.
@see https://apereo.github.io/cas/4.1.x/installation/Webflow-Customization.html
and https://apereo.github.io/cas/5.0.x/installation/Webflow-Customization.html

Ray
--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
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/a2f15f9c-3ebe-492d-987e-c9f903ba6103%40apereo.org.

-- 
Ray Bon
Programmer Analyst
Development Services, University Systems
2507218831 | CLE C023 | rb...@uvic.ca

Gokhan Mansuroglu

unread,
Dec 23, 2016, 1:47:36 AM12/23/16
to CAS Community, rb...@uvic.ca
Hi Ray,

Modifying the weblow.xml does not work since the flow is configured by the DefaultWebflowConfigurer. Even the viewGenericLoginSuccess state doesn't appear in the xml, it is added programmatically.

Actually I could modify the transitions as below :

        private void modifyTransitionDefinition(Flow flow, String stateId, String eventId, String targetStateId) {
       
TransitionableState state = (TransitionableState) flow.getState(stateId);
       
if (state != null) ((Transition) state.getTransition(eventId)).setTargetStateResolver(new DefaultTargetStateResolver(targetStateId));
       
}


But this is really complicated because you can't see the complete flow in the login-flow.xml. I think this is an important issue. I am trying to upgrade my cas version from 3.3.3 to 5.0.0 and in the 3.3.3 I can see the overall flow in one xml file, now It seems to be impossible.

I don't know if I am doing something wrong but doesn't anyone have the same requirement ?


22 Aralık 2016 Perşembe 19:26:20 UTC+3 tarihinde Ray Bon yazdı:

Yauheni Sidarenka

unread,
Dec 23, 2016, 4:33:09 AM12/23/16
to CAS Community, rb...@uvic.ca
Hello,

Please read this https://apereo.github.io/2016/10/07/webflow-extcfg/ if you have not read yet. I believe it may help you.



As far as I can see, I can only add new transtions and modifying an existing one is not possible.

I am using CAS 5.0.0 and I have this in my web flow configurer:

final Flow flow = super.getLoginFlow();
final TransitionSet ts = flow.getTransitionableState("handleAuthenticationFailure").getTransitionSet();
final Iterator<Transition> it = ts.iterator();
while (it.hasNext()) {
   
if ("AccountLockedException".equals(it.next().getMatchingCriteria().toString())) {
        it
.remove();
   
}
}
final Transition t = createTransition("AccountLockedException", "initializeLoginForm");
ts
.add(t);

So I removed old default transition and added my custom one.

Regards,
Yauheni

Gokhan Mansuroglu

unread,
Dec 23, 2016, 5:48:44 AM12/23/16
to CAS Community, rb...@uvic.ca
Though expected to see more information, I am very surprised to see Turkey's Tombili in this blog :)

Thank you.

23 Aralık 2016 Cuma 12:33:09 UTC+3 tarihinde Yauheni Sidarenka yazdı:

Yauheni Sidarenka

unread,
Dec 23, 2016, 6:55:48 AM12/23/16
to CAS Community, rb...@uvic.ca
You are welcome! And one more thing. While writing your SomethingConfiguration class with @Configuration annotation please note that your class should be in package org.apereo.cas or its subpackages (according to this: https://groups.google.com/a/apereo.org/forum/#!topic/cas-user/WKzqlZrmvS8 )

Regards,
Yauheni

dkopy...@unicon.net

unread,
Dec 23, 2016, 7:30:30 AM12/23/16
to CAS Community, rb...@uvic.ca
Just FYI, the 'org.apereo.cas.*' package scanning for configuration classes won't be a requirement any more starting from 5.1 as the mechanism has been refactored to use Boot's META-INF/spring.factories discovery facility.

Happy Holidays,
D.
Reply all
Reply to author
Forward
0 new messages