Class ApiKey


  • public class ApiKey
    extends Object
    Class representing an API key for a User. An API can be used to represent the user when logging instead of using email and password.

    These keys are created or fetched through ApiKeyAuth.create(String) or the various fetch-methods.

    Note that a keys value is only available when the key is created, after that it is not visible. So anyone creating an API key is responsible for storing it safely after that.

    • Method Detail

      • getId

        public ObjectId getId()
        Returns the unique identifier for this key.
        Returns:
        the id, uniquely identifying the key.
      • getValue

        @Nullable
        public String getValue()
        Returns this keys value. This value is only returned when the key is created. After that the value is no longer visible.
        Returns:
        the value of this key. Is only returned when the key is created.
      • getName

        public String getName()
        Returns the name of this key.
        Returns:
        the name of the key.
      • isEnabled

        public boolean isEnabled()
        Returns whether or not this key is currently enabled.
        Returns:
        if the key is enabled or not.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object