1+ <?php
2+ /*
3+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14+ *
15+ * This software consists of voluntary contributions made by many individuals
16+ * and is licensed under the MIT license.
17+ */
18+
19+ namespace ZfrOAuth2 \Server ;
20+
21+ use Psr \Http \Message \ResponseInterface ;
22+ use Psr \Http \Message \ServerRequestInterface ;
23+ use ZfrOAuth2 \Server \Entity \TokenOwnerInterface ;
24+ use ZfrOAuth2 \Server \Exception \OAuth2Exception ;
25+
26+ /**
27+ * The authorization server main role is to create access tokens or refresh tokens
28+ */
29+ interface AuthorizationServerInterface
30+ {
31+ /**
32+ * Check if the authorization server supports this grant
33+ *
34+ * @param string $grant
35+ * @return bool
36+ */
37+ public function hasGrant ($ grant );
38+
39+ /**
40+ * Check if the authorization server supports this response type
41+ *
42+ * @param string $responseType
43+ * @return bool
44+ */
45+ public function hasResponseType ($ responseType );
46+
47+ /**
48+ * @param ServerRequestInterface $request
49+ * @param TokenOwnerInterface|null $owner
50+ * @return ResponseInterface
51+ * @throws OAuth2Exception If no "response_type" could be found in the GET parameters
52+ */
53+ public function handleAuthorizationRequest (ServerRequestInterface $ request , TokenOwnerInterface $ owner = null );
54+
55+ /**
56+ * @param ServerRequestInterface $request
57+ * @param TokenOwnerInterface|null $owner
58+ * @return ResponseInterface
59+ * @throws OAuth2Exception If no "grant_type" could be found in the POST parameters
60+ */
61+ public function handleTokenRequest (ServerRequestInterface $ request , TokenOwnerInterface $ owner = null );
62+
63+ /**
64+ * @param ServerRequestInterface $request
65+ * @return ResponseInterface
66+ * @throws OAuth2Exception If no "token" is present
67+ */
68+ public function handleRevocationRequest (ServerRequestInterface $ request );
69+ }
0 commit comments