Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Keycloak.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ public function getEndpoint(string $endpoint)
{
if (!isset($this->discovery)) {
$plugin = plugin_load('helper', 'oauthkeycloak');
$json = file_get_contents($plugin->getConf('openidurl'));

$context = stream_context_create([
'ssl' => [
'verify_peer' => $plugin->getConf('verify-peer')
]
]);
$json = file_get_contents($plugin->getConf('openidurl'), false, $context);

if (!$json) throw new \Exception('Failed accessing ' . $plugin->getConf('openidurl'));
$this->discovery = json_decode($json, true);
}
Expand Down
1 change: 1 addition & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$conf['secret'] = '';

$conf['openidurl'] = '';
$conf['verify-peer'] = 1;

$conf['label'] = 'Keycloak';
$conf['color'] = '#333333';
1 change: 1 addition & 0 deletions conf/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$meta['secret'] = array('password');

$meta['openidurl'] = array('string');
$meta['verify-peer'] = array('onoff','_caution' => 'security');

$meta['label'] = array('string');
$meta['color'] = array('string');
1 change: 1 addition & 0 deletions lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
$lang['key'] = 'Client ID';
$lang['secret'] = 'Cient Secret';
$lang['openidurl'] = 'OpenID Connect Auto Discovery URL';
$lang['verify-peer'] = 'Verification of SSL certificate is required.';

$lang['label'] = 'Label to display on the login button';
$lang['color'] = 'Color to use with the login button';