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