ServiceCredentials.IssuedTokenAuthentication 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取此服务的当前颁发的令牌(例如,SAML)身份验证设置。
public:
property System::ServiceModel::Security::IssuedTokenServiceCredential ^ IssuedTokenAuthentication { System::ServiceModel::Security::IssuedTokenServiceCredential ^ get(); };
public System.ServiceModel.Security.IssuedTokenServiceCredential IssuedTokenAuthentication { get; }
member this.IssuedTokenAuthentication : System.ServiceModel.Security.IssuedTokenServiceCredential
Public ReadOnly Property IssuedTokenAuthentication As IssuedTokenServiceCredential
属性值
一个 IssuedTokenServiceCredential 实例。
示例
下面的代码演示如何访问此属性,并使用它来设置其他属性。
// This method configures the IssuedTokenAuthentication property of a ServiceHost.
public static void ConfigureIssuedTokenServiceCredentials(
ServiceHost sh, bool allowCardspaceTokens, IList<X509Certificate2> knownissuers,
X509CertificateValidationMode certMode, X509RevocationMode revocationMode, SamlSerializer ser )
{
// Allow CardSpace tokens.
sh.Credentials.IssuedTokenAuthentication.AllowUntrustedRsaIssuers = allowCardspaceTokens;
// Set up known issuer certificates.
foreach(X509Certificate2 cert in knownissuers)
sh.Credentials.IssuedTokenAuthentication.KnownCertificates.Add ( cert );
// Set issuer certificate validation and revocation checking modes.
sh.Credentials.IssuedTokenAuthentication.CertificateValidationMode =
X509CertificateValidationMode.PeerOrChainTrust;
sh.Credentials.IssuedTokenAuthentication.RevocationMode = X509RevocationMode.Online;
sh.Credentials.IssuedTokenAuthentication.TrustedStoreLocation = StoreLocation.LocalMachine;
// Set the SamlSerializer, if one is specified.
if ( ser != null )
sh.Credentials.IssuedTokenAuthentication.SamlSerializer = ser;
}
' This method configures the IssuedTokenAuthentication property of a ServiceHost.
Public Shared Sub ConfigureIssuedTokenServiceCredentials( _
ByVal sh As ServiceHost, _
ByVal allowCardspaceTokens As Boolean, _
ByVal knownissuers As IList(Of X509Certificate2), _
ByVal certMode As X509CertificateValidationMode, _
ByVal revocationMode As X509RevocationMode, _
ByVal ser As SamlSerializer _
)
' Allow CardSpace tokens.
sh.Credentials.IssuedTokenAuthentication.AllowUntrustedRsaIssuers = _
allowCardspaceTokens
' Set up known issuer certificates.
Dim cert As X509Certificate2
For Each cert In knownissuers
sh.Credentials.IssuedTokenAuthentication.KnownCertificates.Add(cert)
Next cert
' Set issuer certificate validation and revocation checking modes.
sh.Credentials.IssuedTokenAuthentication.CertificateValidationMode = _
X509CertificateValidationMode.PeerOrChainTrust
sh.Credentials.IssuedTokenAuthentication.RevocationMode = _
X509RevocationMode.Online
' Set the SamlSerializer, if one is specified.
If Not (ser Is Nothing) Then
sh.Credentials.IssuedTokenAuthentication.SamlSerializer = ser
End If
End Sub