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