用于 Kerberos (Windows) 中 SSO 身份验证的 Jmeter 脚本



我正在尝试使用 Kerberos 实现 Jmeter 脚本(jmeter 版本 5.1(以实现 SSO 功能。 我已经在 krb5 和 jass conf 文件中完成了设置,并且还更新了 HTTP 授权管理器,其中包含域、领域和机制作为 Kerberos。

运行脚本时,脚本不会在 URL 中输出 SAML 响应。检查 jmeter 日志会给出以下错误:

2020-02-14 12:32:23,453 WARN o.a.j.p.h.c.KerberosManager: Could not log in user gl0
javax.security.auth.login.LoginException: null (68)
at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Unknown Source) ~[?:1.8.0_241]
at com.sun.security.auth.module.Krb5LoginModule.login(Unknown Source) ~[?:1.8.0_241]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_241]
at javax.security.auth.login.LoginContext.invoke(Unknown Source) ~[?:1.8.0_241]
at javax.security.auth.login.LoginContext.access$000(Unknown Source) ~[?:1.8.0_241]
at javax.security.auth.login.LoginContext$4.run(Unknown Source) ~[?:1.8.0_241]
at javax.security.auth.login.LoginContext$4.run(Unknown Source) ~[?:1.8.0_241]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_241]
at javax.security.auth.login.LoginContext.invokePriv(Unknown Source) ~[?:1.8.0_241]
at javax.security.auth.login.LoginContext.login(Unknown Source) ~[?:1.8.0_241]
at org.apache.jmeter.protocol.http.control.KerberosManager.lambda$getSubjectForUser$0(KerberosManager.java:70) ~[ApacheJMeter_http.jar:5.1 r1853635]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_241]
at org.apache.jmeter.protocol.http.control.KerberosManager.getSubjectForUser(KerberosManager.java:83) [ApacheJMeter_http.jar:5.1 r1853635]
at org.apache.jmeter.protocol.http.control.AuthManager.getSubjectForUrl(AuthManager.java:294) [ApacheJMeter_http.jar:5.1 r1853635]
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:829) [ApacheJMeter_http.jar:5.1 r1853635]
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:572) [ApacheJMeter_http.jar:5.1 r1853635]
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:67) [ApacheJMeter_http.jar:5.1 r1853635]
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1231) [ApacheJMeter_http.jar:5.1 r1853635]
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1220) [ApacheJMeter_http.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622) [ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546) [ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) [ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) [ApacheJMeter_core.jar:5.1 r1853635]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]
Caused by: sun.security.krb5.KrbException: null (68)
at sun.security.krb5.KrbAsRep.<init>(Unknown Source) ~[?:1.8.0_241]
at sun.security.krb5.KrbAsReqBuilder.send(Unknown Source) ~[?:1.8.0_241]
at sun.security.krb5.KrbAsReqBuilder.action(Unknown Source) ~[?:1.8.0_241]
... 27 more

不幸的是,您的问题没有足够的细节来猜测失败原因,接下来请考虑添加以下屏幕截图:

  1. HTTP 请求采样器
  2. HTTP 授权管理器
  3. krb5.confjaas.conf文件的内容
  4. 拥有更详细的日志也是有益的,将下一行添加到 log4j2.xml 文件中:

    <Logger name="org.apache.jmeter.protocol.http.control" level="debug" />
    

    并将sun.security.krb5.debug系统属性设置为true

更多信息:

  • 日志记录和错误消息
  • Windows Authentication with Apache JMeter
  • Kerberos 疑难解答

相关内容

  • 没有找到相关文章

最新更新