Browse Source

use only indieauth login flow

closes #4
pull/13/head
Aaron Parecki 6 years ago
parent
commit
df7e99470b
No known key found for this signature in database GPG Key ID: 276C2817346D6056
3 changed files with 94 additions and 102 deletions
  1. +2
    -11
      compass/app/Http/Controllers/IndieAuth.php
  2. +1
    -1
      compass/composer.json
  3. +91
    -90
      compass/composer.lock

+ 2
- 11
compass/app/Http/Controllers/IndieAuth.php View File

@ -33,13 +33,11 @@ class IndieAuth extends BaseController
} else {
$authorizationEndpoint = \IndieAuth\Client::discoverAuthorizationEndpoint($me);
$tokenEndpoint = \IndieAuth\Client::discoverTokenEndpoint($me);
session([
'auth_state' => $state,
'attempted_me' => $me,
'authorization_endpoint' => $authorizationEndpoint,
'token_endpoint' => $tokenEndpoint
]);
// If the user specified only an authorization endpoint, use that
@ -66,19 +64,12 @@ class IndieAuth extends BaseController
return view('auth/error', ['error' => 'State did not match. Start over.']);
}
$tokenEndpoint = false;
if(session('token_endpoint')) {
$tokenEndpoint = session('token_endpoint');
} else if(session('authorization_endpoint')) {
if(session('authorization_endpoint')) {
$authorizationEndpoint = session('authorization_endpoint');
} else {
$authorizationEndpoint = env('DEFAULT_AUTH_ENDPOINT');
}
if($tokenEndpoint) {
$token = \IndieAuth\Client::getAccessToken($tokenEndpoint, $request->input('code'), session('attempted_me'), $this->_redirectURI(), env('BASE_URL'), $request->input('state'));
} else {
$token = \IndieAuth\Client::verifyIndieAuthCode($authorizationEndpoint, $request->input('code'), session('attempted_me'), $this->_redirectURI(), env('BASE_URL'), $request->input('state'));
}
$token = \IndieAuth\Client::verifyIndieAuthCode($authorizationEndpoint, $request->input('code'), session('attempted_me'), $this->_redirectURI(), env('BASE_URL'));
if($token && array_key_exists('me', $token)) {
session()->flush();

+ 1
- 1
compass/composer.json View File

@ -9,7 +9,7 @@
"laravel/lumen-framework": "5.1.*",
"vlucas/phpdotenv": "~1.0",
"p3k/quartz-db": "0.1.*",
"indieauth/client": "0.1.*",
"indieauth/client": "0.2.*",
"guzzlehttp/guzzle":"~6.0",
"illuminate/redis": "^5.1",
"p3k/multipart": "*"

+ 91
- 90
compass/composer.lock View File

@ -4,8 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "beb6dcaa4892475f2c993b48f083101b",
"content-hash": "88c67570c2467df57497b93556affca1",
"content-hash": "84f1171b6758a3d1faeb01e70431961e",
"packages": [
{
"name": "barnabywalters/mf-cleaner",
@ -45,7 +44,7 @@
}
],
"description": "Cleans up microformats2 array structures",
"time": "2014-10-06 23:11:15"
"time": "2014-10-06T23:11:15+00:00"
},
{
"name": "danielstjules/stringy",
@ -101,7 +100,7 @@
"utility",
"utils"
],
"time": "2015-07-23 00:54:12"
"time": "2015-07-23T00:54:12+00:00"
},
{
"name": "doctrine/inflector",
@ -168,7 +167,7 @@
"singularize",
"string"
],
"time": "2015-11-06 14:35:42"
"time": "2015-11-06T14:35:42+00:00"
},
{
"name": "guzzlehttp/guzzle",
@ -230,7 +229,7 @@
"rest",
"web service"
],
"time": "2015-11-23 00:47:50"
"time": "2015-11-23T00:47:50+00:00"
},
{
"name": "guzzlehttp/promises",
@ -281,7 +280,7 @@
"keywords": [
"promise"
],
"time": "2015-10-15 22:28:00"
"time": "2015-10-15T22:28:00+00:00"
},
{
"name": "guzzlehttp/psr7",
@ -339,7 +338,7 @@
"stream",
"uri"
],
"time": "2016-01-23 01:23:02"
"time": "2016-01-23T01:23:02+00:00"
},
{
"name": "illuminate/auth",
@ -389,7 +388,7 @@
],
"description": "The Illuminate Auth package.",
"homepage": "http://laravel.com",
"time": "2015-12-08 14:38:44"
"time": "2015-12-08T14:38:44+00:00"
},
{
"name": "illuminate/broadcasting",
@ -436,7 +435,7 @@
],
"description": "The Illuminate Broadcasting package.",
"homepage": "http://laravel.com",
"time": "2015-12-21 04:33:22"
"time": "2015-12-21T04:33:22+00:00"
},
{
"name": "illuminate/bus",
@ -481,7 +480,7 @@
],
"description": "The Illuminate Bus package.",
"homepage": "http://laravel.com",
"time": "2015-12-24 19:50:28"
"time": "2015-12-24T19:50:28+00:00"
},
{
"name": "illuminate/cache",
@ -531,7 +530,7 @@
],
"description": "The Illuminate Cache package.",
"homepage": "http://laravel.com",
"time": "2015-12-28 21:20:38"
"time": "2015-12-28T21:20:38+00:00"
},
{
"name": "illuminate/config",
@ -576,7 +575,7 @@
],
"description": "The Illuminate Config package.",
"homepage": "http://laravel.com",
"time": "2015-06-18 02:16:31"
"time": "2015-06-18T02:16:31+00:00"
},
{
"name": "illuminate/console",
@ -627,7 +626,7 @@
],
"description": "The Illuminate Console package.",
"homepage": "http://laravel.com",
"time": "2015-12-28 21:10:29"
"time": "2015-12-28T21:10:29+00:00"
},
{
"name": "illuminate/container",
@ -670,7 +669,7 @@
],
"description": "The Illuminate Container package.",
"homepage": "http://laravel.com",
"time": "2015-12-07 20:20:37"
"time": "2015-12-07T20:20:37+00:00"
},
{
"name": "illuminate/contracts",
@ -712,7 +711,7 @@
],
"description": "The Illuminate Contracts package.",
"homepage": "http://laravel.com",
"time": "2015-09-24 11:16:48"
"time": "2015-09-24T11:16:48+00:00"
},
{
"name": "illuminate/cookie",
@ -758,7 +757,7 @@
],
"description": "The Illuminate Cookie package.",
"homepage": "http://laravel.com",
"time": "2015-12-05 16:40:16"
"time": "2015-12-05T16:40:16+00:00"
},
{
"name": "illuminate/database",
@ -818,7 +817,7 @@
"orm",
"sql"
],
"time": "2015-12-30 23:14:26"
"time": "2015-12-30T23:14:26+00:00"
},
{
"name": "illuminate/encryption",
@ -867,7 +866,7 @@
],
"description": "The Illuminate Encryption package.",
"homepage": "http://laravel.com",
"time": "2015-12-02 19:57:45"
"time": "2015-12-02T19:57:45+00:00"
},
{
"name": "illuminate/events",
@ -912,7 +911,7 @@
],
"description": "The Illuminate Events package.",
"homepage": "http://laravel.com",
"time": "2015-11-29 16:58:05"
"time": "2015-11-29T16:58:05+00:00"
},
{
"name": "illuminate/filesystem",
@ -962,7 +961,7 @@
],
"description": "The Illuminate Filesystem package.",
"homepage": "http://laravel.com",
"time": "2015-12-20 15:51:01"
"time": "2015-12-20T15:51:01+00:00"
},
{
"name": "illuminate/hashing",
@ -1006,7 +1005,7 @@
],
"description": "The Illuminate Hashing package.",
"homepage": "http://laravel.com",
"time": "2015-11-29 16:58:05"
"time": "2015-11-29T16:58:05+00:00"
},
{
"name": "illuminate/http",
@ -1052,7 +1051,7 @@
],
"description": "The Illuminate Http package.",
"homepage": "http://laravel.com",
"time": "2015-12-19 22:27:14"
"time": "2015-12-19T22:27:14+00:00"
},
{
"name": "illuminate/pagination",
@ -1096,7 +1095,7 @@
],
"description": "The Illuminate Pagination package.",
"homepage": "http://laravel.com",
"time": "2015-12-07 19:40:09"
"time": "2015-12-07T19:40:09+00:00"
},
{
"name": "illuminate/pipeline",
@ -1140,7 +1139,7 @@
],
"description": "The Illuminate Pipeline package.",
"homepage": "http://laravel.com",
"time": "2015-10-05 21:58:27"
"time": "2015-10-05T21:58:27+00:00"
},
{
"name": "illuminate/queue",
@ -1198,7 +1197,7 @@
],
"description": "The Illuminate Queue package.",
"homepage": "http://laravel.com",
"time": "2015-12-28 15:52:33"
"time": "2015-12-28T15:52:33+00:00"
},
{
"name": "illuminate/redis",
@ -1243,7 +1242,7 @@
],
"description": "The Illuminate Redis package.",
"homepage": "http://laravel.com",
"time": "2015-06-18 02:16:31"
"time": "2015-06-18T02:16:31+00:00"
},
{
"name": "illuminate/session",
@ -1293,7 +1292,7 @@
],
"description": "The Illuminate Session package.",
"homepage": "http://laravel.com",
"time": "2015-12-26 15:27:27"
"time": "2015-12-26T15:27:27+00:00"
},
{
"name": "illuminate/support",
@ -1347,7 +1346,7 @@
],
"description": "The Illuminate Support package.",
"homepage": "http://laravel.com",
"time": "2015-12-28 21:10:29"
"time": "2015-12-28T21:10:29+00:00"
},
{
"name": "illuminate/translation",
@ -1392,7 +1391,7 @@
],
"description": "The Illuminate Translation package.",
"homepage": "http://laravel.com",
"time": "2015-11-28 13:59:02"
"time": "2015-11-28T13:59:02+00:00"
},
{
"name": "illuminate/validation",
@ -1442,7 +1441,7 @@
],
"description": "The Illuminate Validation package.",
"homepage": "http://laravel.com",
"time": "2015-12-09 15:24:53"
"time": "2015-12-09T15:24:53+00:00"
},
{
"name": "illuminate/view",
@ -1489,26 +1488,26 @@
],
"description": "The Illuminate View package.",
"homepage": "http://laravel.com",
"time": "2015-11-29 16:58:05"
"time": "2015-11-29T16:58:05+00:00"
},
{
"name": "indieauth/client",
"version": "0.1.11",
"version": "0.2.2",
"source": {
"type": "git",
"url": "https://github.com/indieweb/indieauth-client-php.git",
"reference": "6504ed0d4714084e9955f639d6e5cf4e976f9038"
"reference": "225ece31ddafaee3348eabdc915422c457498a84"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/6504ed0d4714084e9955f639d6e5cf4e976f9038",
"reference": "6504ed0d4714084e9955f639d6e5cf4e976f9038",
"url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/225ece31ddafaee3348eabdc915422c457498a84",
"reference": "225ece31ddafaee3348eabdc915422c457498a84",
"shasum": ""
},
"require": {
"barnabywalters/mf-cleaner": "0.*",
"indieweb/link-rel-parser": "0.1.1",
"mf2/mf2": "0.2.*",
"indieweb/link-rel-parser": "0.1.*",
"mf2/mf2": "~0.3",
"php": ">5.3.0"
},
"type": "library",
@ -1528,7 +1527,7 @@
}
],
"description": "IndieAuth Client Library",
"time": "2015-08-30 22:29:40"
"time": "2017-07-01T15:43:45+00:00"
},
{
"name": "indieweb/link-rel-parser",
@ -1574,7 +1573,7 @@
"indieweb",
"microformats2"
],
"time": "2013-12-23 00:14:58"
"time": "2013-12-23T00:14:58+00:00"
},
{
"name": "laravel/lumen-framework",
@ -1660,27 +1659,29 @@
"laravel",
"lumen"
],
"time": "2015-10-28 22:19:15"
"time": "2015-10-28T22:19:15+00:00"
},
{
"name": "mf2/mf2",
"version": "v0.2.12",
"version": "v0.3.2",
"source": {
"type": "git",
"url": "https://github.com/indieweb/php-mf2.git",
"reference": "6701504876d6c9242eb310b35f41d40d9785ab4e"
"reference": "dc0d90d4ee30864bcf37cd3a8fc8db94f9134cc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/php-mf2/zipball/6701504876d6c9242eb310b35f41d40d9785ab4e",
"reference": "6701504876d6c9242eb310b35f41d40d9785ab4e",
"url": "https://api.github.com/repos/indieweb/php-mf2/zipball/dc0d90d4ee30864bcf37cd3a8fc8db94f9134cc4",
"reference": "dc0d90d4ee30864bcf37cd3a8fc8db94f9134cc4",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
"mf2/tests": "@dev",
"phpdocumentor/phpdocumentor": "v2.8.4",
"phpunit/phpunit": "4.8.*"
},
"suggest": {
"barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you"
@ -1697,7 +1698,7 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
"CC0"
],
"authors": [
{
@ -1713,7 +1714,7 @@
"parser",
"semantic"
],
"time": "2015-07-12 14:10:01"
"time": "2017-05-27T15:27:47+00:00"
},
{
"name": "monolog/monolog",
@ -1790,7 +1791,7 @@
"logging",
"psr-3"
],
"time": "2015-10-14 12:51:02"
"time": "2015-10-14T12:51:02+00:00"
},
{
"name": "mtdowling/cron-expression",
@ -1834,7 +1835,7 @@
"cron",
"schedule"
],
"time": "2016-01-26 21:23:30"
"time": "2016-01-26T21:23:30+00:00"
},
{
"name": "nesbot/carbon",
@ -1881,7 +1882,7 @@
"datetime",
"time"
],
"time": "2015-11-04 20:07:17"
"time": "2015-11-04T20:07:17+00:00"
},
{
"name": "nikic/fast-route",
@ -1924,7 +1925,7 @@
"router",
"routing"
],
"time": "2015-02-26 15:33:07"
"time": "2015-02-26T15:33:07+00:00"
},
{
"name": "p3k/multipart",
@ -1960,7 +1961,7 @@
}
],
"description": "Multipart Encoding Library",
"time": "2015-07-16 19:28:02"
"time": "2015-07-16T19:28:02+00:00"
},
{
"name": "p3k/quartz-db",
@ -1992,7 +1993,7 @@
}
],
"description": "A flat-file database optimized to hold time-series data.",
"time": "2016-01-29 00:39:52"
"time": "2016-01-29T00:39:52+00:00"
},
{
"name": "paragonie/random_compat",
@ -2040,7 +2041,7 @@
"pseudorandom",
"random"
],
"time": "2016-01-29 16:19:52"
"time": "2016-01-29T16:19:52+00:00"
},
{
"name": "predis/predis",
@ -2090,7 +2091,7 @@
"predis",
"redis"
],
"time": "2015-07-30 18:34:15"
"time": "2015-07-30T18:34:15+00:00"
},
{
"name": "psr/http-message",
@ -2139,7 +2140,7 @@
"request",
"response"
],
"time": "2015-05-04 20:22:00"
"time": "2015-05-04T20:22:00+00:00"
},
{
"name": "psr/log",
@ -2177,7 +2178,7 @@
"psr",
"psr-3"
],
"time": "2012-12-21 11:40:51"
"time": "2012-12-21T11:40:51+00:00"
},
{
"name": "symfony/console",
@ -2236,7 +2237,7 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2016-01-14 08:26:43"
"time": "2016-01-14T08:26:43+00:00"
},
{
"name": "symfony/debug",
@ -2293,7 +2294,7 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2016-01-13 10:28:07"
"time": "2016-01-13T10:28:07+00:00"
},
{
"name": "symfony/dom-crawler",
@ -2348,7 +2349,7 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2016-01-03 15:32:00"
"time": "2016-01-03T15:32:00+00:00"
},
{
"name": "symfony/event-dispatcher",
@ -2408,7 +2409,7 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2016-01-13 10:28:07"
"time": "2016-01-13T10:28:07+00:00"
},
{
"name": "symfony/finder",
@ -2457,7 +2458,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2016-01-14 08:26:43"
"time": "2016-01-14T08:26:43+00:00"
},
{
"name": "symfony/http-foundation",
@ -2512,7 +2513,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2016-01-13 10:26:43"
"time": "2016-01-13T10:26:43+00:00"
},
{
"name": "symfony/http-kernel",
@ -2594,7 +2595,7 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"time": "2016-01-14 10:41:45"
"time": "2016-01-14T10:41:45+00:00"
},
{
"name": "symfony/process",
@ -2643,7 +2644,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2016-01-06 09:57:37"
"time": "2016-01-06T09:57:37+00:00"
},
{
"name": "symfony/security-core",
@ -2708,7 +2709,7 @@
],
"description": "Symfony Security Component - Core Library",
"homepage": "https://symfony.com",
"time": "2016-01-14 09:08:21"
"time": "2016-01-14T09:08:21+00:00"
},
{
"name": "symfony/translation",
@ -2771,7 +2772,7 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2016-01-03 15:32:00"
"time": "2016-01-03T15:32:00+00:00"
},
{
"name": "symfony/var-dumper",
@ -2830,7 +2831,7 @@
"debug",
"dump"
],
"time": "2016-01-07 11:12:32"
"time": "2016-01-07T11:12:32+00:00"
},
{
"name": "vlucas/phpdotenv",
@ -2876,7 +2877,7 @@
"env",
"environment"
],
"time": "2015-05-30 15:59:26"
"time": "2015-05-30T15:59:26+00:00"
}
],
"packages-dev": [
@ -2932,7 +2933,7 @@
"constructor",
"instantiate"
],
"time": "2015-06-14 21:17:01"
"time": "2015-06-14T21:17:01+00:00"
},
{
"name": "fzaninotto/faker",
@ -2984,7 +2985,7 @@
"faker",
"fixtures"
],
"time": "2015-05-29 06:29:14"
"time": "2015-05-29T06:29:14+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
@ -3033,7 +3034,7 @@
"email": "mike.vanriel@naenius.com"
}
],
"time": "2015-02-03 12:10:50"
"time": "2015-02-03T12:10:50+00:00"
},
{
"name": "phpspec/prophecy",
@ -3093,7 +3094,7 @@
"spy",
"stub"
],
"time": "2015-08-13 10:07:40"
"time": "2015-08-13T10:07:40+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -3155,7 +3156,7 @@
"testing",
"xunit"
],
"time": "2015-10-06 15:47:00"
"time": "2015-10-06T15:47:00+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -3202,7 +3203,7 @@
"filesystem",
"iterator"
],
"time": "2015-06-21 13:08:43"
"time": "2015-06-21T13:08:43+00:00"
},
{
"name": "phpunit/php-text-template",
@ -3243,7 +3244,7 @@
"keywords": [
"template"
],
"time": "2015-06-21 13:50:34"
"time": "2015-06-21T13:50:34+00:00"
},
{
"name": "phpunit/php-timer",
@ -3284,7 +3285,7 @@
"keywords": [
"timer"
],
"time": "2015-06-21 08:01:12"
"time": "2015-06-21T08:01:12+00:00"
},
{
"name": "phpunit/php-token-stream",
@ -3333,7 +3334,7 @@
"keywords": [
"tokenizer"
],
"time": "2015-09-15 10:49:45"
"time": "2015-09-15T10:49:45+00:00"
},
{
"name": "phpunit/phpunit",
@ -3405,7 +3406,7 @@
"testing",
"xunit"
],
"time": "2015-12-12 07:45:58"
"time": "2015-12-12T07:45:58+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -3461,7 +3462,7 @@
"mock",
"xunit"
],
"time": "2015-10-02 06:51:40"
"time": "2015-10-02T06:51:40+00:00"
},
{
"name": "sebastian/comparator",
@ -3525,7 +3526,7 @@
"compare",
"equality"
],
"time": "2015-07-26 15:48:44"
"time": "2015-07-26T15:48:44+00:00"
},
{
"name": "sebastian/diff",
@ -3577,7 +3578,7 @@
"keywords": [
"diff"
],
"time": "2015-12-08 07:14:41"
"time": "2015-12-08T07:14:41+00:00"
},
{
"name": "sebastian/environment",
@ -3627,7 +3628,7 @@
"environment",
"hhvm"
],
"time": "2015-12-02 08:37:27"
"time": "2015-12-02T08:37:27+00:00"
},
{
"name": "sebastian/exporter",
@ -3693,7 +3694,7 @@
"export",
"exporter"
],
"time": "2015-06-21 07:55:53"
"time": "2015-06-21T07:55:53+00:00"
},
{
"name": "sebastian/global-state",
@ -3744,7 +3745,7 @@
"keywords": [
"global state"
],
"time": "2015-10-12 03:26:01"
"time": "2015-10-12T03:26:01+00:00"
},
{
"name": "sebastian/recursion-context",
@ -3797,7 +3798,7 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2015-11-11 19:50:13"
"time": "2015-11-11T19:50:13+00:00"
},
{
"name": "sebastian/version",
@ -3832,7 +3833,7 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21 13:59:46"
"time": "2015-06-21T13:59:46+00:00"
},
{
"name": "symfony/yaml",
@ -3881,7 +3882,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2015-12-26 13:39:53"
"time": "2015-12-26T13:39:53+00:00"
}
],
"aliases": [],

Loading…
Cancel
Save