[Logging-commits] r81 - handlers/pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 10 13:53:53 CEST 2011
Author: mariotomo
Date: 2011-05-10 13:53:52 +0200 (Tue, 10 May 2011)
New Revision: 81
Modified:
handlers/pkg/R/sentry.R
Log:
work in progress, reflecting (trying to reflect) the new authentication mechanism in sentry.
Modified: handlers/pkg/R/sentry.R
===================================================================
--- handlers/pkg/R/sentry.R 2011-04-28 09:00:43 UTC (rev 80)
+++ handlers/pkg/R/sentry.R 2011-05-10 11:53:52 UTC (rev 81)
@@ -32,6 +32,11 @@
require(rjson))))
stop("sentryAction depends on RCurl, Ruuid, rjson.")
+ if (exists('psk', envir=conf)) {
+ if(!require(digest))
+ stop("authenticating sentryAction depends on digest.")
+ }
+
## you install Ruuid this way (not with install.packages).
## source("http://bioconductor.org/biocLite.R")
## biocLite("Ruuid")
@@ -54,7 +59,7 @@
perpretator.call <- functionCallStack[length(functionCallStack) - 4][[1]]
perpretator.name <- as.character(perpretator.call)[[1]]
view.name <- perpretator.name
- }, error = function(e) "fired at command line")
+ }, error = function(e) "<interactive>")
data <- list("level" = as.numeric(record$level),
"message" = msg,
@@ -71,5 +76,16 @@
url <- paste(sentry.server, "store", "", sep="/")
- postForm(url, style="POST", format="json", key=sentry.key, data=repr)
+ if (exists('psk', envir=conf)) {
+ ## we do not send the sentry.key but we authenticate the message
+ ## with a hmac value.
+
+ timestamp <- format(Sys.time(), "%Y-%m-%dT%X")
+ to.sign <- paste(timestamp, repr, sep=' ')
+ authentication <- hmac(with(conf, psk), to.sign, "SHA1")
+
+ postForm(url, style="POST", format="json", key=sentry.key, data=repr, authentication=authentication)
+ } else {
+ postForm(url, style="POST", format="json", key=sentry.key, data=repr)
+ }
}
More information about the Logging-commits
mailing list