authserver/README.md
author rougeronj
Mon, 07 Sep 2015 16:25:09 +0200
changeset 98 e00c89006e9a
parent 82 bf1c38268e25
permissions -rw-r--r--
add new option to allow enter a tag through an input box rather than button. Adapt css to the new input box
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     1
# Authentication test env for Remie
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     2
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     3
## prerequisite
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     4
- php >= 5.4
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     5
- Laravel requirements :
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     6
    + Mcrypt PHP Extension
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     7
    + OpenSSL PHP Extension
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     8
    + Mbstring PHP Extension
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     9
    + Tokenizer PHP Extension
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    10
- docker (+boot2docker for OSX)
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    11
- node + npm ( or iojs + npm)
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    12
- jdk >= 7
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    13
- maven
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    14
e25add38aab5 add cas.war to avoid unnecessary prerequisites
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    15
Autre solution : utiliser Homestead : http://laravel.com/docs/5.0/homestead
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
## CAS server
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    18
If using boot2docker:
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    19
```shell
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    20
boot2docker init
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    21
boot2docker up
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    22
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    23
82
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 8
diff changeset
    24
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.
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 8
diff changeset
    25
If you use homestead, the certificates used are in /etc/nginx/ssl/. You will need to use the following command:
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 8
diff changeset
    26
```shell
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 8
diff changeset
    27
openssl x509 -in homestead.app.crt -out homestead.app.der -outform DER
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 8
diff changeset
    28
```
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 8
diff changeset
    29
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
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 8
diff changeset
    30
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
```shell
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
mvn clean package
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
docker build -t iri-research/cas-basic .
82
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 8
diff changeset
    34
docker run -p 8080:8080 -p 8443:8443 --add-host homestead.app:192.168.10.10 -d iri-research/cas-basic
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    35
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    36
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    37
## LDT
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    38
For testing with runserver:
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    39
```shell
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    40
python manage.py runserver 0.0.0.0:8001
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
```
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    42
Edit config.py according to config.py.tmpl:
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    43
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    44
    CAS_SERVER_URL = "https://192.168.59.103:8443/cas/"
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    45
    CAS_IGNORE_REFERER = True
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    46
    CAS_REDIRECT_UTL = "/ldt/"
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    47
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    48
Note: for CAS_SERVER_URL, the ip address is the IP of the docker container. If using boot2docker it's given to you after "boot2docker up".
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    49
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    50
Add the following line to the /etc/hosts file of the machine running the LDT platform:
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    51
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    52
    192.168.10.10 homestead.app
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
## Client server
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
```shell
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
curl -sS https://getcomposer.org/installer | php
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
php composer.phar install
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
cp .env.example .env
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    59
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    60
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    61
edit .env to match environement:
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    62
* LDT_URL is http://192.168.x.x:8001 (assuming you ran runserver on port 8001), the ip adress is the one of the machine running ldt as seen on your local network. On mac it can be found using the Apple menu > System Preferences > Network
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    63
* For testing purposes: TEST_PROJECT_ID is the id of a project that was created for user casuser and unpublished. Its json data will be displayed on the Laravel home view to show the results of the CAS proxy authentication process.
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    64
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    65
```shell
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
npm install
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
./node_modules/.bin/gulp
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
php artisan serve
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
```
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    70
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    71
### If using Homestead
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    72
Instead of the above commands you just have to edit the .env and boot the vm to start the Laravel app
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    73
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    74
vagrant up
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    75
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    76
The code is located in /home/vagrant/Code
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    77
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    78
The vm will be accessible on ip 192.168.10.10, you can change it by editing the homestead/conf/homestead.yaml file. NOTE: if you change it then when running the docker container you have the change the add-host option accordingly and the /etc/hosts file of the machine running the LDT platform.
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    79
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    80
## Using the app
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    81
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    82
The app is accessible on the hostname homestead.app.