File: NtlmHttpAuthExample.java

package info (click to toggle)
jcifs 1.3.17-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,860 kB
  • ctags: 3,997
  • sloc: java: 23,131; xml: 3,672; ansic: 386; sh: 171; makefile: 27
file content (32 lines) | stat: -rw-r--r-- 1,186 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class NtlmHttpAuthExample extends HttpServlet {

    public void doGet( HttpServletRequest req,
                HttpServletResponse resp ) throws IOException, ServletException {
        PrintWriter out = resp.getWriter();

        resp.setContentType( "text/html" );
        out.println( "<HTML><HEAD><TITLE>NTLM HTTP Authentication Example</TITLE></HEAD><BODY>" );
        out.println( "<h2>NTLM HTTP Authentication Example</h2>" );

        out.println( req.getRemoteUser() + " successfully logged in" );

        out.println( "<h3>Please submit some form data using POST</h3>" );
        out.println( "<form action=\"NtlmHttpAuthExample\" method=\"post\">" );
        out.println( "<input type=\"text\" name=\"field1\" size=\"20\"/>" );
        out.println( "<input type=\"submit\"/>" );
        out.println( "</form>" );

        out.println( "field1 = " + req.getParameter( "field1" ));

        out.println( "</BODY></HTML>" );
    }
    public void doPost( HttpServletRequest req,
                HttpServletResponse resp ) throws IOException, ServletException {
        doGet( req, resp );
    }
}