diff --git a/src/Revoke.php b/src/Revoke.php new file mode 100644 index 0000000..ce9ce34 --- /dev/null +++ b/src/Revoke.php @@ -0,0 +1,69 @@ +slim = $slim; + $this->server = $server; + } + + /** + * Call this class as a function. + * + * @return void + */ + public function __invoke() + { + $request = MessageBridge::newOAuth2Request($this->slim->request()); + MessageBridge::mapResponse( + $this->server->handleRevokeRequest($request), + $this->slim->response() + ); + } + + /** + * Register this route with the given Slim application and OAuth2 server + * + * @param Slim $slim The slim framework application instance. + * @param OAuth2\Server $server The oauth2 server instance. + * + * @return void + */ + public static function register(Slim $slim, OAuth2\Server $server) + { + $slim->post(self::ROUTE, new static($slim, $server))->name('revoke'); + } +}