@@ -29,23 +29,44 @@ public abstract class PricingContext {
2929 private static final Logger logger = LoggerFactory .getLogger (PricingContext .class );
3030
3131 /**
32- * Returns path of the pricing configuration YAML file.
33- * This file should be located in the resources folder, and the path should be
34- * relative to it .
32+ * Returns the path to the Pricing2Yaml configuration file. The {@link String}
33+ * path given to the implementation of this method should point to a
34+ * Pricing2Yaml file under {@code resources} folder .
3535 *
36- * @return Configuration file path
36+ * @return a path as {@link String} to a Pricing2Yaml configuration file
37+ * relative to the {@code resources} folder
3738 */
3839 public abstract String getConfigFilePath ();
3940
4041 /**
41- * Returns the secret used to encode the pricing JWT.
42- * * @return JWT secret String
42+ * Returns the secret used to sign the pricing JWT. The secret key needs to be
43+ * encoded in {@code base64}. Internally JWT library will choose the best
44+ * algorithm to sign the JWT ({@code HS256}, {@code HS384} or {@code HS512}), if
45+ * the secret key bit length does not conform to the minimun stated by these
46+ * algorithms will throw a {@link io.jsonwebtoken.security.WeakKeyException}
47+ *
48+ * @return a pricing secret encoded in {@code base64}
49+ * @see <a href=
50+ * "https://github.com/jwtk/jjwt#signature-algorithms-keys">Signature
51+ * Algorithm Keys</a>
52+ * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-3.2">HMAC
53+ * with SHA-2 Functions</a>
4354 */
4455 public abstract String getJwtSecret ();
4556
4657 /**
47- * Returns the secret used to encode the authorization JWT.
48- * * @return JWT secret String
58+ * Returns the secret used to sign the authorization JWT. The secret key needs
59+ * to be encoded in {@code base64}. Internally JWT library will choose the best
60+ * algorithm to sign the JWT ({@code HS256}, {@code HS384} or {@code HS512}), if
61+ * the secret key bit length does not conform to the minimun stated by these
62+ * algorithms will throw a {@link io.jsonwebtoken.security.WeakKeyException}
63+ *
64+ * @return a pricing secret encoded in {@code base64}
65+ * @see <a href=
66+ * "https://github.com/jwtk/jjwt#signature-algorithms-keys">Signature
67+ * Algorithm Keys</a>
68+ * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-3.2">HMAC
69+ * with SHA-2 Functions</a>
4970 */
5071 public String getAuthJwtSecret () {
5172 return this .getJwtSecret ();
@@ -66,7 +87,8 @@ public int getJwtExpiration() {
6687 * for them.
6788 *
6889 * @return A {@link Boolean} indicating the condition to include, or not,
69- * the pricing evaluation context in the JWT.
90+ * the pricing evaluation context in the JWT. Set to {@code true} by
91+ * default
7092 *
7193 * @see PricingEvaluatorUtil#generateUserToken
7294 *
@@ -77,9 +99,8 @@ public Boolean userAffectedByPricing() {
7799
78100 /**
79101 * This method should return the user context that will be used to evaluate the
80- * pricing plan.
81- * It should be considered which users has accessed the service and what
82- * information is available.
102+ * pricing plan. It should be considered which users has accessed the service
103+ * and what information is available.
83104 *
84105 * @return Map with the user context
85106 */
@@ -90,30 +111,35 @@ public Boolean userAffectedByPricing() {
90111 * With this information, the library will be able to build the {@link Plan}
91112 * object of the user from the configuration.
92113 *
93- * @return String with the current user's plan name
114+ * @return a {@link String} with the current user's plan name
94115 */
95116 public abstract String getUserPlan ();
96117
97118 /**
98119 * This method should return a list with the name of the add-ons contracted by
99- * the current user. If the pricing don't include add-ons, then just return an empty array.
100- * With this information, the library will be able to build the subscription of
101- * the user from the configuration.
120+ * the current user. If the pricing does not include add-ons, then just return
121+ * an empty {@link List}. With this information, the library will be able to
122+ * build the subscription of the user from the configuration.
102123 *
103- * @return {@code List<String>} with the current user's contracted add-ons. Add-on names
104- * should be the same as in the pricing configuration file.
124+ * @return a list with the current user's contracted add-ons.
125+ * Add-on names should be the same as in the pricing configuration file.
105126 *
106127 */
107128 public abstract List <String > getUserAddOns ();
108129
109130 /**
110131 * Returns a list with the full subscription contracted by the current user
111132 * (including plans and add-ons).
133+ * <p>
134+ * There are two keys inside this {@link Map}:
135+ * <ul>
136+ * <li>Key {@code plans} contains the plan name of the user
137+ * <li>Key {@code addOns} contains a list with the add-ons contracted by the
138+ * user
139+ * </ul>
112140 *
113- * Key "plan" contains the plan name of the user.
114- * Key "addOns" contains a list with the add-ons contracted by the user.
115- *
116- * @return {@code Map<String, Object>} with the current user's contracted subscription.
141+ * @return {@code Map<String, Object>} with the current user's contracted
142+ * subscription.
117143 */
118144 public final Map <String , Object > getUserSubscription () {
119145 Map <String , Object > userSubscription = new HashMap <>();
@@ -164,7 +190,7 @@ public final Map<String, Object> getPlanContext() {
164190 * This method returns the {@link PricingManager} object that is being used to
165191 * evaluate the pricing plan.
166192 *
167- * @return PricingManager object
193+ * @return {@link PricingManager} object
168194 */
169195 public final PricingManager getPricingManager () {
170196 try {
0 commit comments