0

I have used jasig (3.5.1) cas sever and successfully configured.It works fine. my project have another requirement. I mentioned it below i need another login mechanism. it mean rather than using stand username password, i need corporate code,mobile number and password authentication for corporate users. so i have created another Credential class for that

public class CodeMobileNumberCredintials implements Credentials{
@NotNull
    @Size(min=1,message = "required.code")
    private String code;

    @NotNull
    @Size(min=1, message = "required.mobileNumber")
    private String mobileNumber;

    @NotNull
    @Size(min=1, message = "required.password")
    private String password;
...
}

Then i created a variable called "codeMobileNumberCredintials"in web-flow.

    <var name="credentials" class="org.jasig.cas.authentication.principal.UsernamePasswordCredentials" />
        <var name="codeMobileNumberCredintials" class="org.jasig.cas.authentication.principal.CodeMobileNumberCredintials"/>

     <view-state id="viewCorporateLoginForm" view="casCorporateLoginView" model="codeMobileNumberCredintials">
            <binder>
                <binding property="code" />
                <binding property="mobileNumber" />
                <binding property="password" />
            </binder>
            <on-entry>
                <set name="viewScope.commandName" value="'codeMobileNumberCredintials'" />
            </on-entry>
            <transition on="submit" bind="true" validate="true" to="realCorporateSubmit">
                <evaluate expression="authenticationViaFormAction.doCorporateBind(flowRequestContext, flowScope.codeMobileNumberCredintials)" />
            </transition>
        </view-state>

The issue is bean validation process not working for my custom login form.But normal username password form validated(when submiting form without givin username and password , It says "username and password blank"). But my custom autentication form not validated.It directly goes to controller class.
I have spent lot of time to do this. Can anyone help me to do my task.

Thank you
Amila
Amila
  • 243
  • 1
  • 10
  • 24

2 Answers2

1

I had a similar problem. The easiest way to solve it, is to add new validator bean in cas-servlet.xml Spring configuration file in cas-server-webapp module. In your case it will be:

      <bean id="codeMobileNumberCredintialsValidator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"
    p:messageInterpolator-ref="messageInterpolator" />
Adam
  • 11
  • 1
0

There was an issue with spring web flow, resulting an error during validation. It occurs with stack trace as below and error page displayed, instead redisplaying login form:

2013-10-04 09:48:31,683 TRACE [org.jasig.cas.web.init.SafeDispatcherServlet] - <Entering method [service with arguments [[org.apache.catalina.connector.RequestFacade@411c345a, org.apache.catalina.connector.ResponseFacade@22b1221b]]>
2013-10-04 09:48:31,686 DEBUG [org.jasig.cas.web.FlowExecutionExceptionResolver] - <Ignoring the received exception due to a type mismatch> org.springframework.webflow.execution.repository.BadlyFormattedFlowExecutionKeyException: Badly formatted flow execution key '[Ljava.lang.String;@58714e00', the expected format is 'e<executionId>s<snapshotId>'

The fix is described here CAS-1142. It help me, and it summarize with adding one line <webflow:redirect-in-same-state value="false" /> to cas-servlet.xml resulting as below:

    <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
    <webflow:flow-execution-attributes>
        <webflow:always-redirect-on-pause value="false"/>
        <webflow:redirect-in-same-state value="false" />
    </webflow:flow-execution-attributes>
    <webflow:flow-execution-listeners>
        <webflow:listener ref="terminateWebSessionListener" />
    </webflow:flow-execution-listeners>
</webflow:flow-executor>
Augustin Ghauratto
  • 1,420
  • 1
  • 19
  • 21