Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / April 2006

Tip: Looking for answers? Try searching our database.

SoapContext in a custom policy assertion

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jacques Marcialis - 19 Apr 2006 09:30 GMT
Hi,

I'm writting a new custom assertion that log
authentication/authorization on an sql data base and a syslog server. I
need some information of the RequestSoapContext like
RequestSoapContext.Current.IdentityToken.Identity.Name or
RequestSoapContext.Current.IdentityToken.Key.

Unfortunatly, the RequestSoapContext is not accessible in a SoapFilter
inherited class and I use the Context property of the SoapEnvelope
passed as parameter. This context does not contain the information I
need. Does someone know how can I do ?

Thanks
JM
Pablo Cibraro - 19 Apr 2006 15:16 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.