다음을 통해 공유


SecureConversationServiceCredential.SecurityStateEncoder 속성

정의

쿠키 serialization을 인코딩 및 디코딩하는 데 사용되는 사용자 지정 SecurityStateEncoder를 가져오거나 설정합니다.

public:
 property System::ServiceModel::Security::SecurityStateEncoder ^ SecurityStateEncoder { System::ServiceModel::Security::SecurityStateEncoder ^ get(); void set(System::ServiceModel::Security::SecurityStateEncoder ^ value); };
public System.ServiceModel.Security.SecurityStateEncoder SecurityStateEncoder { get; set; }
member this.SecurityStateEncoder : System.ServiceModel.Security.SecurityStateEncoder with get, set
Public Property SecurityStateEncoder As SecurityStateEncoder

속성 값

SecurityStateEncoder

SecurityStateEncoder의 사용자 지정 DataProtectionSecurityStateEncoder 개체입니다.

예제

다음 코드에서는 이 속성을 설정하는 방법을 보여 줍니다.

static void Configure(ServiceHost serviceHost)
{
    /*
     * There are certain settings that cannot be configured via app.config.
     * The security state encoder is one of them.
     * Plug in a SecurityStateEncoder that uses the configured certificate
     * to protect the security context token state.
     *
     * Note: You don't need a security state encoder for cookie mode.  This was added to the
     * sample to illustrate how you would plug in a custom security state encoder should
     * your scenario require one.
     * */
    serviceHost.Credentials.SecureConversationAuthentication.SecurityStateEncoder =
            new CertificateSecurityStateEncoder(serviceHost.Credentials.ServiceCertificate.Certificate);

설명

"쿠키 모드"에서 서비스는 SCT(보안 컨텍스트 토큰)를 쿠키 형태로 클라이언트에 발급하므로 클라이언트가 보안 상태를 유지할 필요가 없습니다. 클라이언트는 서비스에서 요청 메시지를 보호 해제하고 확인하는 방법을 알 수 있도록 요청 메시지에 쿠키를 돌려 보냅니다. SCT는 비보안 네트워크를 통해 전송되는 경우가 많으므로 보호해야 합니다.

기본적으로 Windows Communication Foundation (WCF)은 사용 된 DataProtectionSecurityStateEncoder 데이터 보호 API (DPAPI)를 사용 하 여 쿠키를 보호 하는 클래스입니다. DPAPI가 웹 팜 환경에서 제대로 작동하려면 모든 백엔드 서비스가 동일한 도메인 사용자 계정으로 실행되어야 합니다. 즉 서비스가 웹 호스팅되는 경우 IIS(인터넷 정보 서비스) 작업자 프로세스는 도메인 사용자로 실행되도록 구성되어야 합니다.

이 속성을 사용하면 사용자 지정 SecurityStateEncoder를 사용하여 쿠키를 암호화하고 해독할 수 있으므로 DPAPI를 사용할 필요가 없습니다.

적용 대상