Today's Page Hits: 43
Venu pointed out in his blog entry how one can disable generation of InclusivePrefixList in WSIT through proprietary policy assertions in WSDL. But what if you are using standalone JAXWS + XWSS with security configuration files supported by XWSS? This is exactly what a forum user recently asked at http://forums.java.net/jive/thread.jspa?messageID=209715. We now support this in XWSS 3.0 for both CanonicalizationMethod of Signature as well Transform for individual References.
Here is a sample configuration file to achieve this:
<xwss:JAXRPCSecurity xmlns:xwss="http://java.sun.com/xml/ns/xwss/config">
<xwss:Service>
<xwss:SecurityConfiguration dumpMessages="true">
<xwss:Sign>
<xwss:CanonicalizationMethod disableInclusivePrefix="true" />
<xwss:SignatureTarget type="xpath" value="//SOAP-ENV:Body">
<xwss:Transform algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" disableInclusivePrefix="true"/>
</xwss:SignatureTarget>
</xwss:Sign>
<xwss:RequireSignature/>
</xwss:SecurityConfiguration>
</xwss:Service>
<xwss:SecurityEnvironmentHandler>
simple.server.SecurityEnvironmentHandler
</xwss:SecurityEnvironmentHandler>
</xwss:JAXRPCSecurity>Note the disableInclusivePrefix attribute for CanonicalizationMethod and Transform. This is introduced as an optional attribute and the default value for this will be false. So if you are configuring security through these configuration files and are facing interoperability issues due to some implementation not supporting InclusivePrefixList, you can set this attribute to true and try!
Technorati:Tango WSIT Glassfish Web Services XWSS Signatures WS Security
Glassfish V2 beta released yesterday (12th March 2007). It includes Microsoft Interoperability using WSIT. WSIT is being developed within the Glassfish community and will be delivered through Glassfish v2. You can learn more about WSIT and get the latest builds from the WSIT home page. Of course you do not need to download and install WSIT if you are using Glassfish beta or latest versions of Glassfish v2. Latest WSIT builds get integrated into Glassfish v2 on a periodic basic. For a tutorial on WSIT, check out tutorial.
Here I will describe some of the custom properties a user might want to set for Timestamps in the policy if he has a security enabled web service. These are custom WSIT specific policy assertions and provide additional control to the user over how to configure a service.
WS-SecurityPolicy specifies following construct to include a timestamp in SOAP Security header:
<wsp:Policy>
<wsp:ExactlyOne>
<wsp:All>
<sp:AsymmetricBinding>
<wsp:Policy>
.
.
.
<sp:IncludeTimestamp/>
.
.
</wsp:Policy>
</sp:AsymmetricBinding>
.
.
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
This makes the SOAP message include a Timestamp element in Security header with creation time and expiry time. Here is a sample message with timestamp:
<S:Envelope xmlns:S="..." xmlns:wsse="..." xmlns:wsu="...">
<S:Header>
<wsse:Security S:mustUnderstand="true">
<wsu:Timestamp wsu:Id="3">
<wsu:Created>2007-03-13T06:14:45Z</wsu:Created>
<wsu:Expires>2007-03-13T06:19:45Z</wsu:Expires>
</wsu:Timestamp>
.
.
</wsse:Security>
</S:Header>
.
.
</S:Envelope>
Along with creation time and expiry time, there are two other properties based on which a service in WSIT can decide to accept or reject messages based on timestamp. They are:
MaxClockSkew: This sets the maximum difference allowed between the system clocks of the sender and recipient.
Here is what WSS 1.1 spec says about clock skew: The wsu:Expires child in a Timestamp is relative to the requestor's clock. In order to evaluate the expiration time, recipients need to recognize that the requestor's clock may not be synchronized to the recipient's clock,. The recipient MUST therefore make an assessment of the level of trust to be placed in the requestor's clock, since the recipient is called upon to evaluate whether the expiration time is in the past relative to the requestor's, not the recipient. The recipient may make a judgment of the requestor's likely current clock time by means not described in the WSS specification,for example an out-of-band clock synchronization protocol. The recipient may also use the creation time and the delays introduced by intermediate SOAP roles to estimate the degree of CLOCK SKEW.
TimestampFreshnessLimit: Sets the maximum duration of time after which the timestamp becomes stale. It is RECOMMENDED that Web Service producers provide a timestamp "freshness" limitation, and that any stale timestamps be rejected. As a guideline a value of 5 minutes can be used as a minimum to detect and reject replays.
By default the value of both these properties is set to 5 minutes in WSIT. This should be good enough for most use cases. But if someone wants to specify custom values for these properties, WSIT provides proprietary policy assertions for them. This is how it could be specified in the policy:
<wsp:Policy>
<wsp:ExactlyOne>
<wsp:All>
<!-- Proprietary WSIT assertion -->
<sc:ValidatorConfiguration xmlns:sc="http://schemas.sun.com/2006/03/wss/server"
xmlns:wspp="http://java.sun.com/xml/ns/wsit/policy" wspp:visibility="private" sc:maxClockSkew="0"
sc:timestampFreshnessLimit="300000">
<sp:AsymmetricBinding>
<wsp:Policy>
.
.
.
<sp:IncludeTimestamp/>
.
.
</wsp:Policy>
</sp:AsymmetricBinding>
.
.
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
where the values of sc:maxClockSkew and sc:timestampFresshnessLimit are in milliseconds. Setting MaxClockSkew to 0 might be helpful if we are sure that client and service are on same system, or if the the systems are synchronized in time. TimestampFeshnessLimit should be greater than zero as a value of zero means timestamp becomes stale immediately. The default value of 5 minutes should be good in most cases, but can be kept less to avoid replay attacks in this duration.
The same properties can be specified on client side also in the wsit-client.xml file to set maxClockSkew and timestampFreshnessLimit to required values – the only change being the namespace of properties change to http://schemas.sun.com/2006/03/wss/client. The default remains 5 minutes for both of them.
Technorati:Tango WSIT Glassfish Web Services
Its been quite some time since milestone 2 of Web Services Interoperability Technologies (WSIT) was released. We have added a number of features and bug fixes to Security module of WSIT i.e. xwss since then. Here is a list of some of the important features/fixes you can expect from the latest promoted build or the upcoming milestone 3 release:
Security path is now much faster than milestone 2. We no longer convert soap messages to DOM for signing/encryption. Security operations are now performed in a streaming fashion. In other words, security operations are performed when the message is being written to transport wire. This results in huge performance gains as message is no longer converted to DOM objects. Our initial tests suggest almost a gain of 30-40% over previous implementation.
Support for EncryptedHeaders: WSS1.1 introduced an
additional element <wsse11:EncryptedHeader> for containing
encrypted SOAP header blocks. We now support this for WSS1.1
messages.
What this means for a SOAP Message?
If the
EncryptedParts assertion for a SOAP message contains encryption of a
SOAP header e.g. an addressing header, the header is first encrypted
(resulting in an EncryptedData element) and then the result is
wrapped with a wsse11:EncryptedHeader element.
What are the
other changes?
If the referencing security header block
contains mustUnderstand, role/actor or relay attributes, those
attributes and the associated values must be copied to this
wsse11:EncryptedHeader element. The ReferenceList in the referencing
Security Header should now refer to this wsse11:EncryptedHeader
element and not to the contained EncryptedData element.
How
does this help?
A SOAP node can now decide if it is required
to process an encrypted SOAP header. If the mustUnderstand attribute
is set to true, a SOAP node/processor now must be aware of this
encrypted header and know how to decrypt and convert into original
header block. It should raise a fault if it cannot decrypt the block
or cannot process (or understand) the decrypted block. It was not
possible with just an EncryptedData as a SOAP header.
Support for LaxTsLast Layout: LaxTsLast
(LaxTimestampLast) layout feature was not functional in WSIT till
milestone 2 (Refer security
status notes of M2). If a timestamp was inserted, it was always
on top; this is now a supported feature. By default, we always
insert Timestamp at the top of Security header in Lax and Strict
modes; in LaxTsFirst, it is ofcourse supposed to be at the top.
Is
timestamp as last element in security header useful?
If
wsu:Timestamp is the first element in security header, we can
process it first, and safely fail if the timestamp appears stale;
thus avoiding much more time consuming signature and encryption
operations. On the other hand some might say that we made a decision
on freshness of timestamp without actually verifying signature –
this is where LaxTsLast comes into picture; so that we can perform
signature verification on timestamp before checking its freshness.
Actually, it does not matter as had the timestamp been a tampered
one, we would eventually reject it during signature verification.
So, timestamp at top should be the popular choice as it provides the
option of rejecting stale messages early in the processing. Note:
WSIT always signs a wsu:Timestamp if it is included in the Security
header.
Better Policy verification of incoming messages: Policy verification for security till Milestone 2 of WSIT was very minimal (Refer security status notes of M2) and did not work when the payload of soap message was encrypted. We now have a much better support to reject messages which do not confer to the policy of the service wsdl – e.g. some targets not being signed/encrypted, correct token inclusion policy etc. One thing we still do not check is mismatch in AlgorithmSuite values between the service policy and the policy used by the client to secure the message.
Apart from these features, we have had numerous bug fixes and feature additions. Give the latest WSIT a try, and put across your feedback to users@wsit.dev.java.net.
The following features are new to the 2.0 FCS release of XWS-Security:
/xws-security/samples/jaxws2.0.optimize
on <xwss:JAXRPCSecurity> configuration element that allows
certain common security usecases to be optimized under JAXWS 2.0.<jwsdp-install-dir>/xws-security/samples/saajsecurity.
<jwsdp-install-dir>/xws-security/samples/dynamicpolicy.<xwss:Sign>
<xwss:X509Token
certificateAlias="xws-security-client"/>
<xwss:SignatureTarget
type="qname" value="SOAP-BODY"/>
</xwss:Sign>
This release includes the following XML and Web Services Security (XWS-Security) features:
This release includes samples that demonstrate the following WSS interoperability scenarios:
simple sample. swainterop sample.samlinterop
sample.<jwsdp-install-dir>/xws-security/samples/saajsecurity
for more details.