org.apache.shiro.codec.Base64.encode()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中org.apache.shiro.codec.Base64.encode()方法的一些代码示例,展示了Base64.encode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.encode()方法的具体详情如下:
包路径:org.apache.shiro.codec.Base64
类名称:Base64
方法名:encode

Base64.encode介绍

[英]Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.
[中]将包含二进制数据的字节[]编码为包含Base64字母表中字符的字节[]。

代码示例

代码示例来源:origin: apache/shiro

/**
 * Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks
 *
 * @param binaryData binary data to encodeToChars
 * @return Base64 characters chunked in 76 character blocks
 */
public static byte[] encodeChunked(byte[] binaryData) {
  return encode(binaryData, true);
}

代码示例来源:origin: apache/shiro

/**
 * Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.
 *
 * @param pArray a byte array containing binary data
 * @return A byte array containing only Base64 character data
 */
public static byte[] encode(byte[] pArray) {
  return encode(pArray, false);
}

代码示例来源:origin: apache/shiro

protected static String getBasicAuthorizationHeaderValue(String username, String password) throws UnsupportedEncodingException {
  String authorizationHeader = username + ":" + password;
  byte[] valueBytes;
  valueBytes = authorizationHeader.getBytes("UTF-8");
  authorizationHeader = new String(Base64.encode(valueBytes));
  return "Basic " + authorizationHeader;
}

代码示例来源:origin: apache/shiro

/**
 * Base64 encodes the specified byte array and then encodes it as a String using Shiro's preferred character
 * encoding (UTF-8).
 *
 * @param bytes the byte array to Base64 encode.
 * @return a UTF-8 encoded String of the resulting Base64 encoded byte array.
 */
public static String encodeToString(byte[] bytes) {
  byte[] encoded = encode(bytes);
  return CodecSupport.toString(encoded);
}

代码示例来源:origin: tomoya92/pybbs

@Bean
@DependsOn("mybatisPlusConfig")
public CookieRememberMeManager rememberMeManager() {
 //System.out.println("ShiroConfiguration.rememberMeManager()");
 CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
 cookieRememberMeManager.setCookie(rememberMeCookie());
 //rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位)
 cookieRememberMeManager.setCipherKey(Base64.encode("pybbs is the best!".getBytes()));
 return cookieRememberMeManager;
}

代码示例来源:origin: org.apache.shiro/shiro-lang

/**
 * Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks
 *
 * @param binaryData binary data to encodeToChars
 * @return Base64 characters chunked in 76 character blocks
 */
public static byte[] encodeChunked(byte[] binaryData) {
  return encode(binaryData, true);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

/**
 * Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.
 *
 * @param pArray a byte array containing binary data
 * @return A byte array containing only Base64 character data
 */
public static byte[] encode(byte[] pArray) {
  return encode(pArray, false);
}

代码示例来源:origin: org.apache.shiro/shiro-lang

/**
 * Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.
 *
 * @param pArray a byte array containing binary data
 * @return A byte array containing only Base64 character data
 */
public static byte[] encode(byte[] pArray) {
  return encode(pArray, false);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

/**
 * Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks
 *
 * @param binaryData binary data to encodeToChars
 * @return Base64 characters chunked in 76 character blocks
 */
public static byte[] encodeChunked(byte[] binaryData) {
  return encode(binaryData, true);
}

代码示例来源:origin: org.apache.shiro.integrationtests/shiro-its-support

protected static String getBasicAuthorizationHeaderValue(String username, String password) throws UnsupportedEncodingException {
  String authorizationHeader = username + ":" + password;
  byte[] valueBytes;
  valueBytes = authorizationHeader.getBytes("UTF-8");
  authorizationHeader = new String(Base64.encode(valueBytes));
  return "Basic " + authorizationHeader;
}

代码示例来源:origin: org.apache.shiro/shiro-lang

/**
 * Base64 encodes the specified byte array and then encodes it as a String using Shiro's preferred character
 * encoding (UTF-8).
 *
 * @param bytes the byte array to Base64 encode.
 * @return a UTF-8 encoded String of the resulting Base64 encoded byte array.
 */
public static String encodeToString(byte[] bytes) {
  byte[] encoded = encode(bytes);
  return CodecSupport.toString(encoded);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

/**
 * Base64 encodes the specified byte array and then encodes it as a String using Shiro's preferred character
 * encoding (UTF-8).
 *
 * @param bytes the byte array to Base64 encode.
 * @return a UTF-8 encoded String of the resulting Base64 encoded byte array.
 */
public static String encodeToString(byte[] bytes) {
  byte[] encoded = encode(bytes);
  return CodecSupport.toString(encoded);
}

代码示例来源:origin: theonedev/onedev

@Override
protected void onSubmit() {
  super.onSubmit();
  
  token = new String(Base64.encode((getUser().getName() + ":" + bean.getPassword()).getBytes()));
  
  bean.setPassword(null);
  replace(BeanContext.editBean("editor", bean));
}

相关文章