3ef995c2108fe77d22c0b556fb9717cb848bc48f
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

1) <?php
Hanno Böck Add newlines before comment...

Hanno Böck authored 1 week ago

2) 
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

3) /*
4) This file belongs to the Webinterface of schokokeks.org Hosting
5) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

6) Written by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

7)   Bernd Wurst <bernd@schokokeks.org>
8)   Hanno Böck <hanno@schokokeks.org>
9) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

10) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

11) 
12) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
13) */
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

14) 
15) require_once('inc/base.php');
16) require_once('x509.php');
17) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

18) require_role([ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT]);
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

19) 
bernd Benutze überall title() sta...

bernd authored 14 years ago

20) title('Anmeldung über Client-Zertifikat');
21) output('<p>Sie können Sie an diesem Webinterface wahlweise auch über ein SSL-Client-Zertifikat anmelden. Dazu muss das gewünschte Zertifikat <em>vorher</em> in Ihrem Browser installiert werden und kann dann hier hinzugefügt werden.</p>
bernd Typo

bernd authored 16 years ago

22) <p>Wenn Sie ein Zertifikat mit der entsprechenden Funktion unten auf dieser Seite hinzufügen, wird Sie Ihr Browser fragen, welches Zertifikat verwendet werden soll. Sollte Ihr Browser nicht fragen, ist entweder kein Zertifikat im Browser installiert oder Sie haben Ihren Browser auf <em>Niemals fragen</em> (o.Ä.) eingestellt.</p>
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

23) ');
24) 
25) 
26) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

27) if (isset($_GET['clear'])) {
28)     unset($_SESSION['clientcert_cert']);
29)     unset($_SESSION['clientcert_dn']);
30)     unset($_SESSION['clientcert_issuer']);
31)     unset($_SESSION['clientcert_serial']);
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

32) }
33) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

34) $username = null;
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

35) if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

36)     $username = $_SESSION['userinfo']['username'];
37)     if (isset($_SESSION['subuser'])) {
38)         $username = $_SESSION['subuser'];
39)     }
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

40) } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

41)     $username = $_SESSION['mailaccount'];
bernd Ermögliche Client-Cert-Logi...

bernd authored 13 years ago

42) }
43) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

44) if (isset($_SESSION['clientcert_cert'])) {
45)     // FIXME: Es gibt keine Duplikaterkennung.
46)     global $menu;
47)     output('<div style="margin: 1em; padding: 1em; border: 2px solid green;">');
48)     output('<p>Es wurde folgendes Client-Zertifikat von Ihrem Browser gesendet:</p>
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

49) <div style="margin-left: 2em;"><strong>DN:</strong> ' . filter_output_html($_SESSION['clientcert_dn']) . '<br />
50) <strong>Aussteller-DN:</strong> ' . filter_output_html($_SESSION['clientcert_issuer']) . '<br />
51) <strong>Seriennummer:</strong> ' . filter_output_html($_SESSION['clientcert_serial']) . '<br />
52) <strong>Gültigkeit:</strong> ' . filter_output_html($_SESSION['clientcert_valid_from']) . ' bis ' . filter_output_html($_SESSION['clientcert_valid_until']) . '</div>
53) <p>Soll dieses Zertifikat für den Zugang für <strong>' . $username . '</strong> verwendet werden?</p>');
54)     output(html_form('clientcert_add', 'certsave.php', 'action=new', '<p><input type="submit" name="submit" value="Ja, dieses Zertifikat einrichten" /> &#160; ' . internal_link('cert', 'Nein', 'clear') . '</p>'));
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

55)     output('</div>');
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

56) }
57) 
58) 
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

59) DEBUG($username);
bernd Cert-Login geht jetztauch m...

bernd authored 14 years ago

60) $certs = get_certs_by_username($username);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

61) if ($certs != null) {
62)     output('<p>Sie haben bereits Zertifikate für den Zugang eingerichtet.</p>
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

63)   <ul>');
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

64)     foreach ($certs as $cert) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

65)         output('<li>' . filter_output_html($cert['dn'] . ' / Seriennummer ' . $cert['serial'] . ' / ' . 'Gültig von ' . $cert['valid_from'] . ' bis ' . $cert['valid_until']) . '<br />');
66)         output('<em>ausgestellt von </em>' . filter_output_html($cert['issuer']));
67)         output('<br />' . internal_link('certsave', 'Dieses Zertifikat löschen', 'action=delete&id=' . $cert['id']));
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

68)         output('</li>');
69)     }
70)     output('</ul>');
71) } else {
72)     output('<p><em>Bisher sind keine Zertifikate für Ihren Zugang eingerichtet</em></p>');
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

73) }
74) 
bernd Bug im Client-Zertfikat-Man...

bernd authored 15 years ago

75) $backurl = 'go/index/cert';
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

76)