TsgcWebSocketClient属性 › Authentication

Authentication 属性

配置用于验证 WebSocket 握手的凭据和方案。

语法

property Authentication: TsgcWSAuthenticationClient_Options read FAuthentication write SetAuthentication;

默认值

Enabled=False

备注

Authentication.Enabled 设置为 True,并从四种方案中选择一种:Basic(HTTP Basic 头)、Token(Bearer 令牌头,可选择由附加的 OAuth2 组件填充)、Session(HTTP 登录,返回包含在握手 GET 中的会话 ID)和 URL(用户名和密码附加到握手 GET)。分配 User/PasswordToken.AuthToken,并精确启用四种方案中的一种。

示例


oClient := TsgcWebSocketClient.Create(nil);
oClient.Authentication.Enabled := true;
oClient.Authentication.Basic.Enabled := true;
oClient.Authentication.User := 'your user';
oClient.Authentication.Password := 'your password';
oClient.Active := True;

返回属性