Skip to content

Commit c913ac4

Browse files
indentation
1 parent 344cb6a commit c913ac4

File tree

1 file changed

+63
-63
lines changed

1 file changed

+63
-63
lines changed

src/Controller/OpenidController.php

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
class OpenidController extends AbstractController
99
{
1010
private $keys;
11-
private $openIdConfiguration;
12-
private $authServerConfig;
13-
private $authServerFactory;
11+
private $openIdConfiguration;
12+
private $authServerConfig;
13+
private $authServerFactory;
1414

1515
public function __construct(){
1616
// parent::__construct();
1717
require_once(__DIR__.'/../../vendor/autoload.php');
1818

1919
$this->keys = $this->getKeys();
20-
$this->openIdConfiguration = $this->getOpenIdConfiguration();
21-
22-
$this->authServerConfig = $this->createConfig();
23-
$this->authServerFactory = (new \Pdsinterop\Solid\Auth\Factory\AuthorizationServerFactory($this->authServerConfig))->create();
20+
$this->openIdConfiguration = $this->getOpenIdConfiguration();
21+
22+
$this->authServerConfig = $this->createConfig();
23+
$this->authServerFactory = (new \Pdsinterop\Solid\Auth\Factory\AuthorizationServerFactory($this->authServerConfig))->create();
2424
}
2525
private function linkToRoute($route) {
2626
return '/some/route';
@@ -32,37 +32,37 @@ private function getAbsoluteUrl($relativeUrl) {
3232
return 'http://localhost/some/route';
3333
}
3434
private function getOpenIdConfiguration() {
35-
return array(
36-
'issuer' => $this->getBaseUrl(),
37-
'authorization_endpoint' => $this->getAbsoluteUrl($this->linkToRoute("solid.server.authorize")),
38-
'jwks_uri' => $this->getAbsoluteUrl($this->linkToRoute("solid.server.jwks")),
39-
"response_types_supported" => array("code","code token","code id_token","id_token code","id_token","id_token token","code id_token token","none"),
40-
"token_types_supported" => array("legacyPop","dpop"),
41-
"response_modes_supported" => array("query","fragment"),
42-
"grant_types_supported" => array("authorization_code","implicit","refresh_token","client_credentials"),
43-
"subject_types_supported" => ["public"],
44-
"id_token_signing_alg_values_supported" => ["RS256"],
45-
"token_endpoint_auth_methods_supported" => "client_secret_basic",
46-
"token_endpoint_auth_signing_alg_values_supported" => ["RS256"],
47-
"display_values_supported" => [],
48-
"claim_types_supported" => ["normal"],
49-
"claims_supported" => [],
50-
"claims_parameter_supported" => false,
51-
"request_parameter_supported" => true,
52-
"request_uri_parameter_supported" => false,
53-
"require_request_uri_registration" => false,
54-
"check_session_iframe" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.session")),
55-
"end_session_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.logout")),
56-
"token_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.token")),
57-
"userinfo_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.userinfo")),
58-
"registration_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.register")),
59-
// "sharing_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.sharing"))
60-
);
35+
return array(
36+
'issuer' => $this->getBaseUrl(),
37+
'authorization_endpoint' => $this->getAbsoluteUrl($this->linkToRoute("solid.server.authorize")),
38+
'jwks_uri' => $this->getAbsoluteUrl($this->linkToRoute("solid.server.jwks")),
39+
"response_types_supported" => array("code","code token","code id_token","id_token code","id_token","id_token token","code id_token token","none"),
40+
"token_types_supported" => array("legacyPop","dpop"),
41+
"response_modes_supported" => array("query","fragment"),
42+
"grant_types_supported" => array("authorization_code","implicit","refresh_token","client_credentials"),
43+
"subject_types_supported" => ["public"],
44+
"id_token_signing_alg_values_supported" => ["RS256"],
45+
"token_endpoint_auth_methods_supported" => "client_secret_basic",
46+
"token_endpoint_auth_signing_alg_values_supported" => ["RS256"],
47+
"display_values_supported" => [],
48+
"claim_types_supported" => ["normal"],
49+
"claims_supported" => [],
50+
"claims_parameter_supported" => false,
51+
"request_parameter_supported" => true,
52+
"request_uri_parameter_supported" => false,
53+
"require_request_uri_registration" => false,
54+
"check_session_iframe" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.session")),
55+
"end_session_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.logout")),
56+
"token_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.token")),
57+
"userinfo_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.userinfo")),
58+
"registration_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.register")),
59+
// "sharing_endpoint" => $this->getAbsoluteUrl($this->linkToRoute("solid.server.sharing"))
60+
);
6161
}
6262
private function getKeys() {
63-
// FIXME: read these from the solid config in nextcloud;
64-
$encryptionKey = 'P76gcBVeXsVzrHiYp4IIwore5rQz4cotdZ2j9GV5V04=';
65-
$privateKey = <<<EOF
63+
// FIXME: read these from the solid config in nextcloud;
64+
$encryptionKey = 'P76gcBVeXsVzrHiYp4IIwore5rQz4cotdZ2j9GV5V04=';
65+
$privateKey = <<<EOF
6666
-----BEGIN RSA PRIVATE KEY-----
6767
MIIEpAIBAAKCAQEAvqb0htUFZaZ+z5rn7cHWg0VzsSoVnusbtJvwWtHfD0T0s6Hb
6868
OqzE5h2fgdGbB49HRtc21SNHx6jeEStGv03yyqYkLUKrJJSg+ksrL+pT3Nd0h25q
@@ -92,14 +92,14 @@ private function getKeys() {
9292
-----END RSA PRIVATE KEY-----
9393
EOF;
9494

95-
$key = openssl_pkey_get_private($privateKey);
96-
$publicKey = openssl_pkey_get_details($key)['key'];
97-
98-
return array(
99-
"encryptionKey" => $encryptionKey,
100-
"privateKey" => $privateKey,
101-
"publicKey" => $publicKey
102-
);
95+
$key = openssl_pkey_get_private($privateKey);
96+
$publicKey = openssl_pkey_get_details($key)['key'];
97+
98+
return array(
99+
"encryptionKey" => $encryptionKey,
100+
"privateKey" => $privateKey,
101+
"publicKey" => $publicKey
102+
);
103103
}
104104
private function getClientId() {
105105
return "CoolApp";
@@ -131,29 +131,29 @@ private function getClient($clientId) {
131131
}
132132
}
133133

134-
private function createConfig() {
135-
// if (isset($_GET['client_id'])) {
136-
$clientId = $_GET['client_id'];
137-
$client = $this->getClient($clientId);
138-
// }
139-
try {
140-
$config = (new \Pdsinterop\Solid\Auth\Factory\ConfigFactory(
141-
$client,
142-
$this->keys['encryptionKey'],
143-
$this->keys['privateKey'],
144-
$this->keys['publicKey'],
145-
$this->openIdConfiguration
146-
))->create();
147-
} catch(\Throwable $e) {
148-
var_dump($e);
134+
private function createConfig() {
135+
// if (isset($_GET['client_id'])) {
136+
$clientId = $_GET['client_id'];
137+
$client = $this->getClient($clientId);
138+
// }
139+
try {
140+
$config = (new \Pdsinterop\Solid\Auth\Factory\ConfigFactory(
141+
$client,
142+
$this->keys['encryptionKey'],
143+
$this->keys['privateKey'],
144+
$this->keys['publicKey'],
145+
$this->openIdConfiguration
146+
))->create();
147+
} catch(\Throwable $e) {
148+
var_dump($e);
149+
}
150+
return $config;
149151
}
150-
return $config;
151-
}
152152

153153
final public function __invoke(ServerRequestInterface $request, array $args): ResponseInterface
154154
{
155155
$response = $this->getResponse();
156-
$server = new \Pdsinterop\Solid\Auth\Server($this->authServerFactory, $this->authServerConfig, $response);
157-
return $server->respondToOpenIdMetadataRequest();
156+
$server = new \Pdsinterop\Solid\Auth\Server($this->authServerFactory, $this->authServerConfig, $response);
157+
return $server->respondToOpenIdMetadataRequest();
158158
}
159159
}

0 commit comments

Comments
 (0)