blob: 5610a71d521ee6f2bde694e999a82a3cbf90cc80 [file] [log] [blame]
/*
* Copyright 2017 The Mifos Initiative.
*
* Licensed 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 io.mifos.anubis.security;
import org.springframework.security.core.AuthenticationException;
/**
* @author Markus Geiß, Myrle Krantz
*/
@SuppressWarnings("WeakerAccess")
public class AmitAuthenticationException extends AuthenticationException {
private AmitAuthenticationException(final String message) { super(message); }
public static AmitAuthenticationException internalError(final String message) {
return new AmitAuthenticationException(message);
}
public static AmitAuthenticationException invalidTokenAlgorithm(final String algorithm) {
return new AmitAuthenticationException("Unsupported algorithm: " + algorithm);
}
public static AmitAuthenticationException invalidTokenIssuer(final String issuer) {
return new AmitAuthenticationException("Unsupported token issuer: " + issuer);
}
public static AmitAuthenticationException invalidToken() {
return new AmitAuthenticationException("Token is invalid.");
}
public static AmitAuthenticationException invalidHeader() {
return new AmitAuthenticationException("Invalid authorization header.");
}
public static AmitAuthenticationException invalidTokenVersion(final String issuer, final String version) {
return new AmitAuthenticationException(
"Token version " + version + " not accepted for issuer " + issuer + ".");
}
public static AmitAuthenticationException missingTenant() {
return new AmitAuthenticationException("Tenant not set.");
}
public static AmitAuthenticationException missingTokenContent() {
return new AmitAuthenticationException("Token does not contain content. Perhaps you submitted a refresh token instead of the access token?");
}
@SuppressWarnings("unused") //used in isis
public static AmitAuthenticationException userPasswordCombinationNotFound() {
return new AmitAuthenticationException("A user with the given useridentifier and password doesn't exist.");
}
@SuppressWarnings("unused") //used in isis
public static AmitAuthenticationException passwordExpired() {
return new AmitAuthenticationException("Users password has expired.");
}
}