View Javadoc
1   package org.springframework.security.oauth2.common.exceptions;
2   
3   import java.util.Set;
4   
5   import org.springframework.security.oauth2.common.util.OAuth2Utils;
6   
7   /**
8    * Exception representing an invalid scope in a token or authorization request (i.e. from an Authorization Server). Note
9    * that this is not the same as an access denied exception if the scope presented to a Resource Server is insufficient.
10   * The spec in this case mandates a 400 status code.
11   * 
12   * @author Ryan Heaton
13   * @author Dave Syer
14   */
15  @SuppressWarnings("serial")
16  public class InvalidScopeException extends OAuth2Exception {
17  
18  	public InvalidScopeException(String msg, Set<String> validScope) {
19  		this(msg);
20  		addAdditionalInformation("scope", OAuth2Utils.formatParameterList(validScope));
21  	}
22  
23  	public InvalidScopeException(String msg) {
24  		super(msg);
25  	}
26  
27  	@Override
28  	public String getOAuth2ErrorCode() {
29  		return "invalid_scope";
30  	}
31  
32  }