View Javadoc
1   package ca.uhn.fhir.rest.server.exceptions;
2   
3   import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
4   
5   import ca.uhn.fhir.rest.api.Constants;
6   import ca.uhn.fhir.util.CoverageIgnore;
7   
8   /*
9    * #%L
10   * HAPI FHIR - Core Library
11   * %%
12   * Copyright (C) 2014 - 2018 University Health Network
13   * %%
14   * Licensed under the Apache License, Version 2.0 (the "License");
15   * you may not use this file except in compliance with the License.
16   * You may obtain a copy of the License at
17   * 
18   *      http://www.apache.org/licenses/LICENSE-2.0
19   * 
20   * Unless required by applicable law or agreed to in writing, software
21   * distributed under the License is distributed on an "AS IS" BASIS,
22   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23   * See the License for the specific language governing permissions and
24   * limitations under the License.
25   * #L%
26   */
27  
28  /**
29   * This Represents an <b>HTTP 403 Forbidden</b> response, which generally indicates one of two conditions:
30   * <ul>
31   * <li>Authentication was provided, but the authenticated user is not permitted to perform the requested operation.</li>
32   * <li>The operation is forbidden to all users. Repeating the request with authentication would serve no purpose.</li>
33   * </ul>
34   * 
35   * <p>
36   * For security failures, you should use
37   * {@link AuthenticationException} if you want to indicate that the
38   * user could not be authenticated (e.g. credential failures), also 
39   * known as an <b>authentication</b> failure. 
40   * You should use {@link ForbiddenOperationException} if you want to 
41   * indicate that the authenticated user does not have permission to
42   * perform the requested operation, also known as an <b>authorization</b>
43   * failure.
44   * </p>
45   * <p>
46   * Note that a complete list of RESTful exceptions is available in the <a href="./package-summary.html">Package
47   * Summary</a>.
48   * </p>
49   */
50  @CoverageIgnore
51  public class ForbiddenOperationException extends BaseServerResponseException {
52  
53  	public static final int STATUS_CODE = Constants.STATUS_HTTP_403_FORBIDDEN;
54  	private static final long serialVersionUID = 1L;
55  
56  	public ForbiddenOperationException(String theMessage) {
57  		super(STATUS_CODE, theMessage);
58  	}
59  
60  	/**
61  	 * Constructor
62  	 * 
63  	 * @param theMessage
64  	 *            The message
65  	 * @param theOperationOutcome
66  	 *            The OperationOutcome resource to return to the client
67  	 */
68  	public ForbiddenOperationException(String theMessage, IBaseOperationOutcome theOperationOutcome) {
69  		super(STATUS_CODE, theMessage, theOperationOutcome);
70  	}
71  
72  }