- 論壇徽章:
- 2
|
Start-up
To begin a session, a frontend opens a connection to the server and sends a startup message. This message includes the names of the user and of the database the user wants to connect to; it also identifies the particular protocol version to be used. (Optionally, the startup message can include additional settings for run-time parameters.)
連接一開(kāi)始只發(fā)送了用戶(hù)名和數(shù)據(jù)庫(kù)名,并沒(méi)有發(fā)送密碼。
client不能選擇認(rèn)證方式,也不知道密碼是否被需要(比如trust,peer,ident等等)。
The server then uses this information and the contents of its configuration files (such as pg_hba.conf) to determine whether the connection is provisionally acceptable, and what additional authentication is required (if any).
server根據(jù)這些信息以及配置來(lái)選擇是否需要認(rèn)證,以及應(yīng)該使用哪種認(rèn)證方式。
AuthenticationCleartextPassword
The frontend must now send a PasswordMessage containing the password in clear-text form. If this is the correct password, the server responds with an AuthenticationOk, otherwise it responds with an ErrorResponse.
AuthenticationMD5Password
The frontend must now send a PasswordMessage containing the password encrypted via MD5, using the 4-character salt specified in the AuthenticationMD5Password message. If this is the correct password, the server responds with an AuthenticationOk, otherwise it responds with an ErrorResponse.
于是server就可以查詢(xún)hba并根據(jù)md5或password發(fā)送不同的認(rèn)證請(qǐng)求(或者根本就不需要認(rèn)證請(qǐng)求)。
這時(shí)候client再選擇密碼傳輸?shù)姆绞健?br />
相關(guān)資料:
Password Authentication
Message Formats
|
|