Package com.atlassian.jwt.httpclient

Examples of com.atlassian.jwt.httpclient.CanonicalHttpUriRequest


            if (!StringUtils.isEmpty(targetPath.getQuery())) {
                completeParams = new HashMap<String, String[]>(params);
                completeParams.putAll(constructParameterMap(targetPath));
            }

            CanonicalHttpUriRequest canonicalHttpUriRequest = new CanonicalHttpUriRequest(httpMethod.toString(),
                    targetPath.getPath(), "", completeParams);

            LOGGER.debug("Canonical request is: " + CanonicalRequestUtil.toVerboseString(canonicalHttpUriRequest));

            JwtClaimsBuilder.appendHttpRequestClaims(jsonBuilder, canonicalHttpUriRequest);
View Full Code Here


            if (!StringUtils.isEmpty(targetPath.getQuery())) {
                completeParams = new HashMap<String, String[]>(params);
                completeParams.putAll(constructParameterMap(targetPath));
            }

            CanonicalHttpUriRequest canonicalHttpUriRequest = new CanonicalHttpUriRequest(httpMethod.toString(),
                    targetPath.getPath(), "", completeParams);

            LOGGER.debug("Canonical request is: " + CanonicalRequestUtil.toVerboseString(canonicalHttpUriRequest));

            JwtClaimsBuilder.appendHttpRequestClaims(jsonBuilder, canonicalHttpUriRequest);
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

            if (!StringUtils.isEmpty(targetPath.getQuery())) {
                completeParams = new HashMap<String, String[]>(params);
                completeParams.putAll(constructParameterMap(targetPath));
            }

            CanonicalHttpUriRequest canonicalHttpUriRequest = new CanonicalHttpUriRequest(httpMethod.toString(),
                    targetPath.getPath(), "", completeParams);

            LOGGER.debug("Canonical request is: " + CanonicalRequestUtil.toVerboseString(canonicalHttpUriRequest));

            JwtClaimsBuilder.appendHttpRequestClaims(jsonBuilder, canonicalHttpUriRequest);
View Full Code Here

TOP

Related Classes of com.atlassian.jwt.httpclient.CanonicalHttpUriRequest

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.