|
|
<table>
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th width="200px"><h6>[:rewind: Chapitre Précédent](/C-Compiler-et-Builder/1%5D-Dans-un-shell-via-Maven)</h6></th>
|
|
|
<th colspan="4" width="600px"><h1 align="center">D-Documentation</h1></th>
|
|
|
<th width="200px"><h6 align="right">[Chapitre Suivant :fast_forward:](/E-Lancement/1%5D-Dans-un-shell)</h6></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td> </td>
|
|
|
<td align="center">[:one:](/D-Documentation/1%5D-Projet)<br/>Projet</td>
|
|
|
<td align="center">[:two:](/D-Documentation/2%5D-API-Rest-et-Swagger)<br/>API Rest - GraphQL</td>
|
|
|
<td align="center">[:three:](/D-Documentation/3%5D-Authentification-et-habilitation)<br/>Authentification - Habilitation</td>
|
|
|
<td align="center">:white_check_mark:<br/>CORS</td>
|
|
|
<td> </td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
|
|
|
<tfoot>
|
|
|
<tr align="right">
|
|
|
<td colspan="6">
|
|
|
<h6>:copyright: 2019 - <a href="mailto:admin@ferretrenaud.fr">FERRET Renaud</a></h6>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tfoot>
|
|
|
</table>
|
|
|
|
|
|
***
|
|
|
|
|
|
# CORS - Cross-Origin Resource Sharing
|
|
|
|
|
|
Les problématiques de [Cross-Origin Resource Sharing](https://fr.wikipedia.org/wiki/Cross-origin_resource_sharing) sont en '*' côté serveur.
|
|
|
|
|
|
Donc tous les URLs clients, pour toutes les méthodes (GET, POST, PUT, ...) peuvent appeler le serveur.
|
|
|
|
|
|
Sur la branche **master** (à partir de la version *1.2.4* et les suivantes) le CORS a été complété pour :
|
|
|
* Fonctionner sur tous les navigateurs
|
|
|
* Exposer le token 'Authorization' afin qu'Angular puisse le récupérer simplement
|
|
|
|
|
|
Pour les curieux, la configuration du CORS est portée par la classe _stone.lunchtime.spring.security.AbstractSpringSecurityConfiguration_ et sa méthode (son @Bean) **corsConfigurationSource**.
|
|
|
|
|
|
# CSRF - Cross-Site Request Forgery
|
|
|
|
|
|
La problématique du [Cross-Site Request Forgery](https://fr.wikipedia.org/wiki/Cross-site_request_forgery) est désactivée par défaut.
|
|
|
|
|
|
Vous pouvez la réactiver en ajoutant le profile **csrf**lors du lancement de l'application.
|
|
|
|
|
|
Exemple : `java -jar -Dspring.profiles.active=h2,csrf stone.lunchtime.war`
|
|
|
|
|
|
Attention, si vous l'activez :
|
|
|
* il sera généré automatiquement pour chaque call de l'API (sauf /login et /logout). Il sera disponible dans le cookie sous la clef XSRF-TOKEN (il sera non sécurisé, il faudra le resécuriser avant de le renvoyer au serveur)
|
|
|
* vous pouvez aussi le récupérer à tout moment en appelant l'URL /csrf en GET. Dans cette approche, il reste sécurisé, vous avez simplement à le renvoyer au serveur
|
|
|
|
|
|
Si activé, le CSRF devra être renvoyé au serveur pour chaque requête PUT, POST, DELETE (toutes sauf GET)
|
|
|
* en tant que _parameter _de la _request _sous la clef **_csrf**
|
|
|
* **ET**
|
|
|
* en tant que _parameter _du _header _sous la clef **X-XSRF-TOKEN**
|
|
|
|
|
|
Vous trouverez un exemple dans le calls postman (dossier postman du projet).
|
|
|
|
|
|
***
|
|
|
|
|
|
<table>
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th width="200px"><h6>[:rewind: Chapitre Précédent](/C-Compiler-et-Builder/1%5D-Dans-un-shell-via-Maven)</h6></th>
|
|
|
<th colspan="4" width="600px"><h1 align="center">D-Documentation</h1></th>
|
|
|
<th width="200px"><h6 align="right">[Chapitre Suivant :fast_forward:](/E-Lancement/1%5D-Dans-un-shell)</h6></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td> </td>
|
|
|
<td align="center">[:one:](/D-Documentation/1%5D-Projet)<br/>Projet</td>
|
|
|
<td align="center">[:two:](/D-Documentation/2%5D-API-Rest-et-Swagger)<br/>API Rest - GraphQL</td>
|
|
|
<td align="center">[:three:](/D-Documentation/3%5D-Authentification-et-habilitation)<br/>Authentification - Habilitation</td>
|
|
|
<td align="center">:white_check_mark:<br/>CORS</td>
|
|
|
<td> </td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
|
|
|
<tfoot>
|
|
|
<tr align="right">
|
|
|
<td colspan="6">
|
|
|
<h6>:copyright: 2019 - <a href="mailto:admin@ferretrenaud.fr">FERRET Renaud</a></h6>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tfoot>
|
|
|
</table> |
|
|
\ No newline at end of file |