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 $plugin = plugin_load('helper', 'oauthgeneric'); 16 return 0 !== $plugin->getConf('needs-state'); 17 } 18 19 /** @inheritdoc */ 20 public function getAuthorizationEndpoint() 21 { 22 $plugin = plugin_load('helper', 'oauthgeneric'); 23 return new Uri($plugin->getConf('authurl')); 24 } 25 26 /** @inheritdoc */ 27 public function getAccessTokenEndpoint() 28 { 29 $plugin = plugin_load('helper', 'oauthgeneric'); 30 return new Uri($plugin->getConf('tokenurl')); 31 } 32 33 /** 34 * @inheritdoc 35 */ 36 protected function getAuthorizationMethod() 37 { 38 $plugin = plugin_load('helper', 'oauthgeneric'); 39 40 return (int) $plugin->getConf('authmethod'); 41 } 42} 43