No Description

Fabian Peter Hammerle 076e868248 composer.json: added keywords and license 7 years ago
migrations 82e7d6164f adapt name of migration to create subject table 7 years ago
tests a450dba704 fix autoload by removing static entry for Yii.php; 7 years ago
.gitignore ab9451933e init dummy 7 years ago
.travis.yml 15e79ea2d3 phpunit: use executable in vendor/bin 7 years ago
Authenticator.php ee6b9677d9 removed dependency on fphammerle\helpers in production 7 years ago
LICENSE ab9451933e init dummy 7 years ago
README.md 24d07a9386 readme: added example how to register cert 7 years ago
Subject.php b9a991c9fb Subject findByDistinguishedName(): added missing static keyword 7 years ago
composer.json 076e868248 composer.json: added keywords and license 7 years ago
phpunit.xml a450dba704 fix autoload by removing static entry for Yii.php; 7 years ago

README.md

PHP version Build Status

yii2 extension for automatic login via TLS/SSL/HTTPS client certificates

Setup

1. Configure Webserver

apache

<VirtualHost example.hammerle.me:443>
    # ...

    SSLEngine on
    SSLCertificateFile /etc/somewhere/example-server-cert.pem
    SSLCertificateKeyFile /etc/restricted/example-server-key.pem

    SSLVerifyClient optional
    SSLVerifyDepth 1
    SSLCACertificateFile /etc/somewhere/example-client-cert-ca.pem
    SSLOptions +StdEnvVars
</VirtualHost>

2. Install Extension

composer require fphammerle/yii2-client-cert-auth

3. Create Table

./yii migrate --migrationPath=./vendor/fphammerle/yii2-client-cert-auth/migrations

4. Enable Extension in Yii's Application Config

$config = [
    // ...
    'bootstrap' => ['clientCertAuth'],
    'components' => [
        // ...
        'clientCertAuth' => \fphammerle\yii2\auth\clientcert\Authenticator::className(),
    ],
    // ...
];

5. Register Client Certificates

$subj = new \fphammerle\yii2\auth\clientCert\Subject;
$subj->identity = \Yii::$app->user->identity;
$subj->distinguished_name = "CN=Fabian,C=AT";
$subj->save();