zoukankan      html  css  js  c++  java
  • User Login Client Identification

    w用HTTP认证首部注册用户名。

    HTTP The Definitive Guide

    Rather than passively trying to guess the identity of a user from his IP address, a web server can
    explicitly ask the user who he is by requiring him to authenticate (log in) with a username and
    password.
    To help make web site logins easier, HTTP includes a built-in mechanism to pass username
    information to web sites, using the WWW-Authenticate and Authorization headers. Once logged in,
    the browsers continually send this login information with each request to the site, so the information is
    always available. We'll discuss this HTTP authentication in much more detail in Chapter 12, but let's
    take a quick look at it now.
    If a server wants a user to register before providing access to the site, it can send back an HTTP 401
    Login Required response code to the browser. The browser will then display a login dialog box and
    supply the information in the next request to the browser, using the Authorization header.
    [2]
    This is
    depicted in Figure 11-2.

    [2]
    To save users from having to log in for each request, most browsers will remember login information for a
    site and pass in the login information for each request to the site.

    Figure 11-2. Registering username using HTTP authentication headers

    Here's what's happening in this figure:


    In Figure 11-2a, a browser makes a request from the www.joes-hardware.com site.


    The site doesn't know the identity of the user, so in Figure 11-2b, the server requests a login
    by returning the 401 Login Required HTTP response code and adds the WWW-Authenticate
    header. This causes the browser to pop up a login dialog box.


    Once the user enters a username and a password (to sanity check his identity), the browser
    repeats the original request. This time it adds an Authorization header, specifying the
    username and password. The username and password are scrambled, to hide them from casual
    or accidental network observers.
    [3]

    [3]
    As we will see in Chapter 14, the HTTP basic authentication username and password can easily
    be unscrambled by anyone who wants to go through a minimal effort. More secure techniques will
    be discussed later.


    Now, the server is aware of the user's identity. •

    For future requests, the browser will automatically issue the stored username and password
    when asked and will often even send it to the site when not asked. This makes it possible to
    log in once to a site and have your identity maintained through the session, by having the
    browser send the Authorization header as a token of your identity on each request to the
    server.

  • 相关阅读:
    现在, Delphi 的多线程已经非常易用了!
    发现 TSplitter 在嵌套时不好用, 索性写了个替代品
    关于显示透空歌词的思路 回复 "zhaoboaidelphi" 的问题
    简单获取钢琴 88 个键的音高频率值
    准备理一下菜单和工具栏相关的组件
    在 StringGrid 上画线时, 使用 GDI+ 以消除锯齿 回复 "gsjn_8888_6666" 的问题
    解压 svgz 到 svg
    jQuery能做到,PHP能做到,C#也能做到
    监测ASP.NET应用程序性能最简单的方法
    支持高并发的IIS Web服务器常用设置
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6396548.html
Copyright © 2011-2022 走看看