JAAS“必需”标志

时间:2013-04-07 08:51:28

标签: security jaas

http://docs.oracle.com/javase/6/docs/api/javax/security/auth/login/Configuration.html

它说

1) Required     - The LoginModule is required to succeed.
                  If it succeeds or fails, authentication still continues
                  to proceed down the LoginModule list.

它也说

The overall authentication succeeds only if all Required and Requisite LoginModules succeed. 
If a Sufficient LoginModule is configured and succeeds, then only the Required and 
Requisite LoginModules prior to that Sufficient LoginModule need to have succeeded 
for the overall authentication to succeed. 

似乎如果必需的loginModule失败,结果将失败。 我的问题是,为什么如果必需的loginModule失败,身份验证仍然继续继续关闭LoginModule列表?

1 个答案:

答案 0 :(得分:1)

您绝对正确:如果所需的loginModule失败,结果将失败。 即使所有其他登录模块都成功,也无法取得成功。 如果要使用其他模块,则需要使用时的用例。 例如,您有一个可选模块来审核登录访问权限。

JAAS使您可以根据需要灵活地定义登录模块。 如果您不需要停止并立即返回失败,请使用Requisite。