Yes,

The cookies comes through correctly, but, since the second one has the same 
name as the first one, it gets rewritten. This means the cookie will still 
expire when the user closes the browser.

Sergio Restrepo | VP Architecture | Yuxi Pacific Group
Office: +1 (786) 623 5517
Mobile: +1 (484) 598 3729
Skype: yuxi-sergio
http://www.yuxipacific.com/

On Aug 29, 2013, at 1:39 AM, Geert Josten <[email protected]> wrote:

> Hi Sergio,
>  
> Did you check what the effect is on client-side when you apply your function 
> with for instance firebug?
>  
> Also, there are two helper libraries for handling 
> cookies:https://github.com/marklogic/commons/tree/master/http Not that they 
> will likely make much difference, but at least wanted to mention them..
>  
> Kind regards,
> Geert
>  
> Van: [email protected] 
> [mailto:[email protected]] Namens Sergio Restrepo
> Verzonden: woensdag 28 augustus 2013 23:31
> Aan: MarkLogic Developer Discussion
> Onderwerp: [MarkLogic Dev General] Session cookie manipulation
>  
> Hello,
>  
> We are using MarkLogic to authorize certain clients to access a RESTful API. 
> Basically, we use a login endpoint that uses xdmp:login to authenticate the 
> user. When the authentication is successful, MarkLogic server returns a 
> cookie named SessionID that has no expiration date. Basically, what this 
> means is that this cookie will expire once the client app is closed.
>  
> We want this cookie to expire some time in the future (say, a year from now), 
> and not with the client session. We tried setting the expiration date, like 
> so:
>  
> declare function getCookies() as item()*
> {
>    
>  
>     let $name := "SessionID"
>     let $value := "0e39adb6c619ec01"
>     let $expires := 
> get-cookie-date-string(fn:dateTime(xs:date(fn:current-dateTime()) + 
> xs:dayTimeDuration('P1D'),fn:current-time()))
>     let $path := "/"
>     let $domain  := "my.domain"
>     let $secure := xs:boolean("false")
>     
>     let $cookie := fn:concat(xdmp:url-encode($name), "=", 
> xdmp:url-encode($value))
>     let $cookie := fn:concat($cookie, "; expires=", "Wed, 09 Jun 2021 
> 10:18:14 GMT") 
>     let $cookie := fn:concat($cookie, "; domain=", $domain)
>     let $cookie := fn:concat($cookie, "; path=", $path)
>     let $cookie := fn:concat($cookie, "; secure")
>     return xdmp:add-response-header("Set-Cookie", $cookie)
>     
> };
>  
>  
>  
> With no success. I believe it is because the cookie header with the modified 
> date is sent before the cookie header that marklogic is setting 
> automatically. Now, I need a way to either:
>  
> a) Send the cookie with the modified date after the default cookie has been 
> sent
> b) Change the way MarkLogic is sending the session cookie so that it has an 
> expiration date in the future.
>  
> Any ideas would be appreciated.
>  
> Sergio Restrepo | VP Architecture | Yuxi Pacific Group
> Office: +1 (786) 623 5517
> Mobile: +1 (484) 598 3729
> Skype: yuxi-sergio
> http://www.yuxipacific.com/
>  
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to