Class AuthenticationUtils

java.lang.Object
net.solarnetwork.web.security.AuthenticationUtils

public final class AuthenticationUtils extends Object
Utility methods for authentication support.
Version:
1.0
Author:
matt
  • Constructor Details

    • AuthenticationUtils

      public AuthenticationUtils()
  • Method Details

    • httpDate

      public static String httpDate(Date date)
      Get a HTTP formatted date.
      Parameters:
      date - The date to format.
      Returns:
      The formatted date.
    • iso8601Date

      public static String iso8601Date(Date date)
      Get an ISO8601 formatted date.
      Parameters:
      date - The date to format.
      Returns:
      The formatted date.
    • uriEncode

      public static String uriEncode(CharSequence input)
      AWS style implementation of "uri encoding" using UTF-8 encoding.
      Parameters:
      input - The text input to encode.
      Returns:
      The URI escaped string.
    • computeMACDigest

      public static final byte[] computeMACDigest(byte[] secretKey, String data, String macAlgorithm)
      Compute a Base64 MAC digest from signature data.
      Parameters:
      secretKey - the secret key
      data - the data to sign
      macAlgorithm - the MAC algorithm to use
      Returns:
      The base64 encoded digest.
      Throws:
      SecurityException - if any error occurs
    • computeMACDigest

      public static final byte[] computeMACDigest(String secretKey, String data, String macAlgorithm)
      Compute a Base64 MAC digest from signature data.
      Parameters:
      secretKey - the secret key
      data - the data to sign
      macAlgorithm - the MAC algorithm to use
      Returns:
      The base64 encoded digest.
      Throws:
      SecurityException - if any error occurs
    • computeMACDigest

      public static final byte[] computeMACDigest(byte[] secretKey, byte[] data, String macAlgorithm)
      Compute a Base64 MAC digest from signature data.
      Parameters:
      secretKey - the secret key
      data - the data to sign
      macAlgorithm - the MAC algorithm to use
      Returns:
      The base64 encoded digest.
      Throws:
      SecurityException - if any error occurs