[Fedora-suds-list] WSSE Expires
larryt at winfirst.com
larryt at winfirst.com
Wed Dec 16 06:04:38 UTC 2009
There's a suds-timestamp repo, http://bitbucket.org/schmichael/suds-timestamp/, that seems to merge into the trunk relatively easily. I'm a noob, though, so I can't say if it actually works.
-larry
---- Original message ----
>Date: Tue, 15 Dec 2009 21:16:40 +0100
>From: fedora-suds-list-bounces at redhat.com (on behalf of khalid y <kernity at gmail.com>)
>Subject: Re: [Fedora-suds-list] WSSE Expires
>To: "Andrews, Gavin" <Gavin.Andrews at morganstanley.com>
>Cc: fedora-suds-list at redhat.com
>
> My solution was to add this expires like this but
> I'm not sure it's the best way with the newest
> version.
>
> from suds.client import Client
>
> # I created my own TimestampToken
>
> class TimestampToken(Token):
> def __init__(self, validity=60):
> Token.__init__(self)
> self.created = datetime.now()
> self.expires = self.created+
> timedelta(seconds = validity)
> def xml(self):
> root = Element("Timestamp", ns = wsuns)
> u = Element('Created', ns = wsuns)
> u.setText(date.to_iso8601(self.created))
> p = Element('Expires', ns =wsuns)
> p.setText(date.to_iso8601(self.expires))
> root.append(p)
> return root
>
> url =
> "http://127.0.0.1:8080/api/AuthenticationService?wsdl"
> service = Client(url)
> security = Security()
> # Add your security token here :-)
>
> ######
>
> timetoken = TimestampToken(validity=60)
> security.tokens.append(timetoken)
> service.set_options(wsse=security)
>
> So my service is ready to handle request.
>
> @+++
>
> 2009/12/15 Andrews, Gavin
> <Gavin.Andrews at morganstanley.com>
>
> I am trying to perform a SOAP Client call to a
> server which mandates WSSE Authentication.
>
>
>
> Creating
>
>
>
> <wsse:Security mustUnderstand="true">
>
> <wsse:UsernameToken>
>
>
> <wsse:Username>username</wsse:Username>
>
>
> <wsse:Password>password</wsse:Password>
>
>
> <wsu:Created>2009-12-15T19:01:46.229259</wsu:Created>
>
> </wsse:UsernameToken>
>
>
>
> Works well, but the server still isn’t happy as
> it requires the wsu:Expires element.
>
>
>
> Is there a way to add expires into the
> UsernameToken?
>
>
>
> Thanks in advance,
>
> Gavin
>
> ------------------------------------------------
>
> NOTICE: If received in error, please destroy, and
> notify sender. Sender does not intend to waive
> confidentiality or privilege. Use of this email is
> prohibited when received in error. We may monitor
> and store emails to the extent permitted by
> applicable law.
>
> _______________________________________________
> fedora-suds-list mailing list
> fedora-suds-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-suds-list
>________________
>_______________________________________________
>fedora-suds-list mailing list
>fedora-suds-list at redhat.com
>https://www.redhat.com/mailman/listinfo/fedora-suds-list
More information about the fedora-suds-list
mailing list