@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorOAuthServerApplication extends PhabricatorApplication {
4
5 public function getName() {
6 return pht('OAuth Server');
7 }
8
9 public function getBaseURI() {
10 return '/oauthserver/';
11 }
12
13 public function getShortDescription() {
14 return pht('OAuth Login Provider');
15 }
16
17 public function getIcon() {
18 return 'fa-hotel';
19 }
20
21 public function getTitleGlyph() {
22 return "\xE2\x99\x86";
23 }
24
25 public function getFlavorText() {
26 return pht(
27 'Log In with %s',
28 PlatformSymbols::getPlatformServerName());
29 }
30
31 public function getApplicationGroup() {
32 return self::GROUP_ADMIN;
33 }
34
35 public function isPrototype() {
36 return true;
37 }
38
39 public function getHelpDocumentationArticles(PhabricatorUser $viewer) {
40 return array(
41 array(
42 'name' => pht(
43 'Using the %s OAuth Server',
44 PlatformSymbols::getPlatformServerName()),
45 'href' => PhabricatorEnv::getDoclink(
46 'Using the Phorge OAuth Server'),
47 ),
48 );
49 }
50
51 public function getRoutes() {
52 return array(
53 '/oauthserver/' => array(
54 '(?:query/(?P<queryKey>[^/]+)/)?'
55 => 'PhabricatorOAuthClientListController',
56 'auth/' => 'PhabricatorOAuthServerAuthController',
57 'token/' => 'PhabricatorOAuthServerTokenController',
58 $this->getEditRoutePattern('edit/') =>
59 'PhabricatorOAuthClientEditController',
60 'client/' => array(
61 'disable/(?P<id>\d+)/' => 'PhabricatorOAuthClientDisableController',
62 'view/(?P<id>\d+)/' => 'PhabricatorOAuthClientViewController',
63 'secret/(?P<id>\d+)/' => 'PhabricatorOAuthClientSecretController',
64 'test/(?P<id>\d+)/' => 'PhabricatorOAuthClientTestController',
65 ),
66 ),
67 );
68 }
69
70 protected function getCustomCapabilities() {
71 return array(
72 PhabricatorOAuthServerCreateClientsCapability::CAPABILITY => array(
73 'default' => PhabricatorPolicies::POLICY_ADMIN,
74 ),
75 );
76 }
77
78}