Class PrincipalData

java.lang.Object
com.mulesoft.connectors.mcp.api.certificate.PrincipalData
All Implemented Interfaces:
Serializable

public class PrincipalData extends Object implements Serializable
A custom Data Transfer Object (DTO) to replace the Principal class.

This class is a simple representation of a principal with a single attribute, the name. It implements Serializable to allow its instances to be serialized.

See Also:
  • Constructor Details

    • PrincipalData

      public PrincipalData(String name)
      Constructs a new PrincipalData instance with the specified name.
      Parameters:
      name - the name of the principal
  • Method Details

    • getName

      public String getName()
      Returns the name of the principal.
      Returns:
      the name of the principal
    • getCommonName

      public String getCommonName()
      Extracts and returns the common name (CN) from the principal's name.

      This method assumes that the name is a distinguished name (DN) string, and attempts to find and return the value of the CN attribute. If the CN attribute is not found, the method returns an empty string.

      Returns:
      the common name (CN) if found, otherwise an empty string
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object