3

My project uses Restlet framework and hosted on App Engine. I wanted to do normal Form authentication with email and password. When i search for authentication in Restlet, I only end up with Basic and Digest authentication.

How to implement a Form based authentication on Restlet?

4

1 回答 1

0

在您的 web.xml 中尝试添加类似这样的代码

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>CustomerConnect</display-name>

   <security-role>
        <role-name>manager</role-name>
    </security-role>
    <servlet-mapping>
  <servlet-name>Jersey REST Service</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>management pages</web-resource-name>
            <url-pattern>/*</url-pattern>

        </web-resource-collection>
        <auth-constraint>
            <role-name>manager</role-name>
        </auth-constraint>
    </security-constraint>

  <login-config>
        <auth-method>FORM</auth-method>
         <form-login-config>
            <form-login-page>/LoginForm.html</form-login-page>
            <form-error-page>/LoginError.html</form-error-page>
         </form-login-config>
    </login-config>
于 2013-11-08T15:20:12.587 回答