Atitit. Identity Verification Solution Attilax Summary
1 . 1. Identity Verification 1
1 . 2. Basic Certification 1
1 . 2.1. Programming for basic clients 2
1 . 3. Digest authentication mechanism 3
1 . 4. SSL Authentication 3
1 . 5. formbase certification, i.e. form authentication 3
This was a premature infants from China, + had liver failure, cholestasis and other diseases, at present in Shanghai treatment, but need to large medical expenses. He needs our help, and the look forward to the more people to the help him.
This is a China-basedSoftware Development Community, gotfacing the crisis of development efficiency, the currentUrgenttreatment, but needHelp. Brothers Worldneed our help, and a forward, so that more people to help.
1.1.
Identity Verification
Some Web sites or services require the user's identity information, so need to know these messages at all times, but certainly not each time the user entered the user password, so there are several ways to certification:
1.2.
Basic Certification
Basic certification is another common authentication method, unlike form authentication, Basic authentication is often used for stateless client authentication, such as Httpinvoker or Web service authentication, which is characterized by the client each time access to the application, the request to carry the head of authentication information, is generally the user name and password, because the Basic authentication will pass plaintext, so it is best to use HTTPS to transfer data.
ASIC authentication does not use session
Author :: ★ (Attilax) >>> nickname : old Wow's paw   (   full name:: ATTILAX AKBAR AL RAPANUI  Attilax   Baroque   Alpha   Rapa Nui   )   Kanji name: Ayron, Email:[email protected]
reprint Please indicate source: http://www.cnblogs.com/attilax/
1.2.1.
Programming for basic clients
Let's demonstrate how to use Basic authentication. Suppose we need to remotely invoke the contents of http://localhost:8080/ch104/admin.jsp in basic.jsp. In order to be able to pass the spring security permission detection, we need to add basic required authentication information on the requested header.
String username = "admin";
String Password = "admin";
Byte[] Token = (username + ":" + password). GetBytes ("Utf-8");
String authorization = "Basic" + New String (base64.encodebase64 (token), "Utf-8");
URL url = new URL ("http://localhost:8080/ch104/admin.jsp");
HttpURLConnection conn = (httpurlconnection) url.openconnection ();
Conn.setrequestproperty ("Authorization", Authorization);
|
We first stitch the user name and password into a string, separated by ":" . Then use commons-codec 's Base64 to encrypt the string. Spring Security uses commons-codec when it comes to basic certification This string is reversed into a username and password, and then the authentication operation. The next step is to add a prefix "Basic"to the resulting string, so that Spring Security can determine whether the client is using the Basic Certification. |
|
Set the string generated above to the request header, named "Authorization". Spring Security obtains the head information at the time of authentication. |
For basic code that can be found in/ch104/basic.jsp, you can run ch104 and then access http://localhost:8080/ch104/basic.jsp. It will use the code above to successfully access the ADMIN.JSP information through the spring security certification.
1.3.
Digest authentication mechanism
is a LINUX security authentication mechanism based on the MD5 algorithm . The hash value of the user-side transfer is compared to the hash value of the consumer password to authenticate the client. However, since this mechanism must read the user's password, all users who want to authenticate through DIGEST-MD5 must have a {CLEAR} password in the directory . when the {CLEAR} password is stored in the directory, the access rights to the password value are appropriately restricted through ACI. In addition, you must configure attribute encryption in the tail code as described in encrypting property values.
HTTP Protocol Digest ( Digest ) authentication -Jszj 's Column - Blog Channel -CSDN.NET.html
1.4.
SSL Authentication
SSL authentication refers to the Client to the server-side authentication. It is used primarily to provide authentication to users and servers, to encrypt and hide transmitted data, to ensure that data is not changed in transmission, that is, the integrity of the data, and has become the standard of globalization in this field.
1.5.formbase certification, i.e.
Forms Authentication
here is the main formbase certification, that is Forms Authentication .
1.5.0.1.
use cookies to manage session
Reference
Chapter VII basic certification . HTML
the principle and implementation method of HTTP using BASIC authentication -atlantisholic-itpub blog . html
Atitit. Attilax Summary of Identity authentication solutions