in classes/loginflow/base.php [401:426]
protected function get_oidcclient() {
global $CFG;
if (empty($this->httpclient) || !($this->httpclient instanceof \auth_oidc\httpclientinterface)) {
$this->httpclient = new \auth_oidc\httpclient();
}
if (empty($this->config->clientid) || empty($this->config->clientsecret)) {
throw new \moodle_exception('errorauthnocreds', 'auth_oidc');
}
if (empty($this->config->authendpoint) || empty($this->config->tokenendpoint)) {
throw new \moodle_exception('errorauthnoendpoints', 'auth_oidc');
}
$clientid = (isset($this->config->clientid)) ? $this->config->clientid : null;
$clientsecret = (isset($this->config->clientsecret)) ? $this->config->clientsecret : null;
$redirecturi = (!empty($CFG->loginhttps)) ? str_replace('http://', 'https://', $CFG->wwwroot) : $CFG->wwwroot;
$redirecturi .= '/auth/oidc/';
$tokenresource = (isset($this->config->oidcresource)) ? $this->config->oidcresource : null;
$scope = (isset($this->config->oidcscope)) ? $this->config->oidcscope : null;
$client = new \auth_oidc\oidcclient($this->httpclient);
$client->setcreds($clientid, $clientsecret, $redirecturi, $tokenresource, $scope);
$client->setendpoints(['auth' => $this->config->authendpoint, 'token' => $this->config->tokenendpoint]);
return $client;
}