CAS4.2.7集成jcaptcha1.0实现登录添加验证码

1、获取资源cas-server-integration-jcaptcha-4.2.7.jar

cas-server-integration-jcaptcha-4.2.7.jar-Java文档类资源-CSDN下载

2、放到WEB-INF/lib下,此包依赖jcaptcha相关jar:

jcaptcha-1.0.jar

jcaptcha-api-1.0.jar

imaging-01012005.jar

需要自行添加到lib目录下

下载地址:

https://download.csdn.net/download/shibushi114/84391501

3、开始配置jcaptcha,配置前需要事先安装好CAS 4.2.7 server,并可以正常登录,本文中cas部署在ROOT下,之后按下面步骤修改配置即可:

  • 修改ROOT/WEB-INF/webflow/login下的login-webflow.xml

在此文件中增加如下新的配置:

<decision-state id="captchaCheck">
	<if test="flowScope.count != null &amp;&amp; flowScope.count >= 3" then="captchaValidate" else="sendTicketGrantingTicket"/>
</decision-state>

<action-state id="captchaValidate">
	<evaluate expression="captchaValidateAction.submit(flowRequestContext, messageContext)"/>
	<transition on="success" to="sendTicketGrantingTicket" />
	<transition on="error" to="errorCount" />
</action-state>
		 
<action-state id="errorCount">
	<evaluate expression="captchaErrorCountAction"/>
	<transition on="success" to="initializeLogin" />
</action-state>

之后修改action-state为realSubmit和handleAuthenticationFailure的片段 为如下 内容:

<action-state id="realSubmit">
	<evaluate
			expression="authenticationViaFormAction.submit(flowRequestContext, flowScope.credential, messageContext)"/>
	<transition on="warn" to="warn"/>
	<!--
	To enable AUP workflows, replace the 'success' transition with the following:
	<transition on="success" to="acceptableUsagePolicyCheck" />
	-->
	<transition on="success" to="captchaCheck"/>
	<transition on="successWithWarning
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
首先,你需要在你的项目中添加 `clap` 依赖。在 `Cargo.toml` 文件中添加以下行: ``` [dependencies] clap = "4.2.7" ``` 接下来,你需要在你的代码中使用 `clap` 的宏来定义你的命令行程序的参数和子命令。例如,下面是一个简单的示例: ```rust use clap::{App, Arg}; fn main() { let matches = App::new("myapp") .version("1.0") .author("Your Name <you@example.com>") .about("A simple command-line program") .arg( Arg::with_name("input") .help("Sets the input file to use") .required(true) .index(1), ) .arg( Arg::with_name("output") .help("Sets the output file to use") .required(true) .index(2), ) .get_matches(); let input_file = matches.value_of("input").unwrap(); let output_file = matches.value_of("output").unwrap(); println!("Input file: {}", input_file); println!("Output file: {}", output_file); } ``` 在上面的示例中,我们使用了 `App::new` 宏来创建一个新的 `clap` 应用程序。我们定义了两个必需的参数 `input` 和 `output`,它们都是位置参数(使用 `index` 方法来指定它们的位置)。我们还定义了一些其他的应用程序元数据,例如版本和作者信息。 最后,我们使用 `get_matches` 方法来解析命令行参数,并使用 `value_of` 方法来获取 `input` 和 `output` 参数的值。 你可以在终端中输入 `cargo run -- <input_file> <output_file>` 来运行你的应用程序,其中 `<input_file>` 和 `<output_file>` 是你的实际输入和输出文件名。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

shibushi114

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值