Christina,
 
applied in SVN.
 
Thanks,
Werner


Von: Christian Müller [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 17. Januar 2006 16:39
An: Dittmann, Werner
Cc: [email protected]
Betreff: Re: WSS-26 - "Expires" element required when it should be optional

Hi Werner!

Maybe, i can help you:

This patch contain:
In org.apache.ws.security.message.token.Timestamp, the instance variables elementCreated and elementExpires should be local variables.
In org.apache.ws.security.message.token.Timestamp , the instance variables created and expires are set in the constructor Timestamp(boolean, doc, int).
In org.apache.ws.security.message.token.Timestamp, i created a method getCurrentTime() for better testing.

Regards,
Christian

On 1/17/06, Dittmann, Werner <[EMAIL PROTECTED]> wrote:
Christian,
 
I see what you mean - well, it's not intended but nobody complaint about it :-).
 
In fact these fields are not initialized during setup of the Timestamp element. I'll
change that and check it in, pls give me a day or two.
 
Regards,
Werner


Von: Christian Müller [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 16. Januar 2006 23:37
An: Werner Dittmann
Cc: Dittmann, Werner; [email protected]
Betreff: Re: WSS-26 - "Expires" element required when it should be optional

Hi Werner!

My "problem" is the inconsistency creation of the Timestamp Object. If you use
new Timestamp(element);the created and expires properties in the Timestamp object are set, if it exists. If you use
new Timestamp(boolean, doc, int); the created and expires properties in the Timestamp object are never set, but in the
wsu:Timestamp element, they are set.

<wsu:Timestamp xmlns:wsu=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <wsu:Created xmlns:wsu=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2006-01-16T22:35:26Z</wsu:Created>
   <wsu:Expires xmlns:wsu=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2006-01-16T22:40:26Z</wsu:Expires>
</wsu:Timestamp>

Is that intended?

Regards,
Christian

On 1/16/06, Werner Dittmann <[EMAIL PROTECTED]> wrote:
Christian,

what's the problem here? At the client side its perfectly legal
to generate the timestamp with both fields. "Oprional" means you
can create it or you can leave it. WSS4J tooks the option to always
generate it - absolutly perfect with the specification.

At the receiver end the receiver shall be prpared that another
client does not generate an expires field and act accordingly.

If you woul like a client where you can control the generation
of optional fields then we have to introduce quite a lot of
additional control parameters. Therefore we usually generate
optional fields.

Regards,
Werner


Christian Müller wrote:
> Hi Werner!
>
> My Testclass for org.apache.ws.security.message.token.Timestamp fails:
>
>     public void testTimestampBooleanDocumentInt() {
>         Timestamp timestamp = new Timestamp(false, this.doc , 300);
>
>         assertNotNull(timestamp.getCreated()); // fail
>         assertNotNull(timestamp.getExpires ()); // fail
>
>         Element timestampElement = timestamp.getElement();
>         assertEquals(WSConstants.WSU_PREFIX + ":" +
> WSConstants.TIMESTAMP_TOKEN_LN , timestampElement.getTagName());
>         assertEquals(WSConstants.WSU_NS,
> timestampElement.getNamespaceURI ());
>
>         Element createdElement = (Element) timestampElement.getFirstChild();
>         assertEquals(WSConstants.WSU_PREFIX + ":" +
> WSConstants.CREATED_LN, createdElement.getTagName ());
>         assertEquals(WSConstants.WSU_NS, createdElement.getNamespaceURI());
>         // TODO: refactor Timestamp -> externalize 'Calendar rightNow =
> Calendar.getInstance();' in a separat method 'getRightNow()' for better
> testing.
>         // Test-Subclass can override getRightNow() and return a
> constant value...
>         assertNotNull(((Text) createdElement.getFirstChild()).getData());
>
>         Element expiresElement = (Element) createdElement.getNextSibling();
>         assertEquals(WSConstants.WSU_PREFIX + ":" +
> WSConstants.EXPIRES_LN, expiresElement.getTagName());
>         assertEquals(WSConstants.WSU_NS , expiresElement.getNamespaceURI ());
>         // TODO: If the Test-Subclass return a constant value for
> created, we can calculate and test expires...
>         assertNotNull(((Text) expiresElement.getFirstChild()).getData());
>     }
>
> Are you interested on the Testclass and/or the fix?
>
> Regards,
> Christian



Reply via email to