additional_plugins/serendipity_event_browserid
dependabot[bot] 9eb6dd26a6 Bump squizlabs/php_codesniffer in /serendipity_event_browserid
Bumps [squizlabs/php_codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/squizlabs/PHP_CodeSniffer/releases)
- [Commits](https://github.com/squizlabs/PHP_CodeSniffer/compare/2.8.0...2.8.1)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-25 16:17:07 +02:00
..
src browserid: Move to successor project portier (#52) 2017-02-22 18:33:36 +01:00
tests browserid: Move to successor project portier (#52) 2017-02-22 18:33:36 +01:00
UTF-8 the other half of da04025 2014-11-29 15:51:17 +01:00
vendor browserid: Move to successor project portier (#52) 2017-02-22 18:33:36 +01:00
ChangeLog updated plugin versions 2021-07-12 15:44:23 +02:00
composer.json browserid: Move to successor project portier (#52) 2017-02-22 18:33:36 +01:00
composer.lock Bump squizlabs/php_codesniffer in /serendipity_event_browserid 2022-07-25 16:17:07 +02:00
documentation_cs.html line endings in czech files changed to unix style 2013-12-27 17:58:04 +01:00
documentation_cz.html line endings in czech files changed to unix style 2013-12-27 17:58:04 +01:00
lang_cs.inc.php czech translations - removed leading slash from first line (introduced erroneously in previous commit) 2013-12-28 21:43:44 +01:00
lang_cz.inc.php czech translations - removed leading slash from first line (introduced erroneously in previous commit) 2013-12-28 21:43:44 +01:00
lang_de.inc.php plugin_browserid: Language files, en and de, describing what to do (no 2012-03-25 01:38:38 +01:00
lang_en.inc.php plugin_browserid: Language files, en and de, describing what to do (no 2012-03-25 01:38:38 +01:00
LICENSE browserid: Move to successor project portier (#52) 2017-02-22 18:33:36 +01:00
phpunit.xml browserid: Move to successor project portier (#52) 2017-02-22 18:33:36 +01:00
README.md browserid: Move to successor project portier (#52) 2017-02-22 18:33:36 +01:00
S9yStore.php browserid: Move to successor project portier (#52) 2017-02-22 18:33:36 +01:00
serendipity_event_browserid.js plugin_browserid: less annoying alerts ;) 2012-03-26 03:12:20 +02:00
serendipity_event_browserid.php updated plugin versions 2021-07-12 15:44:23 +02:00

portier-php

A Portier client library for PHP

Example

<?php

require 'vendor/autoload.php';

$app = new \Slim\App();

$redis = new Redis();
$redis->pconnect('127.0.0.1', 6379);

$portier = new \Portier\Client\Client(
    new \Portier\Client\RedisStore($redis),
    'http://localhost:8000/verify'
);

$app->get('/', function($req, $res) {
    $res = $res
        ->withStatus(200)
        ->withHeader('Content-Type', 'text/html; charset=utf-8');

    $res->getBody()->write(
<<<EOF
        <p>Enter your email address:</p>
        <form method="post" action="/auth">
            <input name="email" type="email">
            <button type="submit">Login</button>
        </form>
EOF
    );

    return $res;
});

$app->post('/auth', function($req, $res) use ($portier) {
    $authUrl = $portier->authenticate($req->getParsedBodyParam('email'));

    return $res
        ->withStatus(303)
        ->withHeader('Location', $authUrl);
});

$app->post('/verify', function($req, $res) use ($portier) {
    $email = $portier->verify($req->getParsedBodyParam('id_token'));

    $res = $res
        ->withStatus(200)
        ->withHeader('Content-Type', 'text/html; charset=utf-8');

    $res->getBody()->write(
<<<EOF
        <p>Verified email address ${email}!</p>
EOF
    );

    return $res;
});

$app->run();