authserver/README.md
author ymh <ymh.work@gmail.com>
Sun, 19 Jul 2015 19:51:26 +0200
changeset 31 3f1921b29145
parent 8 5a0cbbe0922a
child 82 bf1c38268e25
permissions -rw-r--r--
Added tag 00.00.04 for changeset c27522a812f3
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
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
```shell
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
mvn clean package
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
docker build -t iri-research/cas-basic .
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    27
docker run -p 8080:8080 -p 8443:8443 --addhost homestead.app:192.168.10.10 -d iri-research/cas-basic
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    28
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    29
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    30
## LDT
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    31
For testing with runserver:
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    32
```shell
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    33
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
    34
```
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    35
Edit config.py according to config.py.tmpl:
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
    CAS_SERVER_URL = "https://192.168.59.103:8443/cas/"
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    38
    CAS_IGNORE_REFERER = True
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    39
    CAS_REDIRECT_UTL = "/ldt/"
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    40
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    41
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
    42
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    43
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
    44
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    45
    192.168.10.10 homestead.app
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
## Client server
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
```shell
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
curl -sS https://getcomposer.org/installer | php
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
php composer.phar install
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
cp .env.example .env
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    52
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    53
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    54
edit .env to match environement:
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    55
* 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
    56
* 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
    57
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    58
```shell
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
npm install
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
./node_modules/.bin/gulp
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
php artisan serve
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
```
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    63
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    64
### If using Homestead
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    65
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
    66
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    67
vagrant up
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    68
```
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    69
The code is located in /home/vagrant/Code
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
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
    72
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    73
## Using the app
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    74
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 1
diff changeset
    75
The app is accessible on the hostname homestead.app.