Hello,

setting up a HTTPS server requires some extra steps that are documented 
here [0] (I suppose you are using Restlet 1.1). That is to say:
  - creating Keys and a Self-Signed Certificate,
keytool -genkey -v -alias localhost -dname "CN=serverX,OU=IT,O=JPC,C=GB" 
-keypass password -keystore serverX.jks -storepass password -keyalg 
"RSA" -sigalg "MD5withRSA" -keysize 2048 -validity 3650

  - exporting the Self-Signed Certificate
keytool -export -v -alias localhost -file serverX.cer -keystore 
serverX.jks -storepass password

  - configure your server application (add a server connector that 
supports the HTTPS protocol, configure it to reference the keystore, and 
other parameters)
For example, using the Jetty connector, here is a basic configuration 
that works for me:
         Server server = component.getServers().add(Protocol.HTTPS, 8183);
         Series<Parameter> parameters = server.getContext().getParameters();
         parameters.add("keystorePath", "/path/to/my/keystore/serverX.jks");
         parameters.add("keystorePassword", "password");
         parameters.add("keyPassword", "password");
         parameters.add("keystoreType", "JKS");


Best regards,
Thierry Boileau

[0] http://wiki.restlet.org/docs_1.1/213-restlet.html
[1] 
http://www.restlet.org/documentation/1.1/ext/com/noelios/restlet/ext/jetty/HttpsServerHelper

> I have the following code
>
> public Restlet createRoot() {
> Router router = new Router(getContext());
> Guard guard = new Guard(getContext(), ChallengeScheme.HTTP_BASIC, "XXX 
> Server");
> guard.getSecrets().put("scott", "tiger".toCharArray());
> guard.setNext(ItemsResource.class);
> router.attach("/items", guard );
> return router;
> }
>
> When I hit the browser using
> https://localhost/items
>
> I get a window to enter username and password.
>
> I put in "scott" and "tiger" and press login.
>
> I keep getting window to enter username and password.After 5 attempts I get a 
> message on the server side, that the user "scott" is getting locked for 30 
> mins.
>
> Why is it not accepting the correct username and password
>
> I even used Fiddler's Request Builder. Used the  Base64-encoded string of 
> username scott and and password as tiger, which is c2NvdHQ6dGlnZXI=  and sent 
> the below request
>
> User-Agent: Fiddler
> Host: localhost
> Authorization: Basic c2NvdHQ6dGlnZXI=
>
> I still get the response as
> HTTP/1.1 401 Unauthorized
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2455223
>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2455329

Reply via email to