- java.lang.Object
-
- org.shredzone.acme4j.Identifier
-
- All Implemented Interfaces:
Serializable
public class Identifier extends Object implements Serializable
Represents an identifier.The ACME protocol only defines the DNS identifier, which identifies a domain name. acme4j also supports IP identifiers.
CAs, and other acme4j modules, may define further, proprietary identifier types.
- Since:
- 2.3
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Identifier(String type, String value)
Creates a newIdentifier
.Identifier(JSON json)
Creates a newIdentifier
from the givenJSON
structure.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Identifier
allowSubdomainAuth()
Gives the permission to authorize subdomains of this domain, as required in RFC-9444.static Identifier
dns(String domain)
Creates a new DNS identifier for the given domain name.boolean
equals(Object obj)
protected void
finalize()
String
getDomain()
Returns the domain name if this is a DNS identifier.InetAddress
getIP()
Returns the IP address if this is an IP identifier.String
getType()
Returns the identifier type.String
getValue()
Returns the identifier value.int
hashCode()
static Identifier
ip(String ip)
Creates a new IP identifier for the givenInetAddress
.static Identifier
ip(InetAddress ip)
Creates a new IP identifier for the givenInetAddress
.Map<String,Object>
toMap()
Returns the identifier as JSON map.String
toString()
Identifier
withAncestorDomain(String domain)
Sets an ancestor domain, as required in RFC-9444.
-
-
-
Field Detail
-
TYPE_DNS
public static final String TYPE_DNS
Type constant for DNS identifiers.- See Also:
- Constant Field Values
-
TYPE_IP
public static final String TYPE_IP
Type constant for IP identifiers.- See Also:
- RFC 8738, Constant Field Values
-
-
Constructor Detail
-
Identifier
public Identifier(String type, String value)
Creates a newIdentifier
.This is a generic constructor for identifiers. Refer to the documentation of your CA to find out about the accepted identifier types and values.
Note that for DNS identifiers, no ASCII encoding of unicode domain takes place here. Use
dns(String)
instead.- Parameters:
type
- Identifier typevalue
- Identifier value
-
Identifier
public Identifier(JSON json)
Creates a newIdentifier
from the givenJSON
structure.- Parameters:
json
-JSON
containing the identifier data
-
-
Method Detail
-
dns
public static Identifier dns(String domain)
Creates a new DNS identifier for the given domain name.- Parameters:
domain
- Domain name. Unicode domains are automatically ASCII encoded.- Returns:
- New
Identifier
-
ip
public static Identifier ip(InetAddress ip)
Creates a new IP identifier for the givenInetAddress
.- Parameters:
ip
-InetAddress
- Returns:
- New
Identifier
-
ip
public static Identifier ip(String ip)
Creates a new IP identifier for the givenInetAddress
.- Parameters:
ip
- IP address asString
- Returns:
- New
Identifier
- Since:
- 2.7
-
withAncestorDomain
public Identifier withAncestorDomain(String domain)
Sets an ancestor domain, as required in RFC-9444.- Parameters:
domain
- The ancestor domain to be set. Unicode domains are automatically ASCII encoded.- Returns:
- An
Identifier
that contains the ancestor domain. - Since:
- 3.3.0
-
allowSubdomainAuth
public Identifier allowSubdomainAuth()
Gives the permission to authorize subdomains of this domain, as required in RFC-9444.- Returns:
- An
Identifier
that allows subdomain auths. - Since:
- 3.3.0
-
getDomain
public String getDomain()
Returns the domain name if this is a DNS identifier.- Returns:
- Domain name. Unicode domains are ASCII encoded.
- Throws:
AcmeProtocolException
- if this is not a DNS identifier.
-
getIP
public InetAddress getIP()
Returns the IP address if this is an IP identifier.- Returns:
InetAddress
- Throws:
AcmeProtocolException
- if this is not a DNS identifier.
-
-