RCurl et authentification CAS

Postez ici vos questions, réponses, commentaires ou suggestions - Les sujets seront ultérieurement répartis dans les archives par les modérateurs

Modérateur : Groupe des modérateurs

jean lobry
Messages : 733
Enregistré le : 17 Jan 2008, 20:00
Contact :

RCurl et authentification CAS

Messagepar jean lobry » 13 Nov 2017, 19:09

Bonjour à tous,

je galère pour importer dans R une bête page web sise sur l'intranet de notre université et protégée par une authentification CAS.

Mais avant de pleurer, ce qui va bien. Il y a un très bon article de Duncan Temple Lang dans The Journal of Statistical Software intitulé «R as a Web Client – the RCurl package» qui débroussaille bien le terrain. Et effectivement ça marche, quand je fais ça :

Code : Tout sélectionner

library("RCurl")
x <- getURL("http://pbil.univ-lyon1.fr/gestion_pedadoc_svn/", userpwd = "XXX:YYY")


Je retrouve bien en faisant un cat(x) le code source de la page que nous avons sécurisée avec un simple .htaccess. Mais ça ne marche plus du tout quand j'essaye d'accéder à la page qui m'intéresse avec :

Code : Tout sélectionner

myURL <- "https://tomusss.univ-lyon1.fr/2016/Automne/extract/UE-BIO1004L:Seq"
y <- getURL(myURL, userpwd = "WWW:ZZZ", verbose = TRUE,
  followlocation = TRUE, ssl.verifyhost = FALSE, ssl.verifypeer = FALSE)


Un cat(y) me donne le code de la page d'authentification, pas celui qui m'intéresse.

Je suis preneur de toute piste !

Bien amicalement,

jean lobry

P.-S. Quelques compléments techniques.

Voici le détail des messages obtenus avec l'option verbeuse activée :

Code : Tout sélectionner

*   Trying 134.214.128.39...
* TCP_NODELAY set
* Connected to tomusss.univ-lyon1.fr (134.214.128.39) port 443 (#0)
* WARNING: disabling hostname validation also disables SNI.
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: tomuss.univ-lyon1.fr
* Server certificate: TERENA SSL High Assurance CA 3
* Server certificate: DigiCert High Assurance EV Root CA
> GET /2016/Automne/extract/UE-BIO1004L:Seq HTTP/1.1
Host: tomusss.univ-lyon1.fr
Accept: */*

< HTTP/1.1 307 Temporary Redirect
< Server: nginx/1.6.2
< Date: Mon, 13 Nov 2017 19:01:58 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< Location: https://cas.univ-lyon1.fr/cas/login?service=https://tomusss.univ-lyon1.fr/2016/Automne/extract/UE-BIO1004L:Seq?unsafe=1
<
* Ignoring the response-body
* Connection #0 to host tomusss.univ-lyon1.fr left intact
* Issue another request to this URL: 'https://cas.univ-lyon1.fr/cas/login?service=https://tomusss.univ-lyon1.fr/2016/Automne/extract/UE-BIO1004L:Seq?unsafe=1'
*   Trying 134.214.126.157...
* TCP_NODELAY set
* Connected to cas.univ-lyon1.fr (134.214.126.157) port 443 (#1)
* WARNING: disabling hostname validation also disables SNI.
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: cas.univ-lyon1.fr
* Server certificate: TERENA SSL High Assurance CA 3
* Server certificate: DigiCert High Assurance EV Root CA
> GET /cas/login?service=https://tomusss.univ-lyon1.fr/2016/Automne/extract/UE-BIO1004L:Seq?unsafe=1 HTTP/1.1
Host: cas.univ-lyon1.fr
Accept: */*

< HTTP/1.1 200 OK
< Server: nginx/1.8.1
< Date: Mon, 13 Nov 2017 19:01:59 GMT
< Content-Type: text/html;charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: no-store
< Pragma:
< Expires:
< Strict-Transport-Security: max-age=15768000 ; includeSubDomains
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< Set-Cookie: JSESSIONID=[...censuré...]; Path=/cas/; Secure; HttpOnly
<
* Connection #1 to host cas.univ-lyon1.fr left intact


Et les informations de ma session :

Code : Tout sélectionner

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RCAS_0.1       httr_1.3.1     RCurl_1.95-4.8 bitops_1.0-6   MASS_7.3-47   
[6] rgl_0.98.1     ade4_1.7-8     seqinr_3.4-5 

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.11    knitr_1.17      xml2_1.1.1      magrittr_1.5   
 [5] devtools_1.13.4 xtable_1.8-2    R6_2.2.2        tools_3.4.1   
 [9] git2r_0.19.0    withr_2.1.0     htmltools_0.3.6 digest_0.6.12 
[13] shiny_1.0.5     htmlwidgets_0.9 curl_2.7        memoise_1.1.0 
[17] mime_0.5        compiler_3.4.1  jsonlite_1.5    httpuv_1.3.5   

Retourner vers « Questions en cours »

Qui est en ligne

Utilisateurs parcourant ce forum : Google [Bot] et 1 invité