Skip to content

date: externalize the expiration code#15

Merged
greut merged 5 commits into
masterfrom
signature-v3
Oct 8, 2018
Merged

date: externalize the expiration code#15
greut merged 5 commits into
masterfrom
signature-v3

Conversation

@greut
Copy link
Copy Markdown
Contributor

@greut greut commented Oct 1, 2018

This correctly produces...

{:page 1,
 :pagesize 1,
 :command listZones,
 :apikey EXOc94bc655ff901b7218a5c3cd,
 :response json,
 :signatureVersion 3, :expires 2018-10-01T10:12:19.174Z}

but

Yoan Blanc added 2 commits October 1, 2018 12:00
Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
@greut
Copy link
Copy Markdown
Contributor Author

greut commented Oct 1, 2018

this works, but it's superbly butt ugly to work around with utc and localtime to please cloudstack.

Copy link
Copy Markdown

@chrisglass chrisglass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread src/clostack/payload.clj Outdated
Comment thread src/clostack/date.clj Outdated
(if (>= expiration 0)
{:signatureVersion "3"
;; XXX one day, cloudstack will be able to handle more formats
:expires (str (unparse-local (:date-time-no-ms formatters)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be a bit more elegant if a custom formatter was used

Comment thread src/clostack/date.clj Outdated
Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
@greut greut added the WIP 🚧 Work in progress label Oct 6, 2018
Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
@greut
Copy link
Copy Markdown
Contributor Author

greut commented Oct 8, 2018

% date
lun oct  8 09:04:35 CEST 2018

With the default expiration value.

{:page 1,
 :pagesize 1,
 :command listZones, :apikey EXO...,
 :response json,
 :signatureVersion 3,
 :expires 2018-10-08T07:14:32+0000}
`` 

@greut greut removed the WIP 🚧 Work in progress label Oct 8, 2018
Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
@greut greut merged commit 4fa9684 into master Oct 8, 2018
@pyr pyr deleted the signature-v3 branch October 22, 2018 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants