src/test/java/edu/ucla/library/iiif/auth/handlers/AccessTokenHandlerIT.java
@Test
    public void testGetTokenInvalidCookie(final Vertx aVertx, final VertxTestContext aContext) {
        final String cookieHeader = "iiif-access=invalid";
        final HttpRequest<?> getToken = myWebClient.get(myPort, TestConstants.INADDR_ANY, GET_TOKEN_PATH)
                .putHeader(HttpHeaders.COOKIE.toString(), cookieHeader);

        getToken.send().onSuccess(response -> {
            assertEquals(HTTP.BAD_REQUEST, response.statusCode());
            assertEquals(MediaType.APPLICATION_JSON.toString(), response.headers().get(HttpHeaders.CONTENT_TYPE));

            aContext.completeNow();
        }).onFailure(aContext::failNow);
    }
/**
     * Tests that a client can't use an invalid access cookie to obtain an access token.
     *
     * @param aVertx A Vert.x instance
     * @param aContext A test context
     */
Tests that a client can't use an invalid access cookie to obtain an access token.
@param aVertx A Vert.x instance
@param aContext A test context
Tests that a client can ' t use an invalid access cookie to obtain an access token . @param aVertx A Vert . x instance @param aContext A test context
@Test
    public void testGetTokenInvalidCookie(final Vertx aVertx, final VertxTestContext aContext) {
        final String cookieHeader = "iiif-access=invalid";
        final HttpRequest<?> getToken = myWebClient.get(myPort, TestConstants.INADDR_ANY, GET_TOKEN_PATH)
                .putHeader(HttpHeaders.COOKIE.toString(), cookieHeader);
        getToken.send().onSuccess(response -> {
            assertEquals(HTTP.BAD_REQUEST, response.statusCode());
            assertEquals(MediaType.APPLICATION_JSON.toString(), response.headers().get(HttpHeaders.CONTENT_TYPE));
            aContext.completeNow();
        }).onFailure(aContext::failNow);
    }
@ Test public void testGetTokenInvalidCookie ( final Vertx aVertx , final VertxTestContext aContext ) { final String cookieHeader = "iiif-access=invalid" ; final HttpRequest < ? > getToken = myWebClient . get ( myPort , TestConstants . INADDR_ANY , GET_TOKEN_PATH ) . putHeader ( HttpHeaders . COOKIE . toString ( ) , cookieHeader ) ; getToken . send ( ) . onSuccess ( response -> { assertEquals ( HTTP . BAD_REQUEST , response . statusCode ( ) ) ; assertEquals ( MediaType . APPLICATION_JSON . toString ( ) , response . headers ( ) . get ( HttpHeaders . CONTENT_TYPE ) ) ; aContext . completeNow ( ) ; } ) . onFailure ( aContext :: failNow ) ; }
Tests that a client can't use an invalid access cookie to obtain an access token.
Tests that a client can ' t use an invalid access cookie to obtain an access token .