Hi,

Thanks for your support, I have added a decision-state and redirections are
working fine. But I want to work with two models. Currently just validate
one of them.

<var name="*credentials*"
class="org.jasig.cas.authentication.principal.UsernamePasswordCredentials"
/>
<var name="*customCredentials*" class="xxxx.CustomCredentials" />

<action-state id="*generateLoginTicket*">
        <evaluate
expression="generateLoginTicketAction.generate(flowRequestContext)" />
<transition on="generated" to="paramRequest" />
</action-state>

<decision-state id="*paramRequest*">
<if test="requestParameters.p == 'store'" then="customViewLoginForm"
else="viewLoginForm" />
</decision-state>

<view-state id="*viewLoginForm*" view="*casLoginView*" model="*credentials*
">
        <binder>
            <binding property="username" />
            <binding property="password" />
        </binder>
        <on-entry>
            <set name="viewScope.commandName" value="'credentials'" />
        </on-entry>
<transition on="submit" bind="true" validate="true" to="realSubmit">
            <evaluate
expression="authenticationViaFormAction.doBind(flowRequestContext,
flowScope.credentials)" />
        </transition>
</view-state>
<view-state id="*customViewLoginForm*" view="*casStoreLoginView*" model="*
customCredentials*">
        <binder>
            <binding property="username" />
            <binding property="password" />
            <binding property="newField" />
        </binder>
        <on-entry>
            <set name="viewScope.commandName" value="'credentials'" />
        </on-entry>
<transition on="submit" bind="true" validate="true" to="realSubmit">
            <evaluate
expression="authenticationViaFormAction.doBind(flowRequestContext,
flowScope.credentials)" />
        </transition>
</view-state>

*viewLoginForm* is working well*, *but *customViewLoginForm* does not
validate. I have validated xxxx.CustomCredentials using annotations. Have I
to change something inside of this view-state in order to validate
newField?

Eddú Meléndez Gonzales
[email protected]




On Sun, Mar 3, 2013 at 1:08 AM, KaTeLmE <[email protected]> wrote:

> Use a decisor state to render the right view using in the then clause a
> OGNL expresion testing the parameter "p=custom" (see other decision-states,
> eg. gateway=true in login-webflow.xml to undertstand how-to)
>
> So...
>
> - Rename the id of current viewLoginForm to defaultViewLoginForm.
> - The new decision-state must have the id viewLoginForm. If decision-state
> test success (then=customViewLoginForm), otherwise
> (else=defaultViewLoginForm)
>
> In that way, duplicated code is avoided and hold the default behaviour
>
>
> 2013/2/27 Eddú Meléndez Gonzales <[email protected]>
>
>> Hi
>>
>> I would like to have 2 login forms but I want to reuse the same url for
>> both
>>
>> https://localhost:8443/cas/login display the username and password fields
>> https://localhost:8443/cas/login?p=custom display username, password and
>> custom fields
>>
>> I have an idea but I don´t know how to do it
>>
>> In cas's login-webflow.xml
>>
>> I can have this credentials for https://localhost:8443/cas/login
>> *<var name="credentials"
>> class="org.jasig.cas.authentication.principal.UsernamePasswordCredentials"
>> />*
>>
>> and this one for https://localhost:8443/cas/login?p=custom
>> *<var name="newCredentials" class="com.xxx.CustomCredentials" />*
>>
>> This is the orifinal view state
>> *<view-state id="viewLoginForm" view="casLoginView" model="credentials">*
>> *        <binder>*
>> *            <binding property="username" />*
>> *            <binding property="password" />*
>> *        </binder>*
>> *        <on-entry>*
>> *            <set name="viewScope.commandName" value="'credentials'" />*
>> *        </on-entry>*
>> * <transition on="submit" bind="true" validate="true" to="realSubmit">*
>> *            <evaluate
>> expression="authenticationViaFormAction.doBind(flowRequestContext,
>> flowScope.credentials)" />*
>> *        </transition>*
>> * </view-state>*
>>
>> I would create another one but this will use another custom model
>> *<view-state id="newViewLoginForm" parent="#viewLoginForm"
>> model="newCredentials">*
>> *        <binder>*
>> *            <binding property="username" />*
>> *            <binding property="password" />*
>> *            <binding property="newField1" />**
>> *
>> *            <binding property="newField2" />**
>> *
>> *        </binder>*
>> *        </view-state>*
>> *
>> *
>> Here I would have to make a decision to redirect to *viewLoginForm *or 
>> *newViewLoginForm
>> *taking into account the param in my url
>> *<action-state id="generateLoginTicket">*
>> *        <evaluate
>> expression="generateLoginTicketAction.generate(flowRequestContext)" /> *
>> * <transition on="generated" to="viewLoginForm" />*
>> * </action-state>*
>> *
>> *
>> Could you help me?
>>
>> --
>> You are currently subscribed to [email protected] as: 
>> [email protected]
>>
>> To unsubscribe, change settings or access archives, see 
>> http://www.ja-sig.org/wiki/display/JSG/cas-user
>>
>>
> --
> You are currently subscribed to [email protected] as: 
> [email protected]
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>
>

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to