Class UserPublicKey

java.lang.Object
com.illumon.iris.db.v2.permissions.rs.records.UserPublicKey

public class UserPublicKey extends Object
A Public key wrapper entity, to manage storage of user public keys in the acl database
  • Constructor Details

    • UserPublicKey

      public UserPublicKey()
      Required default constructor to support auto conversion to json
    • UserPublicKey

      public UserPublicKey(@NotNull String user, @NotNull String encodedStr, @NotNull String algorithm, @Nullable String provider, @Nullable String comment)
      Constructor that takes individual properties of PublicKey
      Parameters:
      user - user who is mapped to public key, this is expected to come from key file
      encodedStr - The encoded public key from key file
      algorithm - The algorithm used to encode example (DSA, RSA)
      provider - Optional provider used to encode / decode the key file, if null Default provider will be used
      comment - Optional comment to include when the key is inserted in acl db
    • UserPublicKey

      public UserPublicKey(@NotNull String user, @NotNull PublicKey publicKey)
      Constructor that takes an instance of PublicKey
      Parameters:
      user - user who is mapped to public key, this is expected to come from key file
      publicKey - The public key to store
  • Method Details

    • getComment

      public String getComment()
    • setComment

      public void setComment(String comment)
    • getUser

      public String getUser()
    • setUser

      public void setUser(String user)
    • getEncodedStr

      public String getEncodedStr()
    • setEncodedStr

      public void setEncodedStr(String encodedStr)
    • getAlgorithm

      public String getAlgorithm()
    • setAlgorithm

      public void setAlgorithm(String algorithm)
    • getProvider

      public String getProvider()
    • setProvider

      public void setProvider(String provider)
    • publicKey

      Returns the public key by decoding and regenerating it using the attributes from the entity
      Returns:
      the regenerated public key
      Throws:
      NoSuchAlgorithmException - when the algorithm provided is null or doesn't match the algorithm used in original encoding
      NoSuchProviderException - if provider doesn't match the provider used in original encoding
      InvalidKeySpecException - when encoded key fails key specifications validations
    • detailsPrefix

      public String detailsPrefix()
      Returns string used as prefix while logging for addPublicKeyForUser. The prefix is constructed using the user and comment attributes
      Returns:
      prefix while logging for addPublicKeyForUser
    • addDetailsString

      public String addDetailsString()
      Returns the Command details for addPublicKeyForUser, used in audit event log. Constructed using user, comment and abbreviated public key
      Returns:
      command details for addPublicKeyForUser.
    • deleteDetailsString

      public String deleteDetailsString()
      Returns the Command details for deletePublicKeyForUser, used in audit event log. Constructed using abbreviated public key
      Returns:
      command details for deletePublicKeyForUser.
    • toString

      public String toString()
      Overrides:
      toString in class Object