Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/italia/spid-testenv2
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorelli986 committed Aug 29, 2018
2 parents b75a1ea + 652beca commit d02c5fd
Show file tree
Hide file tree
Showing 31 changed files with 3,006 additions and 1,557 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ Alternativamente alla procedura di installazione manuale riportata sopra, è pos

Alternativamente alla procedura di installazione manuale è possible installare ed eseguire l'Identity Provider di test usando l'immagine presente su [Docker Hub](https://hub.docker.com/).

Per ottenere la persistenza della configurazione è necessario creare nell'host una directory. Tale directory sarà mappata in `conf/` all'interno del container.
Per ottenere la persistenza della configurazione è necessario creare nell'host una directory, da collocarsi in un percorso a piacere (di seguito un suggerimento). Tale directory sarà mappata in `conf/` all'interno del container.

```
mkdir /path/to/testenv/conf
mkdir /etc/spid-testenv2
```

Creare nella directory il file config.yaml e la coppia chiave/certificato per l'IdP, nonché eventuali metadata SP, come indicato nel paragrafo successivo.

Creare il container con il seguente comando:

```
docker create --name spid-testenv2 -p 8088:8088 \
--mount src="/path/to/testenv/conf",target="/app/conf",type=bind \
docker create --name spid-testenv2 -p 8088:8088 --restart=always \
--mount src="/etc/spid-testenv2",target="/app/conf",type=bind \
italia/spid-testenv2
```

Expand All @@ -75,22 +75,22 @@ Avviare il container:
docker start spid-testenv2
```

Il log si può visualizzare con il comando:

```
docker logs -f spid-testenv2
```

## Configurazione

(In caso di installazione via Docker, sostituire `conf/` nei seguenti comandi con il percorso alla directory di configurazione creata nell'host.)

Generare una chiave privata ed un certificato.

### Versione Docker
```
openssl req -x509 -nodes -sha256 -subj '/C=IT' -newkey rsa:2048 -keyout conf/idp.key -out conf/idp.crt
```

### Versione manuale
```
openssl req -x509 -nodes -sha256 -subj '/C=IT -newkey rsa:2048 -keyout idp.key -out idp.crt
```



Creare e configurare il file config.yaml.

```
Expand All @@ -111,7 +111,7 @@ python spid-testenv.py

## Home page

Nella home page è presente una lista di Service Providers registrati sull'IdP di test.
Nella home page è presente la lista dei Service Providers registrati sull'IdP di test.

## Metadata IdP

Expand Down
2 changes: 1 addition & 1 deletion conf/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# URL da usare per generare l'entityID dell'IdP e gli URL degli endpoint
# SAML indicati nel metadata dell'IdP
base_url: "https://localhost"
base_url: "http://localhost:8088"

# Chiave e certificato necessari per la firma dei messaggi SAML
key_file: "./conf/idp.key"
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PyYAML==3.12
passlib==1.7.1
lxml==4.2.3
Faker==0.8.16
exrex

exrex==0.10.5
voluptuous==0.11.5
importlib-resources==1.0.1
signxml==2.5.2
1 change: 1 addition & 0 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ mock
freezegun
pytest
coverage
BeautifulSoup4
8 changes: 7 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
[flake8]
exclude = *.egg-info
max-line-length = 119

[isort]
line_length = 79
line_length = 119
combine_as_imports = true
default_section = THIRDPARTY
include_trailing_comma = true
known_first_party = testenv
multi_line_output = 5
not_skip = __init__.py

[tool:pytest]
filterwarnings = default
1 change: 1 addition & 0 deletions templates/admin_area_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ <h1 class="display-3">Spid Idp Test</h1>
</li>
<li class="nav-item"><a class="nav-link" href="/users"><span>Utenti</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="/metadata"><span>Metadata IdP</span></a></li>
</ul>
</div>
</div>
Expand Down
25 changes: 25 additions & 0 deletions templates/form_http_post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body onload="document.forms[0].submit()">
<noscript>
<p>
<strong>Note:</strong> Il tuo browser non supporta JavaScript,
premi il tasto Continua per procedere.
</p>
</noscript>
<form action="{{action}}" method="post">
<div>
<input type="hidden" name="RelayState" value="{{relay_state}}"/>
<input type="hidden" name="{{message_type}}" value="{{message}}"/>
</div>
<noscript>
<div>
<input type="submit" value="Continua"/>
</div>
</noscript>
</form>
</body>
</html>
40 changes: 17 additions & 23 deletions templates/spid_error.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
{% extends 'main_page.html' %}
{% block content %}
<button name="show_response" class="u-padding-all-s u-text-xs u-textWeight-600 u-borderRadius-m u-sizeFull u-btn u-btn-quaternary">Mostra Request</button>
<div id="message">
{% for line in lines %}
<pre class="xml-line">{{line}}</pre>
{% endfor %}
</div>
<table border=1>
<thead>
<tr>
<th>Elemento</th>
<th>Dettagli errore</th>
</tr>
</thead>
<tbody>
{% for err in errors %}
<h2>Errori di validazione</h2>
{% if errors %}
<table class="spid-error" border=1>
<thead>
<tr>
<td class="spid-error__elem" id="{{err.1}}">{{err.1}}</td>
<th>Elemento</th>
<th>Dettagli errore</th>
</tr>
</thead>
<tbody>
{% for err in errors %}
<tr>
<td class="spid-error__elem" id="{{err.path}}">{{err.path}}</td>
<td>
<ul>
{% for name, msgs in err.2.items() %}
<li>{{name}}
<ul>
{% for type, msg in msgs.items() %}
<li>{{msg|safe}}</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{{err.value}} {{err.message}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</tbody>
</table>
{% endif %}
{% endblock %}
{% block js %}
<script type="text/javascript">
Expand Down
33 changes: 22 additions & 11 deletions templates/users.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
{% extends 'admin_area_base.html' %}
{% block content %}
<article class="main-bodytext u-padding-all-xl">
<h1 class="mt-2 mb-5 text-center">Lista utenti</h1>
<h1 class="mt-2 mb-5 text-center">Utenti SPID</h1>

<ul class="u-margin-bottom-xl u-margin-top-xl">
{% for user, info in users.items() %}
<li class="u-color-grey-60 u-textWeight-600 u-lineHeight-xl u-margin-bottom-xs">{{user}}
{% for attr, value in info.items() %}
{{attr}} - {{value}}<br>
<table class="table table-striped">
<tr>
<th>Username</th>
<th>Password</th>
<th>SP</th>
<th>Attributes</th>
</tr>
{% for user, info in users.items() %}
<tr>
<td>{{user}}</td>
<td>{{info.pwd}}</td>
<td>{{info.sp if info.sp != None else 'tutti'}}</td>
<td>
{% for attr, value in info.attrs.items() %}
{{attr}}: <b>{{value}}</b></br>
{% endfor %}
</li>
{% endfor %}
</ul>

</td>
</tr>
{% endfor %}
</table>
</article>

<article class="main-bodytext u-padding-all-xl">
<h1 class="mt-2 mb-5 text-center">Crea nuovo utente</h1>
<form class="Form Form--spaced u-margin-bottom-l" name="add_user" method="post" action="{{action}}">
Expand Down Expand Up @@ -41,7 +52,7 @@ <h3 class="u-text-r-xs u-lineHeight-l u-color-grey-40 u-textWeight-800">Credenzi
{% endfor %}
</select>
<label for="service_provider">
Service provider id
Service Provider
</label>
</div>
<h3 class="u-text-r-xs u-lineHeight-l u-color-grey-40 u-textWeight-800">Attributi Primari</h3>
Expand Down
42 changes: 0 additions & 42 deletions testenv/attributemaps/spid_attributes.py

This file was deleted.

Loading

0 comments on commit d02c5fd

Please sign in to comment.