Handles passing a buffer off to the sasl client for challenge evaluation @param b The buffer to process @return The results of the challenge if successful, or null if there was a SaslException. @throws IllegalStateException when processing of the action failed due to a PrivilegedActionException
(final byte[] b)
| 278 | * a PrivilegedActionException |
| 279 | */ |
| 280 | protected byte[] processChallenge(final byte[] b) { |
| 281 | try { |
| 282 | final class PrivilegedAction implements PrivilegedExceptionAction<byte[]> { |
| 283 | @Override |
| 284 | public byte[] run() { |
| 285 | try { |
| 286 | return sasl_client.evaluateChallenge(b); |
| 287 | } catch (SaslException e) { |
| 288 | LOG.error("Failed Sasl challenge", e); |
| 289 | return null; |
| 290 | } |
| 291 | } |
| 292 | @Override |
| 293 | public String toString() { |
| 294 | return "evaluate sasl challenge"; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | return Subject.doAs(client_auth_provider.getClientSubject(), |
| 299 | new PrivilegedAction()); |
| 300 | } catch (PrivilegedActionException e) { |
| 301 | throw new IllegalStateException("Failed to process challenge", e); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | } |
no test coverage detected