xref: /plugin/oauthgeneric/Generic.php (revision d13c9ae11cd8e21d2fe26f3884884b72a61489f2)
1<?php
2
3namespace dokuwiki\plugin\oauthgeneric;
4
5use dokuwiki\plugin\oauth\Service\AbstractOAuth2Base;
6use OAuth\Common\Http\Uri\Uri;
7
8/**
9 * Custom Service for Generic oAuth
10 */
11class Generic extends AbstractOAuth2Base
12{
13    /** @inheritdoc */
14    public function needsStateParameterInAuthUrl() {
15        return true;
16    }
17
18    /** @inheritdoc */
19    public function getAuthorizationEndpoint()
20    {
21        $plugin = plugin_load('helper', 'oauthgeneric');
22        return new Uri($plugin->getConf('authurl'));
23    }
24
25    /** @inheritdoc */
26    public function getAccessTokenEndpoint()
27    {
28        $plugin = plugin_load('helper', 'oauthgeneric');
29        return new Uri($plugin->getConf('tokenurl'));
30    }
31
32    /**
33     * @inheritdoc
34     */
35    protected function getAuthorizationMethod()
36    {
37        $plugin = plugin_load('helper', 'oauthgeneric');
38
39        return (int) $plugin->getConf('authmethod');
40    }
41}
42