@Test public void shouldThrowRestAuthExceptionWhenReconstructingAuthIdFails() { given(jwtBuilderFactory.reconstruct("AUTH_ID", SignedJwt.class)).willThrow(JwtRuntimeException.class); RestAuthException exception = null; boolean exceptionCaught = false; try { authIdHelper.reconstructAuthId("AUTH_ID"); fail(); } catch (RestAuthException e) { exception = e; exceptionCaught = true; } assertTrue(exceptionCaught); Response response = exception.getResponse(); assertEquals(response.getStatus(), 400); JsonValue jsonValue = JsonValueBuilder.toJsonValue((String) response.getEntity()); assertTrue(jsonValue.isDefined("errorMessage")); }
public SignedJwt reconstructAuthId(String authId) { try { return jwtBuilderFactory.reconstruct(authId, SignedJwt.class); } catch (JwtRuntimeException e) { throw new RestAuthException(Response.Status.BAD_REQUEST, "Failed to parse JWT, " + e.getLocalizedMessage(), e); } }
AuthIdHelper { public SignedJwt reconstructAuthId(String authId) { try { return jwtBuilderFactory.reconstruct(authId, SignedJwt.class); } catch (JwtRuntimeException e) { throw new RestAuthException(Response.Status.BAD_REQUEST, "Failed to parse JWT, " + e.getLocalizedMessage(), e); } } }
AuthIdHelper { public SignedJwt reconstructAuthId(String authId) { try { return jwtBuilderFactory.reconstruct(authId, SignedJwt.class); } catch (JwtRuntimeException e) { throw new RestAuthException(Response.Status.BAD_REQUEST, "Failed to parse JWT, " + e.getLocalizedMessage(), e); } } @Inject  AuthIdHelper(CoreServicesWrapper coreServicesWrapper, AMKeyProvider amKeyProvider,
            JwtBuilderFactory jwtBuilderFactory); }
AuthIdHelper { public SignedJwt reconstructAuthId(String authId) { try { return jwtBuilderFactory.reconstruct(authId, SignedJwt.class); } catch (JwtRuntimeException e) { throw new RestAuthException(Response.Status.BAD_REQUEST, "Failed to parse JWT, " + e.getLocalizedMessage(), e); } } @Inject  AuthIdHelper(CoreServicesWrapper coreServicesWrapper, AMKeyProvider amKeyProvider,
            JwtBuilderFactory jwtBuilderFactory); String createAuthId(LoginConfiguration loginConfiguration, AuthenticationContext authContext); SignedJwt reconstructAuthId(String authId); void verifyAuthId(String realmDN, String authId); }
AuthIdHelper { public SignedJwt reconstructAuthId(String authId) { try { return jwtBuilderFactory.reconstruct(authId, SignedJwt.class); } catch (JwtRuntimeException e) { throw new RestAuthException(Response.Status.BAD_REQUEST, "Failed to parse JWT, " + e.getLocalizedMessage(), e); } } @Inject  AuthIdHelper(CoreServicesWrapper coreServicesWrapper, AMKeyProvider amKeyProvider,
            JwtBuilderFactory jwtBuilderFactory); String createAuthId(LoginConfiguration loginConfiguration, AuthenticationContext authContext); SignedJwt reconstructAuthId(String authId); void verifyAuthId(String realmDN, String authId);  }