Package com.atlassian.jwt

Examples of com.atlassian.jwt.CanonicalHttpRequest


        return Arrays.asList(request.headers().get(headerName));
    }

    @Override
    public CanonicalHttpRequest getCanonicalHttpRequest() {
        return new CanonicalHttpRequest() {
            @Nonnull
            @Override
            public String getMethod() {
                return request.method();
            }
View Full Code Here


        return headerValues != null ? Arrays.asList(headerValues) : ImmutableList.<String>of();
    }

    @Override
    public CanonicalHttpRequest getCanonicalHttpRequest() {
        return new CanonicalHttpRequest() {
            @Nonnull
            @Override
            public String getMethod() {
                return request.method();
            }
View Full Code Here

    private JsonSmartJwtJsonBuilderFactory builderFactory = new JsonSmartJwtJsonBuilderFactory();
    private NimbusJwtWriterFactory writerFactory = new NimbusJwtWriterFactory();

    private String createJwt() throws UnsupportedEncodingException, NoSuchAlgorithmException {
        CanonicalHttpRequest canonicalHttpRequest  = new CanonicalHttpUriRequest(METHOD, PATH, "/");
        String hash = HttpRequestCanonicalizer.computeCanonicalRequestHash(canonicalHttpRequest);
        long now = System.currentTimeMillis();
        String json = builderFactory.jsonBuilder()
                .issuer(ISSUER)
                .issuedAt(now)
View Full Code Here

    // If the separator is not URL encoded then the following URLs have the same query-string-hash:
    //   https://djtest9.jira-dev.com/rest/api/2/project&a=b?x=y
    //   https://djtest9.jira-dev.com/rest/api/2/project?a=b&x=y
    @Test
    public void ampersandsInPathAreNotAmbiguous() throws UnsupportedEncodingException {
        CanonicalHttpRequest request1 = new CanonicalHttpUriRequest(METHOD, "/path&a=b", "/", ImmutableMap.<String, String[]>of("x", new String[]{"y"}));
        CanonicalHttpRequest request2 = new CanonicalHttpUriRequest(METHOD, "/path", "/", ImmutableMap.<String, String[]>of("a", new String[]{"b"}, "x", new String[]{"y"}));
        assertThat(HttpRequestCanonicalizer.canonicalize(request1), is(not(HttpRequestCanonicalizer.canonicalize(request2))));
    }
View Full Code Here

        assertThat(HttpRequestCanonicalizer.canonicalize(request1), is(not(HttpRequestCanonicalizer.canonicalize(request2))));
    }

    @Test
    public void anAmpersandInThePathIsUrlEncoded() throws UnsupportedEncodingException {
        CanonicalHttpRequest request = new CanonicalHttpUriRequest("POST", "/path&a=b", "/", ImmutableMap.<String, String[]>of("x", new String[]{"y"}));
        assertThat(HttpRequestCanonicalizer.canonicalize(request), is("POST&/path%26a=b&x=y"));
    }
View Full Code Here

        assertThat(HttpRequestCanonicalizer.canonicalize(request), is("POST&/path%26a=b&x=y"));
    }

    @Test
    public void multipleAmpersandsInThePathAreAllUrlEncoded() throws UnsupportedEncodingException {
        CanonicalHttpRequest request = new CanonicalHttpUriRequest("POST", "/path&a=b&c=d", "/", ImmutableMap.<String, String[]>of("x", new String[]{"y"}));
        assertThat(HttpRequestCanonicalizer.canonicalize(request), is("POST&/path%26a=b%26c=d&x=y"));
    }
View Full Code Here

    private JsonSmartJwtJsonBuilderFactory builderFactory = new JsonSmartJwtJsonBuilderFactory();
    private NimbusJwtWriterFactory writerFactory = new NimbusJwtWriterFactory();

    private String createJwt() throws UnsupportedEncodingException, NoSuchAlgorithmException {
        CanonicalHttpRequest canonicalHttpRequest  = new CanonicalHttpUriRequest(METHOD, PATH, "/");
        String hash = HttpRequestCanonicalizer.computeCanonicalRequestHash(canonicalHttpRequest);
        long now = System.currentTimeMillis();
        String json = builderFactory.jsonBuilder()
                .issuer(ISSUER)
                .issuedAt(now)
View Full Code Here

    private JsonSmartJwtJsonBuilderFactory builderFactory = new JsonSmartJwtJsonBuilderFactory();
    private NimbusJwtWriterFactory writerFactory = new NimbusJwtWriterFactory();

    private String createJwt() throws UnsupportedEncodingException, NoSuchAlgorithmException {
        CanonicalHttpRequest canonicalHttpRequest  = new CanonicalHttpUriRequest(METHOD, PATH, "/");
        String hash = HttpRequestCanonicalizer.computeCanonicalRequestHash(canonicalHttpRequest);
        long now = System.currentTimeMillis();
        String json = builderFactory.jsonBuilder()
                .issuer(ISSUER)
                .issuedAt(now)
View Full Code Here

        return Arrays.asList(request.headers().get(headerName));
    }

    @Override
    public CanonicalHttpRequest getCanonicalHttpRequest() {
        return new CanonicalHttpRequest() {
            @Nonnull
            @Override
            public String getMethod() {
                return request.method();
            }
View Full Code Here

TOP

Related Classes of com.atlassian.jwt.CanonicalHttpRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.