Hi Jacques,
Your assertion must run after the WSE security assertion in order to obtain
the identity token. Did you try with the property
SoapContext.Current.IdentityToken ?.
If that approach does not work, you should try with a custom security
assertion. (Deriving your class from one of the existing turn-key
assertions).
Something like this:
public class MyUsernameForCertificateSecurityAssertion :
UsernameForCertificateAssertion
{
public MyUsernameForCertificateSecurityAssertion ()
: base()
{
// empty
}
public override SoapFilter
CreateClientOutputFilter(FilterCreationContext context)
{
return new MyClientOutputFilter(this);
}
rotected class MyClientOutputFilter :
UsernameForCertificateAssertion.ClientOutputFilter
{
EndpointProtectionRequirements endpointProtectionRequirements;
public
BodyProtectionClientOutputFilter(UsernameForCertificateAssertion assertion)
: base(assertion)
{
}
public override void SecureMessage(SoapEnvelope envelope,
Microsoft.Web.Services3.Security.Security security,
MessageProtectionRequirements request)
{
base.SecureMessage(envelope, security, request);
SecurityToken token = envelope.Context.IdentityToken;
}
}
Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax
> Hi,
>
[quoted text clipped - 11 lines]
> Thanks
> JM
Jacques Marcialis - 19 Apr 2006 17:42 GMT
Hi Pablo,
Thanks a lot. I made a mistake in the assertions order, it's on the
server and the client.
Now I can authorize connexions with the client certificate
Distinguished Name requesting a database. I can't use the Autorization
object in the policy file because of the change frequency of my client
list (thanks for your response on my previous post :
http://groups.google.com/group/microsoft.public.dotnet.framework.webservices.enh
ancements/browse_thread/thread/62ea8912a41812c8/db041272d6dec7f8?q=jacques&rnum=
3#db041272d6dec7f8
).
Now I have another questions : Is there a way to retreive the client
certificate KeyIdentifier in the SoapContext ?
++
JM
Pablo Cibraro - 20 Apr 2006 16:24 GMT
What kind of KeyIdentifier do you want to retrieve, the Thumprint ?.
Thanks
Pablo.
> Hi Pablo,
>
[quoted text clipped - 13 lines]
> ++
> JM
Jacques Marcialis - 21 Apr 2006 08:53 GMT
Hi Pablo,
I'm thinking to the KeyIdentifier in Base64 or Hexa format
Pablo Cibraro - 26 Apr 2006 14:40 GMT
Yes, you can get the keyidentifier from the certificate associated to the
token.
X509SecurityToken token = (X509SecurityToken)envelope.Context.IdentityToken
token.Certificate.Thumbprint;
Regards,
Pablo.
> Hi Pablo,
>
> I'm thinking to the KeyIdentifier in Base64 or Hexa format