diff --git a/src/System.ServiceModel.Federation/src/Resources/Strings.resx b/src/System.ServiceModel.Federation/src/Resources/Strings.resx
index 1660c1a52c8..62f88157094 100644
--- a/src/System.ServiceModel.Federation/src/Resources/Strings.resx
+++ b/src/System.ServiceModel.Federation/src/Resources/Strings.resx
@@ -129,4 +129,58 @@
The communication object, {0}, is in the {1} state. Communication objects cannot be used for communication unless they are in the Opened state.
-
+
+ The RequestType '{0}', is not supported.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+ UseKeys are not supported
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+ No key size provided.
+
+
+ Only PSHA1 computed keys are supported.
+
+
+ Protected key entropy is not supported.
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.cs.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.cs.xlf
index 1f90200d31e..c89f31f840c 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.cs.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.cs.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ Objekt komunikace {0} je ve stavu {1}. Pokud objekty komunikace nejsou ve stavu Opened, nelze je použít ke komunikaci.
@@ -12,6 +22,71 @@
Objekt komunikace {0} nelze použít ke komunikaci, protože je ve stavu Faulted.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ Server {0} odeslal zpět chybu, která udává, že probíhá jeho vypínání. Podrobné informace o chybě naleznete v popisu vnitřní výjimky.
@@ -22,6 +97,21 @@
Server {0} odeslal zpět chybu, která udává, že je příliš zaneprázdněn a nemůže zpracovat požadavek. Podrobné informace o chybě naleznete v popisu vnitřní výjimky.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.de.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.de.xlf
index 8702e03963f..e2433a68ca2 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.de.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.de.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ Das Kommunikationsobjekt {0} befindet sich im {1}-Zustand. Die Kommunikationsobjekte können nicht zur Kommunikation verwendet werden, wenn sie sich nicht im Opened-Zustand befinden.
@@ -12,6 +22,71 @@
Das Kommunikationsobjekt {0} kann nicht zur Kommunikation verwendet werden, weil es sich im Faulted-Zustand befindet.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ Der Server "{0}" hat einen Fehler zurückgesendet, der darauf hinweist, dass der Server gerade heruntergefahren wird. Detaillierte Fehlerinformationen finden Sie in der inneren Ausnahme.
@@ -22,6 +97,21 @@
Der Server "{0}" hat einen Fehler zurückgesendet, der darauf hinweist, dass er zu ausgelastet ist, um die Anforderung zu verarbeiten. Versuchen Sie es später noch mal. Detaillierte Fehlerinformationen finden Sie in der inneren Ausnahme.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.es.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.es.xlf
index 17f3df089b4..0dc1e9b4150 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.es.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.es.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ El objeto de comunicación, {0}, se encuentra en el estado {1}. Los objetos de comunicación no se pueden usar para la comunicación a menos que se encuentren en el estado Opened.
@@ -12,6 +22,71 @@
El objeto de comunicación, {0}, no se puede usar para la comunicación porque se encuentra en el estado Faulted.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ El servidor '{0}' devolvió un error que indica que está en proceso de cerrarse. Consulte la excepción interna para obtener más información del error.
@@ -22,6 +97,21 @@
El servidor "{0}" devolvió un error que indica que está demasiado ocupado para procesar la solicitud. Inténtelo de nuevo más adelante. Consulte la excepción interna para obtener más información del error.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.fr.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.fr.xlf
index 5a111952052..42786374508 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.fr.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.fr.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ L'objet de communication {0} est dans l'état {1}. Les objets de communication ne peuvent pas être utilisés à moins d'être dans l'état Opened.
@@ -12,6 +22,71 @@
L'objet de communication {0} ne peut pas être utilisé pour la communication, car il est dans l'état Faulted.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ Le serveur '{0}' a renvoyé une erreur indiquant qu'il est en cours d'arrêt. Consultez l'exception interne pour obtenir des détails sur l'erreur.
@@ -22,6 +97,21 @@
Le serveur '{0}' a envoyé une erreur indiquant qu'il est trop occupé pour traiter la requête. Réessayez plus tard. Consultez l'exception interne pour obtenir des détails sur l'erreur.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.it.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.it.xlf
index 0e24eb1e061..4ee35e197a9 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.it.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.it.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ L'oggetto comunicazione {0} si trova nello stato {1}. Non è possibile usare oggetti comunicazione per la comunicazione a meno che non siano nello stato Opened.
@@ -12,6 +22,71 @@
Non è possibile usare l'oggetto comunicazione {0} per la comunicazione perché si trova nello stato Faulted.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ Il server '{0}' ha restituito un errore che indica che è in fase di arresto. Per ulteriori informazioni sull'errore, vedere l'eccezione interna.
@@ -22,6 +97,21 @@
Il server '{0}' ha restituito un errore che indica che è troppo occupato per elaborare la richiesta. Riprovare più tardi. Per dettagli sull'errore, vedere l'eccezione interna.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ja.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ja.xlf
index 440cbb3b825..8198b9352b3 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ja.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ja.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ 通信オブジェクト {0} は {1} 状態です。通信オブジェクトは、Opened 状態でないと通信に使用できません。
@@ -12,6 +22,71 @@
通信オブジェクト {0} は、状態が Faulted であるため通信に使用できません。
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ サーバー '{0}' は、シャットダウンの処理中であることを示すフォールトを返信しました。詳細については、内部例外を参照してください。
@@ -22,6 +97,21 @@
サーバー '{0}' は、ビジー状態のため要求を処理できないことを示すフォールトを送り返しました。後で再試行してください。フォールトの詳細については、内部例外を参照してください。
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ko.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ko.xlf
index 6c6a53db69c..f726b9ec553 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ko.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ko.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ 통신 개체 {0}이(가) {1} 상태입니다. 통신 개체는 열림 상태가 아닌 경우 통신에 사용할 수 없습니다.
@@ -12,6 +22,71 @@
통신 개체 {0}은(는) Faulted 상태이기 때문에 통신에 사용할 수 없습니다.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ 종료하는 중이라는 것을 나타내는 오류를 '{0}' 서버가 다시 보냈습니다. 자세한 오류 내용은 내부 예외를 참조하십시오.
@@ -22,6 +97,21 @@
사용 중이어서 요청을 처리할 수 없다는 것을 나타내는 오류를 '{0}' 서버가 다시 보냈습니다. 나중에 다시 시도하세요. 자세한 오류 내용은 내부 예외를 참조하세요.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.pl.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.pl.xlf
index 8369d664e5f..e0805f01083 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.pl.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.pl.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ Obiekt komunikacyjny {0} jest w stanie {1}. Obiektów komunikacyjnych nie można używać do komunikacji, jeśli nie są w stanie Opened.
@@ -12,6 +22,71 @@
Obiektu komunikacyjnego {0} nie można używać do komunikacji, ponieważ jest w stanie Faulted.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ Serwer „{0}” zwrócił błąd wskazujący, że właśnie trwa jego zamykanie. Szczegółowe informacje o błędzie można znaleźć w wewnętrznym wyjątku.
@@ -22,6 +97,21 @@
Serwer „{0}” zwrócił błąd wskazujący, że jest zbyt obciążony, aby obsłużyć żądanie. Spróbuj ponownie później. Szczegółowe informacje o błędzie można znaleźć w wewnętrznym wyjątku.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.pt-BR.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.pt-BR.xlf
index 111f4a627f4..899d51acfd9 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.pt-BR.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.pt-BR.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ O objeto de comunicação, {0}, está no estado {1}. Objetos de comunicação não poderão ser usados para comunicação, a não ser que estejam no estado Aberto.
@@ -12,6 +22,71 @@
O objeto de comunicação, {0}, não pode ser usado para comunicação porque está no estado Com Falha.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ O servidor '{0}' retornou uma falha indicando que ele está desligando. Consulte a exceção interna para obter os detalhes da falha.
@@ -22,6 +97,21 @@
O servidor '{0}' retornou uma falha indicando que ele está muito ocupado para processar a solicitação. Tente novamente mais tarde. Consulte a exceção interna para obter os detalhes da falha.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ru.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ru.xlf
index 000b4859429..3939cae6789 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ru.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.ru.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ Объект связи {0} находится в состоянии {1}. Объекты связи можно использовать для связи только в состоянии Opened.
@@ -12,6 +22,71 @@
Объект связи {0} нельзя использовать для связи, так как он находится в состоянии Faulted.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ Сервер "{0}" отправил обратно сообщение об ошибке, указывающее, что он находится в процессе отключения. Дополнительные сведения об ошибке см. внутреннее исключение.
@@ -22,6 +97,21 @@
Сервер "{0}" отправил обратно сообщение об ошибке, указывающее, что он перегружен и не может обработать запрос. Повторите попытку позже. Дополнительные сведения об ошибке см. в описании внутреннего исключения.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.tr.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.tr.xlf
index bdc4e4b2756..f711e6b2de4 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.tr.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.tr.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ {0} iletişim nesnesi {1} durumunda. Opened durumunda olmadıkları sürece, iletişim nesneleri iletişim için kullanılamaz.
@@ -12,6 +22,71 @@
{0} iletişim nesnesi, Faulted durumunda olduğundan iletişim için kullanılamıyor.
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ '{0}' sunucusu, kapanmakta olduğunu belirten bir hata gönderdi. Hata ayrıntıları için iç özel duruma bakın.
@@ -22,6 +97,21 @@
'{0}' sunucusu bir hata geri göndererek, isteği işleyemeyecek kadar meşgul olduğunu belirtti. Lütfen daha sonra yeniden deneyin. Hata ayrıntıları için iç özel duruma bakın.
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.zh-Hans.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.zh-Hans.xlf
index 5a00b0d955e..05abd51ee38 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.zh-Hans.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.zh-Hans.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ 通信对象 {0} 处于 {1} 状态。除非通信对象处于“已打开”状态,否则无法将其用于通信。
@@ -12,6 +22,71 @@
通信对象 {0} 无法用于通信,因为其处于“出错”状态。
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ 服务器“{0}”发回错误,指示其正在关机。有关错误的详细信息,请参见内部异常。
@@ -22,6 +97,21 @@
服务器“{0}”发回错误,指示其太忙,无法处理请求。请稍后重试。有关错误的详细信息,请参见内部异常。
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.zh-Hant.xlf b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.zh-Hant.xlf
index 2e9b3013f40..41f90c9064c 100644
--- a/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.zh-Hant.xlf
+++ b/src/System.ServiceModel.Federation/src/Resources/xlf/Strings.zh-Hant.xlf
@@ -2,6 +2,16 @@
+
+
+ Bearer key scenarios should not include a proof token or issuer entropy in the response.
+
+
+
+
+ ChannnelFactory must support 'System.ServiceModel.Channels.IRequestChannel' interface.
+
+ 通訊物件 {0} 為 {1} 狀態。除非通訊物件為「已開啟」狀態,否則無法用於通訊。
@@ -12,6 +22,71 @@
因為通訊物件 {0} 為「出錯」狀態,所以無法用於通訊。
+
+
+ Computed key proof tokens are only supported with symmetric key types.
+
+
+
+
+ Computed key proof tokens require issuer to supply key material via entropy.
+
+
+
+
+ Computed key proof tokens require requester to supply key material via entropy.
+
+
+
+
+ Encrypted keys for proof tokens are not supported.
+
+
+
+
+ The IRequestChannel must be in the created state. Was: '{0}'.
+
+
+
+
+ tokenRequirement.GetProperty<IssuedSecurityTokenParameters> must be of type: WSTrustTokenParameters. Was: '{0}.
+
+
+
+
+ IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.
+
+
+
+
+ MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.
+
+
+
+
+ No key size provided.
+
+
+
+
+ Only PSHA1 computed keys are supported.
+
+
+
+
+ Protected key entropy is not supported.
+
+
+
+
+ An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy.
+
+
+
+
+ The RequestType '{0}', is not supported.
+
+ 伺服器 '{0}' 傳回錯誤,指出正在進行關機。如需錯誤詳細資訊,請參閱內部例外狀況。
@@ -22,6 +97,21 @@
伺服器 '{0}' 傳回錯誤,指出因過於忙碌,無法處理要求。請稍後重試。請參考內部例外狀況,以取得錯誤詳細資料。
+
+
+ The token provider '{0}' was unable to provide a security token.
+
+
+
+
+ UseKeys are not supported
+
+
+
+
+ The WsTrust wersion '{0}' is not supported.
+
+
\ No newline at end of file
diff --git a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/IWSTrustChannelContract.cs b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/IWSTrustChannelContract.cs
new file mode 100644
index 00000000000..e012e0dd3ae
--- /dev/null
+++ b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/IWSTrustChannelContract.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.IdentityModel.Tokens;
+using System.Threading.Tasks;
+using Microsoft.IdentityModel.Protocols.WsTrust;
+
+namespace System.ServiceModel.Federation
+{
+ ///
+ /// A service contract that defines the Issue request.
+ ///
+ [ServiceContract]
+ public interface IWSTrustChannelContract
+ {
+ ///
+ /// Sends a WS-Trust Issue request to a STS.
+ ///
+ /// The to send to the STS.
+ /// A issued by the STS.
+ ///
+ [OperationContract(Name = "Issue", Action = "*", ReplyAction = "*")]
+ Task IssueAsync(WsTrustRequest request);
+ }
+}
diff --git a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannel.cs b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannel.cs
new file mode 100644
index 00000000000..f266a4f5091
--- /dev/null
+++ b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannel.cs
@@ -0,0 +1,377 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.ServiceModel.Channels;
+using System.Threading.Tasks;
+using Microsoft.IdentityModel.Protocols;
+using Microsoft.IdentityModel.Protocols.WsTrust;
+using Microsoft.IdentityModel.Tokens;
+using WCFSecurityToken = System.IdentityModel.Tokens.SecurityToken;
+
+namespace System.ServiceModel.Federation
+{
+ ///
+ /// A channel that is used to send WS-Trust messages to an STS.
+ ///
+ public class WSTrustChannel : IWSTrustChannelContract, IChannel, ICommunicationObject
+ {
+ private const int FaultMaxBufferSize = 20 * 1024;
+ private WsSerializationContext _wsSerializationContextTrustFeb2005;
+ private WsSerializationContext _wsSerializationContextTrust1_3;
+ private WsSerializationContext _wsSerializationContextTrust1_4;
+
+ ///
+ /// Constructs a .
+ ///
+ /// The this channel will be used to send a to the STS.
+ public WSTrustChannel(IRequestChannel requestChannel)
+ {
+ RequestChannel = requestChannel ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(requestChannel));
+ if (requestChannel.State != CommunicationState.Created)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(LogHelper.FormatInvariant(SR.GetResourceString(SR.IRequestChannelMustBeCreated), requestChannel.State)));
+
+ MessageVersion = RequestChannel.GetProperty();
+ if (MessageVersion == null || MessageVersion == MessageVersion.None)
+ MessageVersion = MessageVersion.Default;
+
+ EndpointAddress endpointAddress = RequestChannel.GetProperty();
+ if (endpointAddress != null)
+ Address = endpointAddress.Uri?.AbsoluteUri;
+ }
+
+ private string Address { get; }
+
+ ///
+ /// The this class uses for sending and receiving objects.
+ ///
+ private IRequestChannel RequestChannel { get; }
+
+ ///
+ /// Gets the version of WS-Trust this channel will use for serializing objects.
+ ///
+ private MessageVersion MessageVersion { get; }
+
+ ///
+ /// Gets the version of WS-Trust this channel will use for serializing objects.
+ ///
+ //private WsSerializationContext SerializationContext
+ //{
+ // get; set;
+ //}
+
+ /////
+ ///// Gets the this channel will used for serializing WS-Trust request messages.
+ /////
+ private WsTrustSerializer TrustSerializer { get; } = new WsTrustSerializer();
+
+ ///
+ /// Creates a that represents a the .
+ ///
+ /// The to serialize into the message.
+ /// The that represents the .
+ protected virtual Message CreateRequest(WsTrustRequest trustRequest)
+ {
+ _ = trustRequest ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(trustRequest));
+ return Message.CreateMessage(MessageVersion,
+ GetRequestAction(trustRequest),
+ new WSTrustRequestBodyWriter(trustRequest, TrustSerializer));
+ }
+
+ ///
+ /// Gets the WS-Addressing SOAP action that corresponds to the .RequestType and .WsTrustVersion.
+ ///
+ /// The to generate the WS-Addressing action.
+ /// The WS-Addressing action to use.
+ public static string GetRequestAction(WsTrustRequest trustRequest)
+ {
+ _ = trustRequest ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(trustRequest));
+
+ WsTrustActions wsTrustActions;
+ if (trustRequest.WsTrustVersion == WsTrustVersion.Trust13)
+ wsTrustActions = WsTrustActions.Trust13;
+ else if (trustRequest.WsTrustVersion == WsTrustVersion.TrustFeb2005)
+ wsTrustActions = WsTrustActions.TrustFeb2005;
+ else if (trustRequest.WsTrustVersion == WsTrustVersion.Trust14)
+ wsTrustActions = WsTrustActions.Trust14;
+ else
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetResourceString(SR.WsTrustVersionNotSupported, trustRequest.WsTrustVersion.ToString())));
+
+ if (trustRequest.RequestType.Equals(wsTrustActions.Issue))
+ return wsTrustActions.IssueRequest;
+ else if (trustRequest.RequestType.Equals(wsTrustActions.Cancel))
+ return wsTrustActions.CancelRequest;
+ else if (trustRequest.RequestType.Equals(wsTrustActions.Renew))
+ return wsTrustActions.RenewRequest;
+ else if (trustRequest.RequestType.Equals(wsTrustActions.Validate))
+ return wsTrustActions.ValidateRequest;
+ else
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetResourceString(SR.RequestTypeNotSupported, trustRequest.RequestType)));
+ }
+
+ ///
+ /// Gets the to use when serializing the .
+ ///
+ /// The that will be serialized.
+ /// The for the .
+ private WsSerializationContext GetSerializationContext(WsTrustRequest trustRequest)
+ {
+ _ = trustRequest ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(trustRequest));
+ if (trustRequest.WsTrustVersion == WsTrustVersion.TrustFeb2005)
+ {
+ if (_wsSerializationContextTrustFeb2005 == null)
+ _wsSerializationContextTrustFeb2005 = new WsSerializationContext(trustRequest.WsTrustVersion);
+
+ return _wsSerializationContextTrustFeb2005;
+ }
+ else if (trustRequest.WsTrustVersion == WsTrustVersion.Trust13)
+ {
+ if (_wsSerializationContextTrust1_3 == null)
+ _wsSerializationContextTrust1_3 = new WsSerializationContext(trustRequest.WsTrustVersion);
+
+ return _wsSerializationContextTrust1_3;
+ }
+ else if (trustRequest.WsTrustVersion == WsTrustVersion.Trust14)
+ {
+ if (_wsSerializationContextTrust1_4 == null)
+ _wsSerializationContextTrust1_4 = new WsSerializationContext(trustRequest.WsTrustVersion);
+
+ return _wsSerializationContextTrust1_4;
+ }
+
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetResourceString(SR.WsTrustVersionNotSupported, trustRequest.WsTrustVersion.ToString())));
+ }
+
+ #region IChannel Members
+ ///
+ /// Returns a typed object requested, if present, from the appropriate layer in the channel stack.
+ ///
+ /// The typed object for which the method is querying.
+ /// The typed object requested if present, null if not found.
+ public T GetProperty() where T : class
+ {
+ return RequestChannel.GetProperty();
+ }
+ #endregion
+
+ #region ICommunicationObject Members
+ ///
+ /// Occurs when the communication object completes its transition from the closing state into the closed state.
+ ///
+ event EventHandler ICommunicationObject.Closed
+ {
+ add { RequestChannel.Closed += value; }
+ remove { RequestChannel.Closed -= value; }
+ }
+
+ ///
+ /// Occurs when the communication object first enters the closing state.
+ ///
+ event EventHandler ICommunicationObject.Closing
+ {
+ add { RequestChannel.Closing += value; }
+ remove { RequestChannel.Closing -= value; }
+ }
+
+ ///
+ /// Occurs when the communication object first enters the faulted state.
+ ///
+ event EventHandler ICommunicationObject.Faulted
+ {
+ add { RequestChannel.Faulted += value; }
+ remove { RequestChannel.Faulted -= value; }
+ }
+
+ ///
+ /// Occurs when the communication object completes its transition from the opening state into the opened state.
+ ///
+ event EventHandler ICommunicationObject.Opened
+ {
+ add { RequestChannel.Opened += value; }
+ remove { RequestChannel.Opened -= value; }
+ }
+
+ ///
+ /// Occurs when the communication object first enters the opening state.
+ ///
+ event EventHandler ICommunicationObject.Opening
+ {
+ add { RequestChannel.Opening += value; }
+ remove { RequestChannel.Opening -= value; }
+ }
+
+ ///
+ /// Causes a communication object to transition immediately from its current state into the closed state.
+ ///
+ void ICommunicationObject.Abort()
+ {
+ RequestChannel.Abort();
+ }
+
+ ///
+ /// Begins an asynchronous operation to close a communication object with a specified timeout.
+ ///
+ ///
+ /// The that specifies how long the close operation has to complete before timing out.
+ ///
+ ///
+ /// The delegate that receives notification of the completion of the asynchronous
+ /// close operation.
+ ///
+ ///
+ /// An object, specified by the application, that contains state information associated with the asynchronous
+ /// close operation.
+ ///
+ /// The that references the asynchronous close operation.
+ IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ return RequestChannel.BeginClose(timeout, callback, state);
+ }
+
+ ///
+ /// Begins an asynchronous operation to close a communication object.
+ ///
+ ///
+ /// The delegate that receives notification of the completion of the asynchronous
+ /// close operation.
+ ///
+ ///
+ /// An object, specified by the application, that contains state information associated with the asynchronous
+ /// close operation.
+ ///
+ /// The that references the asynchronous close operation.
+ IAsyncResult ICommunicationObject.BeginClose(AsyncCallback callback, object state)
+ {
+ return RequestChannel.BeginClose(callback, state);
+ }
+
+ ///
+ /// Begins an asynchronous operation to open a communication object within a specified interval of time.
+ ///
+ ///
+ /// The that specifies how long the open operation has to complete before timing out.
+ ///
+ ///
+ /// The delegate that receives notification of the completion of the asynchronous
+ /// close operation.
+ ///
+ ///
+ /// An object, specified by the application, that contains state information associated with the asynchronous
+ /// close operation.
+ ///
+ /// The that references the asynchronous open operation.
+ IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ return RequestChannel.BeginOpen(timeout, callback, state);
+ }
+
+ ///
+ /// Begins an asynchronous operation to open a communication object.
+ ///
+ ///
+ /// The delegate that receives notification of the completion of the asynchronous
+ /// close operation.
+ ///
+ ///
+ /// An object, specified by the application, that contains state information associated with the asynchronous
+ /// close operation.
+ ///
+ /// The that references the asynchronous open operation.
+ IAsyncResult ICommunicationObject.BeginOpen(AsyncCallback callback, object state)
+ {
+ return RequestChannel.BeginOpen(callback, state);
+ }
+
+ ///
+ /// Causes a communication object to transition from its current state into the closed state.
+ ///
+ ///
+ /// The that specifies how long the open operation has to complete before timing out.
+ ///
+ void ICommunicationObject.Close(TimeSpan timeout)
+ {
+ RequestChannel.Close(timeout);
+ }
+
+ ///
+ /// Causes a communication object to transition from its current state into the closed state.
+ ///
+ void ICommunicationObject.Close()
+ {
+ RequestChannel.Close();
+ }
+
+ ///
+ /// Completes an asynchronous operation to close a communication object.
+ ///
+ /// The that is returned by a call to the BeginClose() method.
+ void ICommunicationObject.EndClose(IAsyncResult result)
+ {
+ RequestChannel.EndClose(result);
+ }
+
+ ///
+ /// Completes an asynchronous operation to open a communication object.
+ ///
+ /// The that is returned by a call to the BeginClose() method.
+ void ICommunicationObject.EndOpen(IAsyncResult result)
+ {
+ RequestChannel.EndOpen(result);
+ }
+
+ ///
+ /// Causes a communication object to transition from the created state into the opened state within a specified interval of time.
+ ///
+ ///
+ /// The that specifies how long the open operation has to complete before timing out.
+ ///
+ void ICommunicationObject.Open(TimeSpan timeout)
+ {
+ RequestChannel.Open(timeout);
+ }
+
+ ///
+ /// Causes a communication object to transition from the created state into the opened state.
+ ///
+ void ICommunicationObject.Open()
+ {
+ RequestChannel.Open();
+ }
+
+ ///
+ /// Gets the current state of the communication-oriented object.
+ ///
+ CommunicationState ICommunicationObject.State
+ {
+ get { return RequestChannel.State; }
+ }
+ #endregion
+
+ #region IWSTrustChannelContract Members
+ ///
+ /// Sends a to a STS to obtain a .
+ ///
+ /// The sent to the STS.
+ /// A issued by the STS.
+ public async virtual Task IssueAsync(WsTrustRequest trustRequest)
+ {
+ _ = trustRequest ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(trustRequest));
+
+ Message requestMessage = CreateRequest(trustRequest);
+ Message response = await Task.Factory.FromAsync(RequestChannel.BeginRequest, RequestChannel.EndRequest, requestMessage, null, TaskCreationOptions.None).ConfigureAwait(false);
+ if (response.IsFault)
+ {
+ MessageFault fault = MessageFault.CreateFault(response, FaultMaxBufferSize);
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(FaultException.CreateFault(fault, response.Headers?.Action));
+ }
+
+ WsTrustResponse trustResponse = TrustSerializer.ReadResponse(response.GetReaderAtBodyContents());
+ WCFSecurityToken token = WSTrustUtilities.CreateGenericXmlSecurityToken(trustRequest, trustResponse, GetSerializationContext(trustRequest), null);
+ if (token == null)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(SR.Format(SR.TokenProviderUnableToGetToken, string.IsNullOrEmpty(Address) ? ToString() : Address)));
+
+ return token;
+ }
+ #endregion
+ }
+}
diff --git a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannelFactory.cs b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannelFactory.cs
new file mode 100644
index 00000000000..6ad16cb4bc1
--- /dev/null
+++ b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannelFactory.cs
@@ -0,0 +1,65 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using Microsoft.IdentityModel.Protocols.WsTrust;
+
+namespace System.ServiceModel.Federation
+{
+ ///
+ /// A that creates a to send a to a STS.
+ ///
+ public class WSTrustChannelFactory : ChannelFactory
+ {
+ ///
+ /// Initializes a new instance of a specifying the .
+ ///
+ /// The used by the channels created by the factory.
+ public WSTrustChannelFactory(ServiceEndpoint serviceEndpoint)
+ : base(serviceEndpoint)
+ {
+ _ = serviceEndpoint ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(serviceEndpoint));
+ EndpointAddress = serviceEndpoint.Address;
+ }
+
+ ///
+ /// Initializes a new instance of a specifying the and .
+ ///
+ /// The used by channels created by the factory.
+ /// The that specifies the address of the STS.
+ public WSTrustChannelFactory(Binding binding, EndpointAddress endpointAddress)
+ : base(binding, endpointAddress)
+ {
+ _ = binding ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(binding));
+
+ EndpointAddress = endpointAddress ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpointAddress));
+ }
+
+ ///
+ /// Creates a that is used to send an Issue request to a STS.
+ ///
+ /// The that specifies the address of the STS.
+ /// The that address that the channel uses to send messages.
+ /// A that can be used to send an Issue request to a STS.
+ public override IWSTrustChannelContract CreateChannel(EndpointAddress endpointAddress, Uri via)
+ {
+ _ = endpointAddress ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpointAddress));
+ _ = via ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(via));
+
+ return new WSTrustChannel(base.CreateChannel(endpointAddress, via) as IRequestChannel);
+ }
+
+ ///
+ /// Creates a that is used to send an Issue request to a STS.
+ ///
+ /// A that can be used to send an Issue request to a STS.
+ public IWSTrustChannelContract CreateTrustChannel()
+ {
+ return new WSTrustChannel(base.CreateChannel(EndpointAddress, EndpointAddress.Uri) as IRequestChannel);
+ }
+
+ private EndpointAddress EndpointAddress { get; }
+ }
+}
diff --git a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannelSecurityTokenProvider.cs b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannelSecurityTokenProvider.cs
index 896b3bbc57d..017678f368c 100644
--- a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannelSecurityTokenProvider.cs
+++ b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustChannelSecurityTokenProvider.cs
@@ -61,7 +61,7 @@ public WSTrustChannelSecurityTokenProvider(SecurityTokenRequirement tokenRequire
WSTrustTokenParameters = issuedSecurityTokenParameters as WSTrustTokenParameters;
if (WSTrustTokenParameters == null)
{
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new ArgumentException(LogHelper.FormatInvariant("tokenRequirement.GetProperty must be of type: WSTrustTokenParameters. Was: '{0}.", issuedSecurityTokenParameters), nameof(tokenRequirement)), EventLevel.Error);
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new ArgumentException(LogHelper.FormatInvariant(SR.GetResourceString(SR.IssuedSecurityTokenParametersIncorrectType), issuedSecurityTokenParameters), nameof(tokenRequirement)), EventLevel.Error);
}
_communicationObject = new WrapperSecurityCommunicationObject(this);
@@ -196,116 +196,6 @@ private WsTrustResponse GetCachedResponse(WsTrustRequest request)
return null;
}
- ///
- /// Gets the WsTrustVersion for the current MessageSecurityVersion.
- /// ///
- /// Get a proof token from a WsTrust request/response pair based on section 4.4.3 of the WS-Trust 1.3 spec.
- /// How the proof token is retrieved depends on whether the requestor or issuer provide key material:
- /// Requestor | Issuer | Results
- /// -------------------------------------------------
- /// Entropy | No key material | No proof token returned, requestor entropy used
- /// Entropy | Entropy | Computed key algorithm returned and key computed based on request and response entropy
- /// Entropy | Rejects requestor entropy | Proof token in response used as key
- /// No entropy | Issues key | Proof token in response used as key
- /// No entropy | No key material | No proof token
- ///
- /// The WS-Trust request (RST).
- /// The WS-Trust response (RSTR).
- /// The proof token or null if there is no proof token.
- private BinarySecretSecurityToken GetProofToken(WsTrustRequest request, RequestSecurityTokenResponse response)
- {
- // According to the WS-Trust 1.3 spec, symmetric is the default key type
- string keyType = response.KeyType ?? request.KeyType ?? _requestSerializationContext.TrustKeyTypes.Symmetric;
-
- // Encrypted keys and encrypted entropy are not supported, currently, as they should
- // only be needed by unsupported message security scenarios.
- if (response.RequestedProofToken?.EncryptedKey != null)
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new NotSupportedException("Encrypted keys for proof tokens are not supported."), EventLevel.Error);
-
- // Bearer scenarios have no proof token
- if (string.Equals(keyType, _requestSerializationContext.TrustKeyTypes.Bearer, StringComparison.Ordinal))
- {
- if (response.RequestedProofToken != null || response.Entropy != null)
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException("Bearer key scenarios should not include a proof token or issuer entropy in the response."), EventLevel.Error);
-
- return null;
- }
-
- // If the response includes a proof token, use it as the security token's proof.
- // This scenario will occur if the request does not include entropy or if the issuer rejects the requestor's entropy.
- if (response.RequestedProofToken?.BinarySecret != null)
- {
- // Confirm that a computed key algorithm isn't also specified
- if (!string.IsNullOrEmpty(response.RequestedProofToken.ComputedKeyAlgorithm) || response.Entropy != null)
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException("An RSTR containing a proof token should not also have a computed key algorithm or issuer entropy."), EventLevel.Error);
-
- return new BinarySecretSecurityToken(response.RequestedProofToken.BinarySecret.Data);
- }
- // If the response includes a computed key algorithm, compute the proof token based on requestor and issuer entropy.
- // This scenario will occur if the requestor and issuer both provide key material.
- else if (response.RequestedProofToken?.ComputedKeyAlgorithm != null)
- {
- if (!string.Equals(keyType, _requestSerializationContext.TrustKeyTypes.Symmetric, StringComparison.Ordinal))
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException("Computed key proof tokens are only supported with symmetric key types."), EventLevel.Error);
-
- if (string.Equals(response.RequestedProofToken.ComputedKeyAlgorithm, _requestSerializationContext.TrustKeyTypes.PSHA1, StringComparison.Ordinal))
- {
- // Confirm that no encrypted entropy was provided as that is currently not supported.
- // If we wish to support it in the future, most of the work will be in the WSTrust serializer;
- // this code would just have to use protected key's .Secret property to get the key material.
- if (response.Entropy?.ProtectedKey != null || request.Entropy?.ProtectedKey != null)
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper( new NotSupportedException("Protected key entropy is not supported."), EventLevel.Error);
-
- // Get issuer and requestor entropy
- byte[] issuerEntropy = response.Entropy?.BinarySecret?.Data;
- if (issuerEntropy == null)
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException("Computed key proof tokens require issuer to supply key material via entropy."), EventLevel.Error);
-
- byte[] requestorEntropy = request.Entropy?.BinarySecret?.Data;
- if (requestorEntropy == null)
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException("Computed key proof tokens require requestor to supply key material via entropy."), EventLevel.Error);
-
- // Get key size
- int keySizeInBits = response.KeySizeInBits ?? 0; // RSTR key size has precedence
- if (keySizeInBits == 0)
- keySizeInBits = request.KeySizeInBits ?? 0; // Followed by RST
-
- if (keySizeInBits == 0)
- keySizeInBits = _securityAlgorithmSuite?.DefaultSymmetricKeyLength ?? 0; // Symmetric keys should default to a length cooresponding to the algorithm in use
-
- if (keySizeInBits == 0)
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException("No key size provided."), EventLevel.Error);
-
- return new BinarySecretSecurityToken(Psha1KeyGenerator.ComputeCombinedKey(issuerEntropy, requestorEntropy, keySizeInBits));
- }
- else
- {
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new NotSupportedException("Only PSHA1 computed keys are supported."), EventLevel.Error);
- }
- }
- // If the response does not have a proof token or computed key value, but the request proposed entropy,
- // then the requestor's entropy is used as the proof token.
- else if (request.Entropy != null)
- {
- if (request.Entropy.ProtectedKey != null)
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new NotSupportedException("Protected key entropy is not supported."), EventLevel.Error);
-
- if (request.Entropy.BinarySecret != null)
- return new BinarySecretSecurityToken(request.Entropy.BinarySecret.Data);
- }
-
- // If we get here, then no key material has been supplied (by either issuer or requestor), so there is no proof token.
- return null;
- }
-
- private GenericXmlSecurityKeyIdentifierClause GetSecurityKeyIdentifierForTokenReference(SecurityTokenReference securityTokenReference)
- {
- if (securityTokenReference == null)
- return null;
-
- return new GenericXmlSecurityKeyIdentifierClause(WsSecuritySerializer.CreateXmlElement(securityTokenReference));
- }
-
///
/// Begins a WSTrust call to the STS to obtain a first checking if the token is available in the cache.
///
@@ -356,7 +246,7 @@ private async Task GetTokenAsyncCore(TimeSpan timeout)
}
}
- return CreateGenericXmlSecurityToken(request, trustResponse);
+ return WSTrustUtilities.CreateGenericXmlSecurityToken(request, trustResponse, _requestSerializationContext, _securityAlgorithmSuite);
}
///
@@ -394,38 +284,7 @@ protected override SecurityToken GetTokenCore(TimeSpan timeout)
}
}
- return CreateGenericXmlSecurityToken(request, trustResponse);
- }
-
- private SecurityToken CreateGenericXmlSecurityToken(WsTrustRequest request, WsTrustResponse trustResponse)
- {
- // Create GenericXmlSecurityToken
- // Assumes that token is first and Saml2SecurityToken.
- RequestSecurityTokenResponse response = trustResponse.RequestSecurityTokenResponseCollection[0];
-
- // Get attached and unattached references
- GenericXmlSecurityKeyIdentifierClause internalSecurityKeyIdentifierClause = null;
- if (response.AttachedReference != null)
- internalSecurityKeyIdentifierClause = GetSecurityKeyIdentifierForTokenReference(response.AttachedReference);
-
- GenericXmlSecurityKeyIdentifierClause externalSecurityKeyIdentifierClause = null;
- if (response.UnattachedReference != null)
- externalSecurityKeyIdentifierClause = GetSecurityKeyIdentifierForTokenReference(response.UnattachedReference);
-
- // Get proof token
- IdentityModel.Tokens.SecurityToken proofToken = GetProofToken(request, response);
-
- // Get lifetime
- DateTime created = response.Lifetime?.Created ?? DateTime.UtcNow;
- DateTime expires = response.Lifetime?.Expires ?? created.AddDays(1);
-
- return new GenericXmlSecurityToken(response.RequestedSecurityToken.TokenElement,
- proofToken,
- created,
- expires,
- internalSecurityKeyIdentifierClause,
- externalSecurityKeyIdentifierClause,
- null);
+ return WSTrustUtilities.CreateGenericXmlSecurityToken(request, trustResponse, _requestSerializationContext, _securityAlgorithmSuite);
}
private WsTrustVersion GetWsTrustVersion(MessageSecurityVersion messageSecurityVersion)
@@ -436,7 +295,7 @@ private WsTrustVersion GetWsTrustVersion(MessageSecurityVersion messageSecurityV
if (messageSecurityVersion.TrustVersion == TrustVersion.WSTrustFeb2005)
return WsTrustVersion.TrustFeb2005;
- throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new NotSupportedException(LogHelper.FormatInvariant("Unsupported TrustVersion: '{0}'.", MessageSecurityVersion.TrustVersion)), EventLevel.Error);
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new NotSupportedException(LogHelper.FormatInvariant(SR.GetResourceString(SR.WsTrustVersionNotSupported), MessageSecurityVersion.TrustVersion)), EventLevel.Error);
}
private void InitializeKeyEntropyMode()
diff --git a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustRequestBodyWriter.cs b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustRequestBodyWriter.cs
new file mode 100644
index 00000000000..d1823b4cae5
--- /dev/null
+++ b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustRequestBodyWriter.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.ServiceModel.Channels;
+using System.Xml;
+using Microsoft.IdentityModel.Protocols.WsTrust;
+
+namespace System.ServiceModel.Federation
+{
+ ///
+ /// Defines a that writes a into a .
+ ///
+ internal class WSTrustRequestBodyWriter : BodyWriter
+ {
+ ///
+ /// Constructor for the WSTrustRequestBodyWriter.
+ ///
+ /// The to be serialized in a outgoing Message.
+ /// The used to write the into a .
+ public WSTrustRequestBodyWriter(WsTrustRequest trustRequest, WsTrustSerializer trustSerializer) : base(true)
+ {
+ TrustRequest = trustRequest ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(trustRequest));
+ TrustSerializer = trustSerializer ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(trustSerializer));
+ }
+
+ ///
+ /// Override of the base class method. Serializes the into the .
+ ///
+ /// The to serialize the into.
+ protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
+ {
+ TrustSerializer.WriteRequest(writer, TrustRequest.WsTrustVersion, TrustRequest);
+ }
+
+ protected WsTrustRequest TrustRequest { get; }
+
+ protected WsTrustSerializer TrustSerializer { get; }
+ }
+}
diff --git a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustUtilities.cs b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustUtilities.cs
new file mode 100644
index 00000000000..1d4e1c78b7d
--- /dev/null
+++ b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WSTrustUtilities.cs
@@ -0,0 +1,161 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics.Tracing;
+using System.IdentityModel.Tokens;
+using System.ServiceModel.Security;
+using System.ServiceModel.Security.Tokens;
+using Microsoft.IdentityModel.Protocols;
+using Microsoft.IdentityModel.Protocols.WsSecurity;
+using Microsoft.IdentityModel.Protocols.WsTrust;
+using WCFSecurityToken = System.IdentityModel.Tokens.SecurityToken;
+
+namespace System.ServiceModel.Federation
+{
+ ///
+ /// WSTrustUtilities are shared between with
+ /// and and to send a WsTrust message to obtain a SecurityToken from a STS.
+ /// The SecurityToken can be added as an IssuedToken on the outbound WCF message OR be used to call a WebAPI.
+ ///
+ internal static class WSTrustUtilities
+ {
+ /// Get a proof token from a WsTrust request/response pair based on section 4.4.3 of the WS-Trust 1.3 spec.
+ /// How the proof token is retrieved depends on whether the requester or issuer provide key material:
+ /// Requester | Issuer | Results
+ /// -------------------------------------------------
+ /// Entropy | No key material | No proof token returned, requester entropy used
+ /// Entropy | Entropy | Computed key algorithm returned and key computed based on request and response entropy
+ /// Entropy | Rejects requester entropy | Proof token in response used as key
+ /// No entropy | Issues key | Proof token in response used as key
+ /// No entropy | No key material | No proof token
+ ///
+ /// The WS-Trust request (RST).
+ /// The WS-Trust response (RSTR).
+ /// The proof token or null if there is no proof token.
+ internal static BinarySecretSecurityToken GetProofToken(WsTrustRequest request, RequestSecurityTokenResponse response, WsSerializationContext serializationContext, SecurityAlgorithmSuite algorithmSuite)
+ {
+ // According to the WS-Trust 1.3 spec, symmetric is the default key type
+ string keyType = response.KeyType ?? request.KeyType ?? serializationContext.TrustKeyTypes.Symmetric;
+
+ // Encrypted keys and encrypted entropy are not supported, currently, as they should
+ // only be needed by unsupported message security scenarios.
+ if (response.RequestedProofToken?.EncryptedKey != null)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new NotSupportedException(SR.GetResourceString(SR.EncryptedKeysForProofTokensNotSupported)), EventLevel.Error);
+
+ // Bearer scenarios have no proof token
+ if (string.Equals(keyType, serializationContext.TrustKeyTypes.Bearer, StringComparison.Ordinal))
+ {
+ if (response.RequestedProofToken != null || response.Entropy != null)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException(SR.GetResourceString(SR.BearerKeyShouldNotIincludeAProofToken)), EventLevel.Error);
+
+ return null;
+ }
+
+ // If the response includes a proof token, use it as the security token's proof.
+ // This scenario will occur if the request does not include entropy or if the issuer rejects the requester's entropy.
+ if (response.RequestedProofToken?.BinarySecret != null)
+ {
+ // Confirm that a computed key algorithm isn't also specified
+ if (!string.IsNullOrEmpty(response.RequestedProofToken.ComputedKeyAlgorithm) || response.Entropy != null)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException(SR.GetResourceString(SR.RSTRProofTokenShouldNotHaveAComputedKeyAlgorithmOrIssuerEntropy)), EventLevel.Error);
+
+ return new BinarySecretSecurityToken(response.RequestedProofToken.BinarySecret.Data);
+ }
+ // If the response includes a computed key algorithm, compute the proof token based on requester and issuer entropy.
+ // This scenario will occur if the requester and issuer both provide key material.
+ else if (response.RequestedProofToken?.ComputedKeyAlgorithm != null)
+ {
+ if (!string.Equals(keyType, serializationContext.TrustKeyTypes.Symmetric, StringComparison.Ordinal))
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException(SR.GetResourceString(SR.ComputedKeyProofTokensAreOnlySupportedWithSymmetricKeyTypes)), EventLevel.Error);
+
+ if (string.Equals(response.RequestedProofToken.ComputedKeyAlgorithm, serializationContext.TrustKeyTypes.PSHA1, StringComparison.Ordinal))
+ {
+ // Confirm that no encrypted entropy was provided as that is currently not supported.
+ // If we wish to support it in the future, most of the work will be in the WSTrust serializer;
+ // this code would just have to use protected key's .Secret property to get the key material.
+ if (response.Entropy?.ProtectedKey != null || request.Entropy?.ProtectedKey != null)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper( new NotSupportedException(SR.GetResourceString(SR.ProtectedKeyEntropyIsNotSupported)), EventLevel.Error);
+
+ // Get issuer and requester entropy
+ byte[] issuerEntropy = response.Entropy?.BinarySecret?.Data;
+ if (issuerEntropy == null)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException(SR.GetResourceString(SR.ComputedKeyProofTokensRequireIssuerToSupplyKeyMaterialViaEntropy)), EventLevel.Error);
+
+ byte[] requestorEntropy = request.Entropy?.BinarySecret?.Data;
+ if (requestorEntropy == null)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException(SR.GetResourceString(SR.ComputedKeyProofTokensRequireRequesterToSupplyKeyMaterialViaEntropy)), EventLevel.Error);
+
+ // Get key size
+ int keySizeInBits = response.KeySizeInBits ?? 0; // RSTR key size has precedence
+ if (keySizeInBits == 0)
+ keySizeInBits = request.KeySizeInBits ?? 0; // Followed by RST
+
+ if (keySizeInBits == 0)
+ keySizeInBits = algorithmSuite?.DefaultSymmetricKeyLength ?? 0; // Symmetric keys should default to a length corresponding to the algorithm in use
+
+ if (keySizeInBits == 0)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new InvalidOperationException(SR.GetResourceString(SR.NoKeySizeProvided)), EventLevel.Error);
+
+ return new BinarySecretSecurityToken(Psha1KeyGenerator.ComputeCombinedKey(issuerEntropy, requestorEntropy, keySizeInBits));
+ }
+ else
+ {
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new NotSupportedException(SR.GetResourceString(SR.OnlyPSHA1ComputedKeysAreSupported)), EventLevel.Error);
+ }
+ }
+ // If the response does not have a proof token or computed key value, but the request proposed entropy,
+ // then the requester's entropy is used as the proof token.
+ else if (request.Entropy != null)
+ {
+ if (request.Entropy.ProtectedKey != null)
+ throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new NotSupportedException(SR.GetResourceString(SR.ProtectedKeyEntropyIsNotSupported)), EventLevel.Error);
+
+ if (request.Entropy.BinarySecret != null)
+ return new BinarySecretSecurityToken(request.Entropy.BinarySecret.Data);
+ }
+
+ // If we get here, then no key material has been supplied (by either issuer or requester), so there is no proof token.
+ return null;
+ }
+
+ internal static GenericXmlSecurityKeyIdentifierClause GetSecurityKeyIdentifierForTokenReference(SecurityTokenReference securityTokenReference)
+ {
+ if (securityTokenReference == null)
+ return null;
+
+ return new GenericXmlSecurityKeyIdentifierClause(WsSecuritySerializer.CreateXmlElement(securityTokenReference));
+ }
+
+ internal static WCFSecurityToken CreateGenericXmlSecurityToken(WsTrustRequest request, WsTrustResponse trustResponse, WsSerializationContext serializationContext, SecurityAlgorithmSuite algorithmSuite)
+ {
+ // Create GenericXmlSecurityToken
+ // Assumes that token is first and Saml2SecurityToken.
+ RequestSecurityTokenResponse response = trustResponse.RequestSecurityTokenResponseCollection[0];
+
+ // Get attached and unattached references
+ GenericXmlSecurityKeyIdentifierClause internalSecurityKeyIdentifierClause = null;
+ if (response.AttachedReference != null)
+ internalSecurityKeyIdentifierClause = GetSecurityKeyIdentifierForTokenReference(response.AttachedReference);
+
+ GenericXmlSecurityKeyIdentifierClause externalSecurityKeyIdentifierClause = null;
+ if (response.UnattachedReference != null)
+ externalSecurityKeyIdentifierClause = GetSecurityKeyIdentifierForTokenReference(response.UnattachedReference);
+
+ // Get proof token
+ WCFSecurityToken proofToken = GetProofToken(request, response, serializationContext, algorithmSuite);
+
+ // Get lifetime
+ DateTime created = response.Lifetime?.Created ?? DateTime.UtcNow;
+ DateTime expires = response.Lifetime?.Expires ?? created.AddDays(1);
+
+ return new GenericXmlSecurityToken(response.RequestedSecurityToken.TokenElement,
+ proofToken,
+ created,
+ expires,
+ internalSecurityKeyIdentifierClause,
+ externalSecurityKeyIdentifierClause,
+ null);
+ }
+ }
+}
diff --git a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WsTrustTokenParameters.cs b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WsTrustTokenParameters.cs
index 70b5ec7b4dd..f731e815282 100644
--- a/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WsTrustTokenParameters.cs
+++ b/src/System.ServiceModel.Federation/src/System/ServiceModel/Federation/WsTrustTokenParameters.cs
@@ -93,7 +93,7 @@ public int IssuedTokenRenewalThresholdPercentage
{
get => _issuedTokenRenewalThresholdPercentage;
set => _issuedTokenRenewalThresholdPercentage = (value <= 0 || value > 100)
- ? throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new ArgumentOutOfRangeException(nameof(value), LogHelper.FormatInvariant("IssuedTokenRenewalThresholdPercentage must be greater than or equal to 1 and less than or equal to 100. Was: '{0}'.", value)), EventLevel.Error)
+ ? throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new ArgumentOutOfRangeException(nameof(value), LogHelper.FormatInvariant(SR.GetResourceString(SR.IssuedTokenRenewalThresholdPercentageIncorrect), value)), EventLevel.Error)
: value;
}
@@ -109,7 +109,7 @@ public TimeSpan MaxIssuedTokenCachingTime
{
get => _maxIssuedTokenCachingTime;
set => _maxIssuedTokenCachingTime = value <= TimeSpan.Zero
- ? throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new ArgumentOutOfRangeException(nameof(value), LogHelper.FormatInvariant("MaxIssuedTokenCachingTime must be greater than TimeSpan.Zero. Was: '{0}'.", value)), EventLevel.Error)
+ ? throw DiagnosticUtility.ExceptionUtility.ThrowHelper(new ArgumentOutOfRangeException(nameof(value), LogHelper.FormatInvariant(SR.GetResourceString(SR.MaxIssuedTokenCachingTimeMustBeGreaterThanTimeSpanZero), value)), EventLevel.Error)
: value;
}
diff --git a/src/System.ServiceModel.Federation/tests/System.ServiceModel.Federation.Tests.csproj b/src/System.ServiceModel.Federation/tests/System.ServiceModel.Federation.Tests.csproj
index 30c7ff486b1..a66f6ac79bd 100644
--- a/src/System.ServiceModel.Federation/tests/System.ServiceModel.Federation.Tests.csproj
+++ b/src/System.ServiceModel.Federation/tests/System.ServiceModel.Federation.Tests.csproj
@@ -8,7 +8,13 @@
+
+
+
+
+
+
diff --git a/src/System.ServiceModel.Federation/tests/WSTrustChannelFactoryTest.cs b/src/System.ServiceModel.Federation/tests/WSTrustChannelFactoryTest.cs
new file mode 100644
index 00000000000..592f8eff8ea
--- /dev/null
+++ b/src/System.ServiceModel.Federation/tests/WSTrustChannelFactoryTest.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Infrastructure.Common;
+using Xunit;
+
+namespace System.ServiceModel.Federation.Tests
+{
+ public static class WSTrustChannelFactoryTest
+ {
+ [WcfFact]
+ public static void DefaultWSTrustChannelFactory()
+ {
+ try
+ {
+ WSTrustChannelFactory trustChannelFactory = new WSTrustChannelFactory(null, null);
+ }
+ catch(Exception ex)
+ {
+ Assert.Equal(typeof(ArgumentNullException), ex.GetType());
+ }
+ }
+ }
+}
diff --git a/src/System.ServiceModel.Federation/tests/WSTrustChannelTest.cs b/src/System.ServiceModel.Federation/tests/WSTrustChannelTest.cs
new file mode 100644
index 00000000000..d2838587cc3
--- /dev/null
+++ b/src/System.ServiceModel.Federation/tests/WSTrustChannelTest.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Infrastructure.Common;
+using Xunit;
+
+namespace System.ServiceModel.Federation.Tests
+{
+ public static class WSTrustChannelTest
+ {
+ [WcfFact]
+ public static void WSTrustChannelParameters()
+ {
+ try
+ {
+ WSTrustChannel trustChannel = new WSTrustChannel(null);
+ }
+ catch(Exception ex)
+ {
+ Assert.Equal(typeof(ArgumentNullException), ex.GetType());
+ }
+ }
+ }
+}