Class AuthorizationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
net.solarnetwork.central.security.SecurityException
net.solarnetwork.central.security.AuthorizationException
- All Implemented Interfaces:
Serializable
Exception thrown when authorization to some resource fails.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAuthorization exception reason. -
Constructor Summary
ConstructorsConstructorDescriptionAuthorizationException(String username, AuthorizationException.Reason reason) Construct authorization exception.Construct authorization exception related to some primary key.AuthorizationException(AuthorizationException.Reason reason, Object id, Throwable cause) Construct authorization exception related to some primary key and cause. -
Method Summary
Modifier and TypeMethodDescriptiongetEmail()Get the attempted login.getId()Get the primary key.Get the authorization exception reason.static <T> TrequireNonNullObject(T object, Object id) Helper for validating an object is not null, throwing an exception otherwise.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
AuthorizationException
Construct authorization exception.- Parameters:
username- the attempted loginreason- the reason for the exception
-
AuthorizationException
Construct authorization exception related to some primary key.- Parameters:
reason- the reason for the exceptionid- the object ID
-
AuthorizationException
Construct authorization exception related to some primary key and cause.- Parameters:
reason- the reason for the exceptionid- the object IDcause- a cause- Since:
- 1.3
-
-
Method Details
-
requireNonNullObject
Helper for validating an object is not null, throwing an exception otherwise.- Type Parameters:
T- the object type- Parameters:
object- the object that must not be nullid- the ID associated with the object- Returns:
object- Throws:
AuthorizationException- with aAuthorizationException.Reason.UNKNOWN_OBJECTifobjectis null- Since:
- 1.2
-
getEmail
Get the attempted login.- Returns:
- login value (or null if not available)
-
getId
Get the primary key.- Returns:
- the primary key (or null if not available)
-
getReason
Get the authorization exception reason.- Returns:
- reason
-
getMessage
- Overrides:
getMessagein classThrowable
-