TURN Server | Long Term Credentials

일반적으로 TURN 서버는 TURN 요청에 대해서는 Authentication을 사용하고 STUN 요청에 대해서는 Authentication 없이 구성됩니다.

 

sgcWebSockets TURN Server는 Long-Term Credentials를 지원하므로, Long-Term 자격 증명 정보가 있는 요청만 허용하도록 TsgcTURNServer를 구성할 수 있습니다.

 

이를 구성하려면, TURNOptions.Authorization 속성에 액세스하여 활성화하십시오.

그런 다음 LongTermCredentials 속성에 접근하여 활성화하십시오. 기본적으로 이 유형의 권한 부여는 Realm 문자열과 기본 StaleNonce 값 10분(= 600초)으로 이미 구성되어 있습니다.

 


oTURN := TsgcTURNServer.Create(nil);
oTURN.Port := 3478;
oTURN.STUNOptions.Authentication.Enabled := False;
oTURN.TURNOptions.Authentication.Enabled := True;
oTURN.TURNOptions.Authentication.LongTermCredentials.Enabled := True;
oTURN.TURNOptions.Authentication.LongTermCredentials.Realm := 'sgcWebSockets';
oTURN.TURNOptions.Authentication.LongTermCredentials.StaleNonce := 600;
oTURN.Active := True;

procedure OnSTUNRequestAuthorization(Sender: TObject; const aRequest: TsgcSTUN_Message; 
  const aUsername, aRealm: string; var Password: string);
begin
  if (aUsername = 'my-user') and (aRealm = 'sgcWebSockets') then
    Password := 'my-password';
end;