OPASecurityException.java
/*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.synapse.mediators.opa;
/**
* Exception to be thrown when a OPA mediator related error occurs
*/
public class OPASecurityException extends Exception {
public static final int INTERNAL_ERROR = 902011;
public static final String INTERNAL_ERROR_MESSAGE = "Unexpected OPA mediator failure";
public static final int ACCESS_REVOKED = 902012;
public static final String ACCESS_REVOKED_MESSAGE = "Request validation failure at the remote authorization server";
private int errorCode;
public OPASecurityException(String message) {
super(message);
}
public OPASecurityException(int errorCode, String message) {
super(message);
this.errorCode = errorCode;
}
public OPASecurityException(int errorCode, String message, Throwable cause) {
super(message, cause);
this.errorCode = errorCode;
}
public OPASecurityException(String message, Throwable cause) {
super(message, cause);
}
public OPASecurityException(Throwable cause) {
super(cause.getMessage(), cause);
}
public int getErrorCode() {
return errorCode;
}
}