1 package org.springframework.security.oauth2.provider;
2
3 import org.springframework.security.oauth2.common.exceptions.InvalidScopeException;
4 import org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint;
5 import org.springframework.security.oauth2.provider.endpoint.TokenEndpoint;
6
7 /**
8 * Validation interface for OAuth2 requests to the {@link AuthorizationEndpoint} and {@link TokenEndpoint}.
9 *
10 * @author Amanda Anganes
11 *
12 */
13 public interface OAuth2RequestValidator {
14
15 /**
16 * Ensure that the client has requested a valid set of scopes.
17 *
18 * @param authorizationRequest the AuthorizationRequest to be validated
19 * @param client the client that is making the request
20 * @throws InvalidScopeException if a requested scope is invalid
21 */
22 public void validateScope(AuthorizationRequest authorizationRequest, ClientDetails client) throws InvalidScopeException;
23
24 /**
25 * Ensure that the client has requested a valid set of scopes.
26 *
27 * @param tokenRequest the TokenRequest to be validated
28 * @param client the client that is making the request
29 * @throws InvalidScopeException if a requested scope is invalid
30 */
31 public void validateScope(TokenRequest tokenRequest, ClientDetails client) throws InvalidScopeException;
32
33 }