Examples of Base64


Examples of com.substanceofcode.utils.Base64

    //#endif
    final String[] nitemArrayData = new String[itemArrayData.length];
    if (sencoded) {
      for (int ic = 0; ic < itemArrayData.length; ic++) {
        // Base64 decode
        Base64 b64 = new Base64();
        byte[] decodedData = b64.decode(itemArrayData[ic]);
        try {
          nitemArrayData[ic] = new String( decodedData, "UTF-8" );
        } catch (UnsupportedEncodingException e) {
          nitemArrayData[ic] = new String( decodedData );
        }
      }
      nodes[itemsOff] = StringUtil.join(nitemArrayData, RssFeed.CTWO, 0);
      nodes[itemsOff] = nodes[itemsOff].replace('|', RssFeed.CTHREE);
    } else {
      //#ifdef DTEST
      lngStart = System.currentTimeMillis();
      //#endif
      for (int ic = 0; ic < itemArrayData.length; ic++) {
        // Base64 decode
        Base64 b64 = new Base64();
        String data;
        try {
          nitemArrayData[ic] = b64.encode(
              itemArrayData[ic].getBytes("UTF-8") );
        } catch (UnsupportedEncodingException e) {
          nitemArrayData[ic] = b64.encode(
              itemArrayData[ic].getBytes() );
        }
      }
      //#ifdef DTEST
      encodeTime += System.currentTimeMillis() - lngStart;
View Full Code Here

Examples of de.innovationgate.utils.Base64

                encoder = (PasswordOptionEncoder) passwordEncoderClass.newInstance();
            }
            else {
                getLog().error("Unknown password encoder key " + passwordEncoderKey);
                getLog().error("Falling back to Base64 encoder for encoding new passwords");
                encoder = new Base64();
            }
        }
        catch (Exception e1) {
            getLog().error("Exception creating password encoder " + passwordEncoderKey, e1);
            getLog().error("Falling back to Base64 encoder for encoding new passwords");
            encoder = new Base64();
        }
        _moduleRegistry.getContextObjects().put(PasswordEncodingType.class, encoder);
      

       
View Full Code Here

Examples of edu.harvard.hul.ois.mets.helper.Base64

            MdWrap rightsMDWrap = new MdWrap();
            rightsMDWrap.setMIMETYPE(mimeType);
            rightsMDWrap.setMDTYPE(Mdtype.OTHER);
            rightsMDWrap.setOTHERMDTYPE(mdType);
            BinData bin = new BinData();
            bin.getContent().add(new Base64(is));
            rightsMDWrap.getContent().add(bin);
            rightsMD.getContent().add(rightsMDWrap);
        }
        else
        {
View Full Code Here

Examples of org.apache.commons.codec.binary.Base64

                        SynapseConstants.SYNPASE_HTTP_PROXY_USER);
                String password = synapseProperties.getProperty(
                        SynapseConstants.SYNPASE_HTTP_PROXY_PASSWORD);
                if (userName != null && password != null) {
                    String header = userName + ":" + password;
                    byte[] encodedHeaderBytes = new Base64().encode(header.getBytes());
                    String encodedHeader = new String(encodedHeaderBytes);

                    connection.setRequestProperty("Proxy-Authorization", "Basic " + encodedHeader);
                }
            } else {
View Full Code Here

Examples of org.apache.commons.codec.binary.Base64

        byte[] data;
        byte[] rawHmac;
        try {
            data = stringToSign.getBytes(UTF8_CHARSET);
            rawHmac = mac.doFinal(data);
            Base64 encoder = new Base64();
            signature = new String(encoder.encode(rawHmac));
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(UTF8_CHARSET + " is unsupported!", e);
        }
        return signature;
    }
View Full Code Here

Examples of org.apache.commons.codec.binary.Base64

        if (key.indexOf(".account") != -1) {
          acPassEntry.setAccountName(URLEncoder.encode(authProps.getProperty(key), "UTF-8"));
          mLog.debug("Found account name: " + acPassEntry.getAccountName() + " for auth entry: " + url);
        } else if (key.indexOf(".password") != -1) {
          Base64 decoder = new Base64();
          acPassEntry.setPassword(new String(decoder.decode(authProps.getProperty(key))));
          mLog.debug("Found password for auth entry: " + url);
        }
        // write the updated entry back to hashtable
        mLog.debug("write entry for url >" + url + "<" + " with username/password into authentication store.");
        accountPasswordStore.put(url, acPassEntry);
View Full Code Here

Examples of org.apache.commons.codec.binary.Base64

   private static void accessEndUserResource(String relativeURI) throws Exception
   {
       HttpClient client = new HttpClient();
       GetMethod method = new GetMethod(EndUserResourceURL + relativeURI);
      
       Base64 base64 = new Base64();
       String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
       method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
      
       int status = client.executeMethod(method);
       if ("/invisible".equals(relativeURI)) {
           if (status != 401) {
View Full Code Here

Examples of org.apache.commons.codec.binary.Base64

   {
      HttpClient client = new HttpClient();
      GetMethod method = new GetMethod(url);
      // request that XML formatted authorization request is presented
      method.addRequestHeader(new Header("Accept", "application/xml"));
      Base64 base64 = new Base64();
      String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
      method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
     
      int status = client.executeMethod(method);
      if (200 != status) {
          throw new RuntimeException("No authorization request data is available");
View Full Code Here

Examples of org.apache.commons.codec.binary.Base64

  
   public String confirmAuthorization(String url) throws Exception
   {
      HttpClient client = new HttpClient();
      PostMethod method = new PostMethod(url);
      Base64 base64 = new Base64();
      String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
      method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
     
      int status = client.executeMethod(method);
      if (302 != status) {
          throw new RuntimeException("Initiation failed");
View Full Code Here

Examples of org.apache.commons.codec.binary.Base64

            FilterChain filterChain) throws IOException, ServletException {
        String header = request.getHeader("Authorization");
        if (header != null && header.startsWith("Basic"))
        {
            String base64Value = header.substring(6);
            Base64 base64 = new Base64();
            String decoded = new String(base64.decode(base64Value.getBytes()));
            String[] pair = decoded.split(":");
            String username = pair[0];
            String password = pair[1];
            request = createSecurityContext(request, username, password);
            filterChain.doFilter(request, response);
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.