diff --git a/acme4j-client/src/main/java/org/shredzone/acme4j/Metadata.java b/acme4j-client/src/main/java/org/shredzone/acme4j/Metadata.java
index e81edbf4..6cf47738 100644
--- a/acme4j-client/src/main/java/org/shredzone/acme4j/Metadata.java
+++ b/acme4j-client/src/main/java/org/shredzone/acme4j/Metadata.java
@@ -155,6 +155,23 @@ public class Metadata {
.isPresent();
}
+ /**
+ * Returns a description of the requested profile. This can be a human-readable string
+ * or a URL linking to a documentation.
+ *
+ * Empty if the profile is not allowed.
+ *
+ * @since 3.5.0
+ */
+ public Optional getProfileDescription(String profile) {
+ return meta.get("profiles").optional()
+ .map(Value::asObject)
+ .orElseGet(JSON::empty)
+ .get(profile)
+ .optional()
+ .map(Value::asString);
+ }
+
/**
* Returns whether the CA supports subdomain auth according to RFC9444.
*
diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/SessionTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/SessionTest.java
index cc74ba19..9af96608 100644
--- a/acme4j-client/src/test/java/org/shredzone/acme4j/SessionTest.java
+++ b/acme4j-client/src/test/java/org/shredzone/acme4j/SessionTest.java
@@ -185,7 +185,11 @@ public class SessionTest {
softly.assertThat(meta.isAutoRenewalGetAllowed()).isTrue();
softly.assertThat(meta.isProfileAllowed()).isTrue();
softly.assertThat(meta.isProfileAllowed("classic")).isTrue();
+ softly.assertThat(meta.isProfileAllowed("custom")).isTrue();
softly.assertThat(meta.isProfileAllowed("invalid")).isFalse();
+ softly.assertThat(meta.getProfileDescription("classic")).contains("The profile you're accustomed to");
+ softly.assertThat(meta.getProfileDescription("custom")).contains("Some other profile");
+ softly.assertThat(meta.getProfileDescription("invalid")).isEmpty();
softly.assertThat(meta.isExternalAccountRequired()).isTrue();
softly.assertThat(meta.isSubdomainAuthAllowed()).isTrue();
softly.assertThat(meta.getJSON()).isNotNull();
@@ -240,6 +244,7 @@ public class SessionTest {
.isThrownBy(meta::isAutoRenewalGetAllowed);
softly.assertThat(meta.isProfileAllowed()).isFalse();
softly.assertThat(meta.isProfileAllowed("classic")).isFalse();
+ softly.assertThat(meta.getProfileDescription("classic")).isEmpty();
}
}