Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
authordurandn
Fri, 28 Aug 2015 16:00:19 +0200
changeset 82 bf1c38268e25
parent 81 24cf59559959
child 83 451521e9f742
Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
authserver/README.md
authserver/casserver/homestead.app.der
authserver/testCAS/app/Http/Controllers/HomeController.php
authserver/testCAS/resources/views/home.blade.php
server/README.md
server/src/remieplt/settings/__init__.py
server/src/remieplt/settings/dev.py.tmpl
--- a/authserver/README.md	Fri Aug 28 15:55:36 2015 +0200
+++ b/authserver/README.md	Fri Aug 28 16:00:19 2015 +0200
@@ -21,10 +21,17 @@
 boot2docker up
 ```
 
+You will need to import the SSL Certificate of your homestead/virtual machine into the CAS server so it can recognize it when logging a user.
+If you use homestead, the certificates used are in /etc/nginx/ssl/. You will need to use the following command:
+```shell
+openssl x509 -in homestead.app.crt -out homestead.app.der -outform DER
+```
+to generate a der formatted file called homestead.app.der. You'll have to extract this file out of the homestead machine and put it in the /remie/casserver folder so that Docker can find it and put it in the CAS server keystore
+
 ```shell
 mvn clean package
 docker build -t iri-research/cas-basic .
-docker run -p 8080:8080 -p 8443:8443 --addhost homestead.app:192.168.10.10 -d iri-research/cas-basic
+docker run -p 8080:8080 -p 8443:8443 --add-host homestead.app:192.168.10.10 -d iri-research/cas-basic
 ```
 
 ## LDT
Binary file authserver/casserver/homestead.app.der has changed
--- a/authserver/testCAS/app/Http/Controllers/HomeController.php	Fri Aug 28 15:55:36 2015 +0200
+++ b/authserver/testCAS/app/Http/Controllers/HomeController.php	Fri Aug 28 16:00:19 2015 +0200
@@ -34,16 +34,13 @@
     public function index()
     {
         $pt="Error getting PT";
-        $pt=phpCAS::retrievePT(env("LDT_URL")."/api/ldt/1.0/projects/".env("TEST_PROJECT_ID")."/?format=json", $err_code, $err_msg);
-        $ch=curl_init(env("LDT_URL")."/api/ldt/1.0/projects/".env("TEST_PROJECT_ID")."/?format=json&casticket=".$pt);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-        $proxiedRequestResponse=curl_exec($ch);
-        curl_close($ch);
+        $pt=phpCAS::retrievePT(env("LDT_URL")."/remie/workunit/segments_single?project_id=".env("TEST_PROJECT_ID"), $err_code, $err_msg);
+        $iframe_url=env("LDT_URL")."/remie/workunit/segments_single?project_id=".env("TEST_PROJECT_ID")."&casticket=".$pt;
 
         $loginUrl=env("LDT_URL")."/accounts/cas/login";
 
         return view('home')->with(
-          array("pt" => $pt, "err_code" => $err_code, "err_msg" => $err_msg, "proxiedRequestResponse" => $proxiedRequestResponse, 'loginUrl' => $loginUrl)
+          array("pt" => $pt, "err_code" => $err_code, "err_msg" => $err_msg, "iframe_url" => $iframe_url, 'loginUrl' => $loginUrl)
         );
     }
 
--- a/authserver/testCAS/resources/views/home.blade.php	Fri Aug 28 15:55:36 2015 +0200
+++ b/authserver/testCAS/resources/views/home.blade.php	Fri Aug 28 16:00:19 2015 +0200
@@ -1,17 +1,18 @@
 @extends('app')
 
 @section('content')
-<div class="container">
-	<div class="row">
-		<div class="col-md-10 col-md-offset-1">
-			<div class="panel panel-default">
-				<div class="panel-heading">Home</div>
+<div class="container" style="width: 1500px">
+	<div class="row" style="width: 1500px">
+		<div class="col-md-10 col-md-offset-1" style="width: 1300px">
+			<div class="panel panel-default" style="width: 1300px">
+				<div class="panel-heading" style="width: 1300px">Home</div>
 
-				<div class="panel-body">
+				<div class="panel-body" style="width: 1300px">
+					{{{$iframe_url}}}
 					You are logged in! <br>
 					As: {{ Cas::getCurrentUser() }}<br><br>
 					<a href="{{{ $loginUrl }}}">Se connecter à Lignes de Temps</a><br><br>
-					{{{ $proxiedRequestResponse }}}<br><br>
+					<iframe  width="1250" height="625" src="{{{ $iframe_url }}}"></iframe><br><br>
 					@unless($err_code == 0)
 						There was an error making the proxied request: <br>
 						Code {{{$err_code}}} : {{{$err_msg}}}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/README.md	Fri Aug 28 16:00:19 2015 +0200
@@ -0,0 +1,63 @@
+# Accès aux vues scénario
+
+Pour générer une vue de scénario, il suffit d'appeler les url suivantes en source d'une iframe. Les url contiennent : 
+
+* un identifiant de projet d’annotation (voir ci-dessus pour récupérer manuellement l’identifiant d’un projet)
+* un ticket d’authentification CAS
+
+### Scénario élève/annotation de segment en mode individuel
+
+    https://appiri.enteduc.fr/remie/remie/workunit/segments_single?project_id=<:id>&casticket=<:ticket> 
+
+* <:id> est l'id du projet considéré
+* <:ticket> est le ticket d'authentification CAS 
+
+### Scénario élève/annotation de segment en mode groupe    
+
+    https://appiri.enteduc.fr/remie/remie/workunit/segments_group?project_id=<:id>&group_mode=true&casticket=<:ticket>
+
+* <:id> est l'id du projet considéré
+* <:ticket> est le ticket d'authentification CAS
+Note: Le nom du paramètre du ticket CAS (par défaut “casticket”) est configurable de notre côté, si jamais il ne respecte pas les conventions de nommage d’Itop.
+
+### Scénario professeur
+(à implémenter)
+
+### Scénario “marqueurs”
+(à implémenter)
+
+# Dupliquer un projet existant lors de l’instanciation d’un grain:
+
+Un endpoint de l’API permet de dupliquer un projet existant. Pour cela il faut faire une requête POST à l’adresse suivante: 
+
+    https://appiri.enteduc.fr/remie/api/ldt/1.0/projects?format=json&source=<:project_id>&publish=true&casticket=<:ticket>
+
+* <:ticket> est le ticket d'authentification CAS
+* <:project_id>: L’id du projet que l’on souhaite dupliquer
+
+La requête POST doit être accompagnée de données sous la forme d’une chaîne de caractère de type json, selon le format suivant: 
+
+	{
+	“meta”: { 
+	“dc:creator”: “<:user>”,
+	“dc:contributor”: “<:user>”,
+	“dc:title”: “<:title>”, 
+	“dc:description”: “<:description>”, 
+	"dc:created": "",
+	            "dc:modified": "",
+	            "dc:description": "",
+	            "iricle:status": 2'
+	},  
+	"views": [],
+	"lists": [],
+	"annotation-types": [],
+	"medias": [],
+	"tags": [],
+	"annotations": []
+	}
+
+* <:user>: L’utilisateur considéré comme “créateur” du nouveau projet. Cet utilisateur doit avoir accès en lecture au projet d’origine
+* <:title>: Le titre que prendra la copie du projet dupliqué (optionnel, prendra le même titre que le projet initial si non-renseigné)
+* <:description> : La description que prendea la copie du projet dupliqué (optionnelle, prendra le même titre que le projet initial si non-renseigné)
+
+Dans la réponse à cette requête POST, le header “Location” contient l’URL à requêter (GET) pour obtenir les informations sur le projet créé. Il est possible d’en extraire l’id du projet afin de générer les scénario.
--- a/server/src/remieplt/settings/__init__.py	Fri Aug 28 15:55:36 2015 +0200
+++ b/server/src/remieplt/settings/__init__.py	Fri Aug 28 16:00:19 2015 +0200
@@ -72,7 +72,6 @@
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
-    'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'django.middleware.security.SecurityMiddleware',
     'ldt.ldt_utils.middleware.swfupload.SWFUploadMiddleware',
     'ldt.ldt_utils.middleware.userprofile.LanguageMiddleware',
--- a/server/src/remieplt/settings/dev.py.tmpl	Fri Aug 28 15:55:36 2015 +0200
+++ b/server/src/remieplt/settings/dev.py.tmpl	Fri Aug 28 16:00:19 2015 +0200
@@ -160,3 +160,7 @@
         'INDEX_NAME': 'ldt',
     },
 }
+
+CAS_SERVER_URL = ""
+CAS_IGNORE_REFERER = True
+CAS_REDIRECT_URL = "/"