No authentication result builder can be located in the context -> upgrade problem from 4.2.7 to 5.1.3

86 views
Skip to first unread message

Priit Serk

unread,
Sep 7, 2017, 6:03:23 PM9/7/17
to CAS Community
Hi

I need to upgrade working solution from cas 4.2.7 to latest. 4.2.7 solution is working perfectly but the latest 5.1.3 is a bit different and I cant get it to work - desperate already :(

Exception:
2017-09-08 00:56:18,748 WARN [org.apereo.cas.web.flow.resolver.impl.InitialAuthenticationAttemptWebflowEventResolver] - <No authentication result builder can be located in the context>
java.lang.IllegalArgumentException: No authentication result builder can be located in the context


Custom web-flow:

<var name="loginModel" class="ee.LoginModel"/>

<view-state id="viewLoginForm" view="casLoginView" model="loginModel">
<binder>
<binding property="username"/>
<binding property="password"/>
<binding property="mobileNumber"/>
<binding property="personalCode"/>
</binder>
<on-entry>
<set name="viewScope.commandName" value="'loginModel'"/>
</on-entry>
<transition on="startMIDLogin" to="mIDLoginStart" bind="true" validate="false"/>
</view-state>
<action-state id="mIDLoginStart">
<evaluate expression="mobileIDLoginAction.submit(flowRequestContext, flowScope.loginModel.getMobileNumber())"/>
<transition on="success" to="viewMobileIDLoginCode"/>
<transition on="error" to="viewLoginError"/>
</action-state>

<view-state id="viewMobileIDLoginCode" view="casMIDLoginCode">
<transition on="check" to="checkMIDStatus"/>
</view-state>

<action-state id="checkMIDStatus">
<evaluate expression="mobileIDLoginAction.check(flowRequestContext)"/>
<transition on="success" to="credentialsSuccess"/>
<transition on="outstanding" to="viewMobileIDLoginCode"/>
<transition on="error" to="viewLoginError"/>
</action-state>

<action-state id="credentialsSuccess">
<!-- This is how it's defined in cas 4.2.7 - unfortunately this does not work anymore in 5.1.3
<evaluate expression="authenticationViaFormAction.submit(flowRequestContext, flowScope.IDCredential, messageContext)"/>
-->
<evaluate expression="authenticationViaFormAction"/> <!-- THIS RAISES THE ERROR -->

<transition on="warn" to="warn"/>

<transition on="success" to="sendTicketGrantingTicket"/>
<transition on="authenticationFailure" to="handleAuthenticationFailure"/>
<transition on="error" to="initializeLoginForm"/>
</action-state>
As you can see from the comment, the line:
   <evaluate expression="authenticationViaFormAction"/> raises the exception. 

I'm pasting also other code:

@Component("mobileIDLoginAction")
public class MobileIDLoginAction {

@PostConstruct
public void init() {
.... }

public Event check(RequestContext context) {
MobileIDSession session = (MobileIDSession) context.getFlowScope().get(MOBILE_SESSION);
int checkCount = (int) context.getFlowScope().get(AUTH_COUNT);
...
}


public Event submit(RequestContext context, String mobileNumber) {
try {
MobileIDSession mIDSession = mIDAuthenticator.startLogin(mobileNumber);
....
}

public class IDCredential extends AbstractCredential {

private String firstName;
private String lastName;
private String identityCode;
private String phoneNumber;
....
}

public class LoginModel implements Serializable {

private String mobileNumber;
private String personalCode;
private String country;
private String username;
private String password;
...
}


Exception:
2017-09-08 00:56:18,748 WARN [org.apereo.cas.web.flow.resolver.impl.InitialAuthenticationAttemptWebflowEventResolver] - <No authentication result builder can be located in the context>
java.lang.IllegalArgumentException: No authentication result builder can be located in the context

Everything works inside MobileIDLoginAction and I just to accept authentication and that's it. 

Please help, I'm really in trouble and no idea how to continue at this point.
Reply all
Reply to author
Forward
0 new messages