How to validate credential object in jasig cas app

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to validate credential object in jasig cas app

amila
Hi,
 I have used jasig and almost integrate to my apps. I faced some model validation issue. Below i mentioned what i need

i created another login process for cas login. It mean rather than normal username password authentication. It has corporate code,mobile number and password authentication for corporate user login. So i created separate class for that

public class CodeMobileNumberCredintials implements Credentials{

        /** Unique ID for serialization. */
    private static final long serialVersionUID = -8343864967200862798L;

    /** The username. */
    @NotNull
    @Size(min=1,message = "required.code")
    private String code;

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

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

and i have code other necessary classes and methods. I mentioned what are critical parts.

This is my web flow:

<var name="codeMobileCredintials" class="org.jasig.cas.authentication.principal.CodeMobileNumberCredintials"/>

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

in  cas-servlet.xml

<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /> 

But when i submit this form it goes to AuthenticationViaFormAction class and relevant method without validating the model. It mean it does not validate null values restrict to go controller classes. But normal login form which is already in cas validate successfully and say can blank username and password fields.

Where i make mistakes. I spent lot of time to figure it out. can you please correct me .

Thank you
Amila
Loading...