1 回答
TA贡献2012条经验 获得超12个赞
要检索其他输入,请向模块添加另一个状态。
<ModuleProperties moduleName="MyAuth" version="1.0" >
<Callbacks length="0" order="1" timeout="600" header="#NOT SHOWN#" template="readme.html"/>
<Callbacks length="2" order="2" timeout="600" header="#TO BE SUBSTITUTED#">
<NameCallback isRequired="true" >
<Prompt>Username</Prompt>
</NameCallback>
<PasswordCallback echoPassword="false" >
<Prompt>Password</Prompt>
</PasswordCallback>
</Callbacks>
<Callbacks length="1 order="3" timeout="600" header="#TO BE SUBSTITUTED#">
<NameCallback isRequired="true" >
<Prompt>Additional Input</Prompt>
</NameCallback>
</Callbacks>
</ModuleProperties>
处理auth模块代码中的状态
public class MyAuth extends AMLoginModule {
// same code here
@Override
public int process(Callback[] callbacks, int state) throws LoginException {
//same code logic here
switch (state) {
case AUTHENTICATE:
return GET_ADDITIONAL_DATA;
//...
case GET_ADDITIONAL_DATA:
final String additionalData = ((NameCallback) callbacks[0]).getName();
// handle additional data
}
}
}
添加回答
举报