跳到主要内容

4. 示例

用户 "joe" 可能希望以机器 "foo" 上的用户 "pete" 身份登录. 如果 "pete" 已经在 "foo" 上做好设置, 允许 "joe" 访问他的账户, 那么客户端就会发送 IAC SB AUTHENTICATION NAME "pete" IAC SE IAC SB AUTHENTICATION IS SPX AUTH <joe's spx authentication token> IAC SE. 服务器随后会根据令牌信息把该用户认证为 "joe", 并向回发送 ACCEPT 或 REJECT. 如果正在使用相互认证, 服务器会在 ACCEPT 消息中包含一个 mutual 响应. 用于检查 "pete" 是否允许 "joe" 使用其账户的授权检查, 是在认证交换完成之后进行的. 因此, 客户端有可能收到一个 ACCEPT 响应 (基于认证令牌), 但 joe 仍然被拒绝登录到 pete 的账户.

       Client                           Server
IAC DO AUTHENTICATION
IAC WILL AUTHENTICATION
[ The server is now free to request authentication information.
]
IAC SB AUTHENTICATION SEND SPX
CLIENT|MUTUAL SPX CLIENT|ONE_WAY
IAC SE
[ The server has requested mutual SPX authentication. If mutual
authentication is not supported, then the server is willing to
do one-way SPX authentication. ]
[ The client will now respond with the name of the user that it
wants to log in as, and the SPX authentication token. ]
IAC SB AUTHENTICATION NAME
"pete" IAC SE
IAC SB AUTHENTICATION IS SPX
CLIENT|MUTUAL AUTH <spx
authentication token
information> IAC SE
[ The server responds with an ACCEPT command to state that the
authentication was successful. ]
[ If AUTH_HOW_MUTUAL, the server responds with the mutual
response so the client can verify that it is really talking to
the right server. ]
[ If AUTH_HOW_ONE_WAY, the server responds with a NULL mutual
response, since the client is willing to trust the server
already. ]
IAC SB AUTHENTICATION REPLY SPX
CLIENT|MUTUAL ACCEPT <mutual
response> IAC SE