Package org.apache.commons.codec.binary

Examples of org.apache.commons.codec.binary.Base64.encode()


                password = "";

            if (type.equals(SSO_TYPE_URL_BASE64))
            {
                Base64 encoder = new Base64();
                userName = new String(encoder.encode(userName.getBytes()));
                password = new String(encoder.encode(password.getBytes()));
            }

            source.append(userName);
            source.append("&");
View Full Code Here


            if (type.equals(SSO_TYPE_URL_BASE64))
            {
                Base64 encoder = new Base64();
                userName = new String(encoder.encode(userName.getBytes()));
                password = new String(encoder.encode(password.getBytes()));
            }

            source.append(userName);
            source.append("&");
            source.append(passwordParam);
View Full Code Here

    private void marshalUrlSafe(Exchange exchange, Object graph, OutputStream stream) throws Exception {
        byte[] decoded = ExchangeHelper.convertToMandatoryType(exchange, byte[].class, graph);

        Base64 codec = new Base64(lineLength, lineSeparator, true);
        byte[] encoded = codec.encode(decoded);

        stream.write(encoded);
        stream.flush();
    }
View Full Code Here

            writer.close();
            zos.close();
            baos.close();

            Base64 base64Codec = new Base64();
            return new String(base64Codec.encode( baos.toByteArray() ), ZIP_CHARSET);
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
View Full Code Here

        request.addHeader( "User-Agent", "Apache Archiva unit test" );
        request.setMethod( "GET" );

        Encoder encoder = new Base64();
        String userPass = "unauthUser:unauthPass";
        String encodedUserPass = new String( (byte[]) encoder.encode( userPass.getBytes() ) );
        request.addHeader( "Authorization", "BASIC " + encodedUserPass );

        MockHttpServletResponse mockHttpServletResponse = new MockHttpServletResponse();
        rssFeedServlet.doGet( request, mockHttpServletResponse );
View Full Code Here

        }

        Base64 base64 = new Base64();

        try {
            byte[] byteData = base64.encode(bos.toByteArray());

            return new String(byteData);

        } catch (Throwable t) {
            String message =
View Full Code Here

       
        WebRequest request = new GetMethodWebRequest( "http://localhost/rss/rss_feeds?repoId=unauthorized-repo" );
       
        Encoder encoder = new Base64();
        String userPass = "unauthUser:unauthPass";
        String encodedUserPass = new String( ( byte[] ) encoder.encode( userPass.getBytes() ) );       
        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );       
       
        try
        {
            WebResponse response = client.getResponse( request );
View Full Code Here

        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/unauthorized-repo" );

        Encoder encoder = new Base64();
        String userPass = "unauthUser:unauthPass";
        String encodedUserPass = new String( (byte[]) encoder.encode( userPass.getBytes() ) );
        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );

        try
        {
            WebResponse resp = client.getResponse( request );
View Full Code Here

    try {
      cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE");
      coder = new Base64();
      cipher.init(Cipher.ENCRYPT_MODE, key);
      byte[] cipherText = cipher.doFinal(repoUserPassword.getBytes());
      encryptPassword = new String(coder.encode(cipherText));
    } catch (Exception e) {
      e.printStackTrace();
    }
    return encryptPassword;
  }
View Full Code Here

    }
   
    @Test
    public void decodeAndParse() throws Exception {
        final Base64 encoder = new Base64(true);
        final String encodedJSON = new String(encoder.encode("{\"some\": \"json\", \"number\": 123}".getBytes()));
        final JWTVerifier jwtVerifier = new JWTVerifier("secret", "audience");

        final JsonNode decodedJSON = jwtVerifier.decodeAndParse(encodedJSON);

        assertEquals("json", decodedJSON.get("some").asText());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.