001/******************************************************************************* 002 * Copyright 2017 The MIT Internet Trust Consortium 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 *******************************************************************************/ 016package org.mitre.openid.connect.exception; 017 018import org.springframework.http.HttpStatus; 019 020/** 021 * Thrown by utility methods when a client fails to validate. Contains information 022 * to be returned. 023 * @author jricher 024 * 025 */ 026public class ValidationException extends Exception { 027 private static final long serialVersionUID = 1820497072989294627L; 028 029 private String error; 030 private String errorDescription; 031 private HttpStatus status; 032 public ValidationException(String error, String errorDescription, 033 HttpStatus status) { 034 this.error = error; 035 this.errorDescription = errorDescription; 036 this.status = status; 037 } 038 public String getError() { 039 return error; 040 } 041 public void setError(String error) { 042 this.error = error; 043 } 044 public String getErrorDescription() { 045 return errorDescription; 046 } 047 public void setErrorDescription(String errorDescription) { 048 this.errorDescription = errorDescription; 049 } 050 public HttpStatus getStatus() { 051 return status; 052 } 053 public void setStatus(HttpStatus status) { 054 this.status = status; 055 } 056 057 @Override 058 public String toString() { 059 return "ValidationException [error=" + error + ", errorDescription=" 060 + errorDescription + ", status=" + status + "]"; 061 } 062}