-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextend.php
54 lines (42 loc) · 1.59 KB
/
extend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
* This file is part of blomstra/oauth-apple.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace Blomstra\OAuthApple;
use Blomstra\OAuthApple\Api\Controller\ApplePostOAuthController;
use Blomstra\OAuthApple\Api\Controller\DeleteKeyFileController;
use Blomstra\OAuthApple\Api\Controller\KeyFileUploadController;
use Blomstra\OAuthApple\Providers\Apple;
use Flarum\Extend;
use Flarum\Foundation\Paths;
use Flarum\Http\UrlGenerator;
use FoF\OAuth\Extend as OAuthExtend;
// $leeway is needed for clock skew
\Firebase\JWT\JWT::$leeway = 60;
return [
(new Extend\Frontend('forum'))
->css(__DIR__.'/less/forum.less'),
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),
new Extend\Locales(__DIR__.'/locale'),
(new Extend\Filesystem())
->disk('apple-keyfile', function (Paths $paths, UrlGenerator $url): array {
return [
'root' => "$paths->storage/oauth/applekey",
];
}),
(new Extend\Routes('api'))
->post('/oauth/apple/keyfile', 'oauth.apple.keyfile.create', KeyFileUploadController::class)
->delete('/oauth/apple/keyfile', 'oauth.apple.keyfile.delete', DeleteKeyFileController::class),
(new Extend\Routes('forum'))
->post('/auth/apple', 'oauth.apple.post', ApplePostOAuthController::class),
(new Extend\Csrf())
->exemptRoute('oauth.apple.post')
->exemptRoute('register'),
new OAuthExtend\RegisterProvider(Apple::class),
];