login-webflow.xml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed to Jasig under one or more contributor license
  4. agreements. See the NOTICE file distributed with this work
  5. for additional information regarding copyright ownership.
  6. Jasig licenses this file to you under the Apache License,
  7. Version 2.0 (the "License"); you may not use this file
  8. except in compliance with the License. You may obtain a
  9. copy of the License at the following location:
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. -->
  18. <flow xmlns="http://www.springframework.org/schema/webflow"
  19. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  20. xsi:schemaLocation="http://www.springframework.org/schema/webflow
  21. http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
  22. <var name="credentials" class="org.jasig.cas.authentication.principal.UsernamePasswordCredentials" />
  23. <on-start>
  24. <evaluate expression="initialFlowSetupAction" />
  25. </on-start>
  26. <decision-state id="ticketGrantingTicketExistsCheck">
  27. <if test="flowScope.ticketGrantingTicketId != null" then="hasServiceCheck" else="gatewayRequestCheck" />
  28. </decision-state>
  29. <decision-state id="gatewayRequestCheck">
  30. <if test="requestParameters.gateway != '' and requestParameters.gateway != null and flowScope.service != null" then="gatewayServicesManagementCheck" else="serviceAuthorizationCheck" />
  31. </decision-state>
  32. <decision-state id="hasServiceCheck">
  33. <if test="flowScope.service != null" then="renewRequestCheck" else="viewGenericLoginSuccess" />
  34. </decision-state>
  35. <decision-state id="renewRequestCheck">
  36. <if test="requestParameters.renew != '' and requestParameters.renew != null" then="serviceAuthorizationCheck" else="generateServiceTicket" />
  37. </decision-state>
  38. <!-- Do a service authorization check early without the need to login first -->
  39. <action-state id="serviceAuthorizationCheck">
  40. <evaluate expression="serviceAuthorizationCheck"/>
  41. <transition to="generateLoginTicket"/>
  42. </action-state>
  43. <!--
  44. The "warn" action makes the determination of whether to redirect directly to the requested
  45. service or display the "confirmation" page to go back to the server.
  46. -->
  47. <decision-state id="warn">
  48. <if test="flowScope.warnCookieValue" then="showWarningView" else="redirect" />
  49. </decision-state>
  50. <!--
  51. <action-state id="startAuthenticate">
  52. <action bean="x509Check" />
  53. <transition on="success" to="sendTicketGrantingTicket" />
  54. <transition on="warn" to="warn" />
  55. <transition on="error" to="generateLoginTicket" />
  56. </action-state>
  57. -->
  58. <!--
  59. LPPE transitions begin here: You will also need to
  60. move over the 'lppe-configuration.xml' file from the
  61. 'unused-spring-configuration' folder to the 'spring-configuration' folder
  62. so CAS can pick up the definition for the bean 'passwordPolicyAction'.
  63. -->
  64. <action-state id="passwordPolicyCheck">
  65. <evaluate expression="passwordPolicyAction" />
  66. <transition on="showWarning" to="passwordServiceCheck" />
  67. <transition on="success" to="sendTicketGrantingTicket" />
  68. <transition on="error" to="viewLoginForm" />
  69. </action-state>
  70. <action-state id="passwordServiceCheck">
  71. <evaluate expression="sendTicketGrantingTicketAction" />
  72. <transition to="passwordPostCheck" />
  73. </action-state>
  74. <decision-state id="passwordPostCheck">
  75. <if test="flowScope.service != null" then="warnPassRedirect" else="pwdWarningPostView" />
  76. </decision-state>
  77. <action-state id="warnPassRedirect">
  78. <evaluate expression="generateServiceTicketAction" />
  79. <transition on="success" to="pwdWarningPostView" />
  80. <transition on="error" to="generateLoginTicket" />
  81. <transition on="gateway" to="gatewayServicesManagementCheck" />
  82. </action-state>
  83. <end-state id="pwdWarningAbstractView">
  84. <on-entry>
  85. <set name="flowScope.passwordPolicyUrl" value="passwordPolicyAction.getPasswordPolicyUrl()" />
  86. </on-entry>
  87. </end-state>
  88. <end-state id="pwdWarningPostView" view="casWarnPassView" parent="#pwdWarningAbstractView" />
  89. <end-state id="casExpiredPassView" view="casExpiredPassView" parent="#pwdWarningAbstractView" />
  90. <end-state id="casMustChangePassView" view="casMustChangePassView" parent="#pwdWarningAbstractView" />
  91. <end-state id="casAccountDisabledView" view="casAccountDisabledView" />
  92. <end-state id="casAccountLockedView" view="casAccountLockedView" />
  93. <end-state id="casBadHoursView" view="casBadHoursView" />
  94. <end-state id="casBadWorkstationView" view="casBadWorkstationView" />
  95. <!-- LPPE transitions end here... -->
  96. <action-state id="generateLoginTicket">
  97. <evaluate expression="generateLoginTicketAction.generate(flowRequestContext)" />
  98. <transition on="generated" to="viewLoginForm" />
  99. </action-state>
  100. <view-state id="viewLoginForm" view="casLoginView" model="credentials">
  101. <binder>
  102. <binding property="username" />
  103. <binding property="password" />
  104. <!--RememberMe免登陆
  105. <binding property="rememberMe" />-->
  106. </binder>
  107. <on-entry>
  108. <set name="viewScope.commandName" value="'credentials'" />
  109. </on-entry>
  110. <transition on="submit" bind="true" validate="true" to="realSubmit">
  111. <evaluate expression="authenticationViaFormAction.doBind(flowRequestContext, flowScope.credentials)" />
  112. </transition>
  113. </view-state>
  114. <action-state id="realSubmit">
  115. <evaluate expression="authenticationViaFormAction.submit(flowRequestContext, flowScope.credentials, messageContext)" />
  116. <!--
  117. To enable LPPE on the 'warn' replace the below transition with:
  118. <transition on="warn" to="passwordPolicyCheck" />
  119. CAS will attempt to transition to the 'warn' when there's a 'renew' parameter
  120. and there exists a ticketGrantingId and a service for the incoming request.
  121. -->
  122. <transition on="warn" to="warn" />
  123. <!--
  124. To enable LPPE on the 'success' replace the below transition with:
  125. <transition on="success" to="passwordPolicyCheck" />
  126. -->
  127. <transition on="success" to="sendTicketGrantingTicket" />
  128. <transition on="error" to="generateLoginTicket" />
  129. <transition on="accountDisabled" to="casAccountDisabledView" />
  130. <transition on="mustChangePassword" to="casMustChangePassView" />
  131. <transition on="accountLocked" to="casAccountLockedView" />
  132. <transition on="badHours" to="casBadHoursView" />
  133. <transition on="badWorkstation" to="casBadWorkstationView" />
  134. <transition on="passwordExpired" to="casExpiredPassView" />
  135. </action-state>
  136. <action-state id="sendTicketGrantingTicket">
  137. <evaluate expression="sendTicketGrantingTicketAction" />
  138. <transition to="serviceCheck" />
  139. </action-state>
  140. <decision-state id="serviceCheck">
  141. <if test="flowScope.service != null" then="generateServiceTicket" else="viewGenericLoginSuccess" />
  142. </decision-state>
  143. <action-state id="generateServiceTicket">
  144. <evaluate expression="generateServiceTicketAction" />
  145. <transition on="success" to ="warn" />
  146. <transition on="error" to="generateLoginTicket" />
  147. <transition on="gateway" to="gatewayServicesManagementCheck" />
  148. </action-state>
  149. <action-state id="gatewayServicesManagementCheck">
  150. <evaluate expression="gatewayServicesManagementCheck" />
  151. <transition on="success" to="redirect" />
  152. </action-state>
  153. <action-state id="redirect">
  154. <evaluate expression="flowScope.service.getResponse(requestScope.serviceTicketId)" result-type="org.jasig.cas.authentication.principal.Response" result="requestScope.response" />
  155. <transition to="postRedirectDecision" />
  156. </action-state>
  157. <decision-state id="postRedirectDecision">
  158. <if test="requestScope.response.responseType.name() == 'POST'" then="postView" else="redirectView" />
  159. </decision-state>
  160. <!--
  161. the "viewGenericLogin" is the end state for when a user attempts to login without coming directly from a service.
  162. They have only initialized their single-sign on session.
  163. -->
  164. <end-state id="viewGenericLoginSuccess" view="casLoginGenericSuccessView" />
  165. <!--
  166. The "showWarningView" end state is the end state for when the user has requested privacy settings (to be "warned") to be turned on. It delegates to a
  167. view defines in default_views.properties that display the "Please click here to go to the service." message.
  168. -->
  169. <end-state id="showWarningView" view="casLoginConfirmView" />
  170. <end-state id="postView" view="postResponseView">
  171. <on-entry>
  172. <set name="requestScope.parameters" value="requestScope.response.attributes" />
  173. <set name="requestScope.originalUrl" value="flowScope.service.id" />
  174. </on-entry>
  175. </end-state>
  176. <!--
  177. The "redirect" end state allows CAS to properly end the workflow while still redirecting
  178. the user back to the service required.
  179. -->
  180. <end-state id="redirectView" view="externalRedirect:${requestScope.response.url}" />
  181. <end-state id="viewServiceErrorView" view="viewServiceErrorView" />
  182. <end-state id="viewServiceSsoErrorView" view="viewServiceSsoErrorView" />
  183. <global-transitions>
  184. <!-- CAS-1023 This one is simple - redirects to a login page (same as renew) when 'ssoEnabled' flag is unchecked
  185. instead of showing an intermediate unauthorized view with a link to login page -->
  186. <transition to="viewLoginForm" on-exception="org.jasig.cas.services.UnauthorizedSsoServiceException"/>
  187. <transition to="viewServiceErrorView" on-exception="org.springframework.webflow.execution.repository.NoSuchFlowExecutionException" />
  188. <transition to="viewServiceErrorView" on-exception="org.jasig.cas.services.UnauthorizedServiceException" />
  189. </global-transitions>
  190. </flow>