Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Restlet with Simple-尽管needClientAuthentication设置为true,但它接受任何没有客户端证书的连接_Authentication_Ssl_Restlet - Fatal编程技术网

Restlet with Simple-尽管needClientAuthentication设置为true,但它接受任何没有客户端证书的连接

Restlet with Simple-尽管needClientAuthentication设置为true,但它接受任何没有客户端证书的连接,authentication,ssl,restlet,Authentication,Ssl,Restlet,我使用Restlet 2.0.8进行简单设置,如下所示: component = new Component(); component.getClients().add(Protocol.FILE); Server httpsServer = component.getServers().add(Protocol.HTTPS, 444); Series<Parameter> parameters = httpsServer.getContext().

我使用Restlet 2.0.8进行简单设置,如下所示:

    component = new Component();
    component.getClients().add(Protocol.FILE);
    Server httpsServer = component.getServers().add(Protocol.HTTPS, 444);

    Series<Parameter> parameters = httpsServer.getContext().getParameters();

    File pwd = new File(".");
    String path = pwd.getCanonicalPath();
    String keystorePath = path + "/keystore/keypair.jks";

    parameters.add("SSLContextFactory", "org.restlet.ext.ssl.PkixSslContextFactory");
    parameters.add("keystorePath", keystorePath);
    parameters.add("keystorePassword", "xxx");
    parameters.add("keyPassword", "xxx");
    parameters.add("keystoreType", "JKS");
    parameters.add("threadMaxIdleTimeMs", "60000"); //default idle time
    parameters.add("needClientAuthentication", "true");

    // Guard the restlet with BASIC authentication (encrypted under SSL).
    ChallengeAuthenticator guard = new ChallengeAuthenticator(null, ChallengeScheme.HTTP_BASIC, "xxx");

    //new pagerreceiver
    Restlet resty = new PagerReceiverApplication();

    LoginChecker loginVerifier = new LoginChecker();
    guard.setVerifier(loginVerifier);
    guard.setNext(resty);
    component.getDefaultHost().attachDefault(guard);

    overrideStatus statusService = new overrideStatus();
    component.setStatusService(statusService);

    component.start();
component=新组件();
component.getClients().add(Protocol.FILE);
服务器httpsServer=component.getServers().add(Protocol.HTTPS,444);
Series parameters=httpsServer.getContext().getParameters();
文件pwd=新文件(“.”);
字符串路径=pwd.getCanonicalPath();
字符串keystorePath=path+“/keystore/keypair.jks”;
parameters.add(“SSLContextFactory”、“org.restlet.ext.ssl.PkixSslContextFactory”);
添加(“keystrepath”,keystrepath);
添加(“keystrepassword”、“xxx”);
参数。添加(“密钥密码”、“xxx”);
添加(“keystoreType”、“JKS”);
添加(“ThreadMaxidletimes”,“60000”)//默认空闲时间
添加(“needClientAuthentication”、“true”);
//使用基本身份验证(在SSL下加密)保护restlet。
ChallengeAuthenticator guard=新的ChallengeAuthenticator(null,ChallengeScheme.HTTP_BASIC,“xxx”);
//新页面接收器
Restlet resty=new pagerReceiveApplication();
LoginChecker LoginVerifer=新的LoginChecker();
guard.setVerifier(登录验证程序);
卫兵:下一个(resty);
getDefaultHost().attachDefault(guard);
overrideStatus statusService=新的overrideStatus();
组件。设置状态服务(状态服务);
component.start();
SSL工作正常,但它接受任何连接,无论它们是否具有客户端证书!到底是怎么回事,我是不是遗漏了什么

在之前的一段时间里,Simple一直使用“想要客户端身份验证”,而没有任何方式来配置它(“需要”或“没有”)

因此,简单Restlet连接器的
needClientAuthentication
参数永远不受支持,因为Restlet连接器本身无法改变这种行为

据我所知,简单版本的变化。1785只删除任何形式的客户端身份验证(无“需要”或“想要”)。我不确定Restlet 2.0.8是否使用了这个补丁之前或之后的Simple版本,但到目前为止,似乎没有任何东西提供这种支持

此处讨论了有关此主题的简单邮件列表:

有几个变通办法:

  • 对于Restlet应用程序,请使用与Simple不同的连接器。其他的应该支持
    needClientAuthentication
  • 继续使用
    wantClientAuthentication
    (前提是它是预打补丁的简单版本),并检查是否确实存在证书,否则禁止请求。(我认为IIS就是这样做的,即使它“需要”证书。)

顺便说一句,看看您的代码,我不确定您为什么要坚持让客户端同时提供客户端证书和HTTP基本身份验证凭据。基本授权。在客户端证书上似乎有点过火。

该死,我想可能是这样的-RESTlet文档根本没有提到这一点-这太可怕了-它表明needClientAuthentication和wantClientAuthentication都可以正常工作。我也不确定Simple使用的是哪一个版本——理想情况下,我从一开始就需要客户端身份验证,无论如何,我宁愿使用Jetty连接器,但它似乎有一个相当大的错误阻止我使用它,我将在另一篇文章中对此进行说明。