1 modulehunt.shiro.Exceptions;
2 3 importhunt.Exceptions;
4 5 6 classShiroException : Exception {
7 mixinBasicExceptionCtors;
8 }
9 10 classAuthenticationException : ShiroException {
11 mixinBasicExceptionCtors;
12 }
13 14 /**
15 * Exception thrown if there is a problem during authorization (access control check).
16 */17 classAuthorizationException : ShiroException {
18 mixinBasicExceptionCtors;
19 }
20 21 /**
22 * Root class of all Shiro exceptions related to caching operations.
23 *
24 * @since 0.2
25 */26 classCacheException : ShiroException {
27 mixinBasicExceptionCtors;
28 }
29 30 /**
31 * Root exception related to issues during encoding or decoding.
32 *
33 * @since 0.9
34 */35 classCodecException : ShiroException {
36 mixinBasicExceptionCtors;
37 }
38 39 /**
40 * Root exception indicating there was a problem parsing or processing the Shiro configuration.
41 *
42 * @since 0.9
43 */44 // class ConfigurationException : ShiroException{45 // mixin BasicExceptionCtors;46 // }47 48 /**
49 * Base Shiro exception for problems encountered during cryptographic operations.
50 *
51 * @since 1.0
52 */53 classCryptoException : ShiroException {
54 mixinBasicExceptionCtors;
55 }
56 57 /**
58 * Generic exception representing a problem when attempting to access data.
59 * <p/>
60 * The idea was borrowed from the Spring Framework, which has a nice model for a generic DAO exception hierarchy.
61 * Unfortunately we can't use it as we can't force a Spring API usage on all Shiro end-users.
62 */63 classDataAccessException : ShiroException {
64 mixinBasicExceptionCtors;
65 }
66 67 /**
68 * Exception thrown for errors related to {@link Environment} instances or configuration.
69 */70 classEnvironmentException : ShiroException {
71 mixinBasicExceptionCtors;
72 }
73 74 /**
75 * Thrown by {@link PermissionResolver#resolvePermission(string)} when the string being parsed is not
76 * valid for that resolver.
77 */78 classInvalidPermissionStringException : ShiroException {
79 mixinBasicExceptionCtors;
80 }
81 82 /**
83 * General security exception attributed to problems during interaction with the system during
84 * a session.
85 *
86 */87 classSessionException : ShiroException {
88 mixinBasicExceptionCtors;
89 }
90 91 classUnavailableSecurityManagerException : ShiroException {
92 mixinBasicExceptionCtors;
93 }
94 95 96 /**
97 * Exception thrown when attempting to acquire an object of a required type and that object does not equal, extend, or
98 * implement a specified {@code Class}.
99 */100 classRequiredTypeException : EnvironmentException {
101 mixinBasicExceptionCtors;
102 }
103 104 classAccountException : AuthenticationException {
105 mixinBasicExceptionCtors;
106 }
107 108 classCredentialsException : AuthenticationException {
109 mixinBasicExceptionCtors;
110 }
111 112 /**
113 * Exception thrown during the authentication process when an
114 * {@link hunt.shiro.authc.AuthenticationToken AuthenticationToken} implementation is encountered that is not
115 * supported by one or more configured {@link hunt.shiro.realm.Realm Realm}s.
116 *
117 * @see hunt.shiro.authc.pam.AuthenticationStrategy
118 */119 classUnsupportedTokenException : AuthenticationException {
120 mixinBasicExceptionCtors;
121 }
122 123 124 classConcurrentAccessException : AccountException {
125 mixinBasicExceptionCtors;
126 }
127 128 129 classDisabledAccountException : AccountException {
130 mixinBasicExceptionCtors;
131 }
132 133 classExcessiveAttemptsException : AccountException {
134 mixinBasicExceptionCtors;
135 }
136 137 /**
138 * Thrown during the authentication process when the system determines the submitted credential(s)
139 * has expired and will not allow login.
140 *
141 * <p>This is most often used to alert a user that their credentials (e.g. password or
142 * cryptography key) has expired and they should change the value. In such systems, the component
143 * invoking the authentication might catch this exception and redirect the user to an appropriate
144 * view to allow them to update their password or other credentials mechanism.
145 *
146 */147 classExpiredCredentialsException : CredentialsException {
148 mixinBasicExceptionCtors;
149 }
150 151 /**
152 * Thrown when attempting to authenticate with credential(s) that do not match the actual
153 * credentials associated with the account principal.
154 *
155 * <p>For example, this exception might be thrown if a user's password is "secret" and
156 * "secrets" was entered by mistake.
157 *
158 * <p>Whether or not an application wishes to let
159 * the user know if they entered incorrect credentials is at the discretion of those
160 * responsible for defining the view and what happens when this exception occurs.
161 *
162 */163 classIncorrectCredentialsException : CredentialsException {
164 mixinBasicExceptionCtors;
165 }
166 167 /**
168 * A special kind of <tt>DisabledAccountException</tt>, this exception is thrown when attempting
169 * to authenticate and the corresponding account has been disabled explicitly due to being locked.
170 *
171 * <p>For example, an account can be locked if an administrator explicitly locks an account or
172 * perhaps an account can be locked automatically by the system if too many unsuccessful
173 * authentication attempts take place during a specific period of time (perhaps indicating a
174 * hacking attempt).
175 *
176 */177 classLockedAccountException : DisabledAccountException {
178 mixinBasicExceptionCtors;
179 }
180 181 182 /**
183 * Exception thrown if attempting to create a new {@code Subject}
184 * {@link hunt.shiro.subject.Subject#getSession() session}, but that {@code Subject}'s sessions are disabled.
185 * <p/>
186 * Note that this exception represents an invalid API usage scenario - where Shiro has been configured to disable
187 * sessions for a particular subject, but a developer is attempting to use that Subject's session.
188 * <p/>
189 * In other words, if this exception is encountered, it should be resolved by a configuration change for Shiro and
190 * <em>not</em> by checking every Subject to see if they are enabled or not (which would likely introduce very
191 * ugly/paranoid code checks everywhere a session is needed). This is why there is no
192 * {@code subject.isSessionEnabled()} method.
193 */194 classDisabledSessionException : SessionException {
195 mixinBasicExceptionCtors;
196 }
197 198 /**
199 * A special case of a StoppedSessionException. An expired session is a session that has
200 * stopped explicitly due to inactivity (i.e. time-out), as opposed to stopping due to log-out or
201 * other reason.
202 *
203 */204 classExpiredSessionException : StoppedSessionException {
205 mixinBasicExceptionCtors;
206 }
207 208 209 /**
210 * Exception thrown when attempting to interact with the system under the pretense of a
211 * particular session (e.g. under a specific session id), and that session does not exist in
212 * the system.
213 */214 classUnknownSessionException : InvalidSessionException {
215 mixinBasicExceptionCtors;
216 }
217 218 /**
219 * Exception thrown when attempting to interact with the system under a session that has been
220 * stopped. A session may be stopped in any number of ways, most commonly due to explicit
221 * stopping (e.g. from logging out), or due to expiration.
222 */223 classStoppedSessionException : InvalidSessionException {
224 mixinBasicExceptionCtors;
225 }
226 227 /**
228 * Exception thrown when attempting to interact with the system under an established session
229 * when that session is considered invalid. The meaning of the term 'invalid' is based on
230 * application behavior. For example, a Session is considered invalid if it has been explicitly
231 * stopped (e.g. when a user logs-out or when explicitly
232 * {@link Session#stop() stopped} programmatically. A Session can also be
233 * considered invalid if it has expired.
234 *
235 * @see StoppedSessionException
236 * @see ExpiredSessionException
237 * @see UnknownSessionException
238 */239 classInvalidSessionException : SessionException {
240 mixinBasicExceptionCtors;
241 }
242 243 244 /**
245 * Root exception indicating invalid or incorrect usage of a data access resource. This is thrown
246 * typically when incorrectly using the resource or its API.
247 */248 classInvalidResourceUsageException : DataAccessException {
249 mixinBasicExceptionCtors;
250 }
251 252 253 /**
254 * Exception thrown when attempting to execute an authorization action when a successful
255 * authentication hasn't yet occurred.
256 *
257 * <p>Authorizations can only be performed after a successful
258 * authentication because authorization data (roles, permissions, etc) must always be associated
259 * with a known identity. Such a known identity can only be obtained upon a successful log-in.
260 */261 classUnauthenticatedException : AuthorizationException {
262 mixinBasicExceptionCtors;
263 }
264 265 /**
266 * Thrown to indicate a requested operation or access to a requested resource is not allowed.
267 */268 classUnauthorizedException : AuthorizationException {
269 mixinBasicExceptionCtors;
270 }
271 272 /**
273 * Thrown when a particular client (that is, host address) has not been enabled to access the system
274 * or if the client has been enabled access but is not permitted to perform a particular operation
275 * or access a particular resource.
276 *
277 */278 classHostUnauthorizedException : UnauthorizedException {
279 mixinBasicExceptionCtors;
280 }
281 282 283 /**
284 * Exception thrown when attempting to lookup or use a cryptographic algorithm that does not exist in the current
285 * JVM environment.
286 *
287 * @since 1.2
288 */289 publicclassUnknownAlgorithmException : CryptoException {
290 mixinBasicExceptionCtors;
291 }
292 293 294 /**
295 * Thrown when attempting to authenticate with a principal that doesn't exist in the system (e.g.
296 * by specifying a username that doesn't relate to a user account).
297 *
298 * <p>Whether or not an application wishes to alert a user logging in to the system of this fact is
299 * at the discretion of those responsible for designing the view and what happens when this
300 * exception occurs.
301 *
302 */303 classUnknownAccountException : AccountException {
304 mixinBasicExceptionCtors;
305 }
306 307 308 /**
309 * Exception thrown when a reference to an object is made, but that object cannot be found. This is most likely
310 * thrown due to a configuration line that references an object that hasn't been defined yet.
311 *
312 * @since 0.9 RC2
313 */314 classUnresolveableReferenceException : ConfigurationException {
315 mixinBasicExceptionCtors;
316 }