Update to javadocs to make more clear.

This commit is contained in:
Micah Silverman 2015-09-23 17:40:50 -04:00
parent 681a3fc0ba
commit a22a76ad79
1 changed files with 40 additions and 22 deletions

View File

@ -28,81 +28,99 @@ public interface JwtParser {
public static final char SEPARATOR_CHAR = '.'; public static final char SEPARATOR_CHAR = '.';
/** /**
* Ensures that the specified {@code jti} value is present when parsing the JWT. If not present, * Ensures that the specified {@code jti} exists in the parsed JWT. If missing or if the parsed
* an exception will be thrown indicating that the JWT is invalid and may not be used. * value does not equal the specified value, an exception will be thrown indicating that the
* JWT is invalid and may not be used.
* *
* @param id * @param id
* @return the parser method for chaining. * @return the parser method for chaining.
* @see MissingClaimException
* @see IncorrectClaimException
*/ */
JwtParser requireId(String id); JwtParser requireId(String id);
/** /**
* Ensures that the specified {@code sub} value is present when parsing the JWT. If not present, * Ensures that the specified {@code sub} exists in the parsed JWT. If missing or if the parsed
* an exception will be thrown indicating that the JWT is invalid and may not be used. * value does not equal the specified value, an exception will be thrown indicating that the
* JWT is invalid and may not be used.
* *
* @param subject * @param subject
* @return the parser for method chaining. * @return the parser for method chaining.
* @see MissingClaimException
* @see IncorrectClaimException
*/ */
JwtParser requireSubject(String subject); JwtParser requireSubject(String subject);
/** /**
* Ensures that the specified {@code aud} value is present when parsing the JWT. If not present, * Ensures that the specified {@code aud} exists in the parsed JWT. If missing or if the parsed
* an exception will be thrown indicating that the JWT is invalid and may not be used. * value does not equal the specified value, an exception will be thrown indicating that the
* JWT is invalid and may not be used.
* *
* @param audience * @param audience
* @return the parser for method chaining. * @return the parser for method chaining.
* @see MissingClaimException
* @see IncorrectClaimException
*/ */
JwtParser requireAudience(String audience); JwtParser requireAudience(String audience);
/** /**
* Ensures that the specified {@code iss} value is present when parsing the JWT. If not present, * Ensures that the specified {@code iss} exists in the parsed JWT. If missing or if the parsed
* an exception will be thrown indicating that the JWT is invalid and may not be used. * value does not equal the specified value, an exception will be thrown indicating that the
* JWT is invalid and may not be used.
* *
* @param issuer * @param issuer
* @return the parser for method chaining. * @return the parser for method chaining.
* @see MissingClaimException
* @see IncorrectClaimException
*/ */
JwtParser requireIssuer(String issuer); JwtParser requireIssuer(String issuer);
/** /**
* Ensures that the specified {@code iat} value is present when parsing the JWT. If not present, * Ensures that the specified {@code iat} exists in the parsed JWT. If missing or if the parsed
* an exception will be thrown indicating that the JWT is invalid and may not be used. * value does not equal the specified value, an exception will be thrown indicating that the
* JWT is invalid and may not be used.
* *
* @param issuedAt * @param issuedAt
* @return the parser for method chaining. * @return the parser for method chaining.
* @see MissingClaimException
* @see IncorrectClaimException
*/ */
JwtParser requireIssuedAt(Date issuedAt); JwtParser requireIssuedAt(Date issuedAt);
/** /**
* Ensures that the specified {@code exp} value is present when parsing the JWT. If not present, * Ensures that the specified {@code exp} exists in the parsed JWT. If missing or if the parsed
* an exception will be thrown indicating that the JWT is invalid and may not be used. * value does not equal the specified value, an exception will be thrown indicating that the
* JWT is invalid and may not be used.
* *
* @param expiration * @param expiration
* @return the parser for method chaining. * @return the parser for method chaining.
* @see MissingClaimException
* @see IncorrectClaimException
*/ */
JwtParser requireExpiration(Date expiration); JwtParser requireExpiration(Date expiration);
/** /**
* Ensures that the specified {@code nbf} value is present when parsing the JWT. If not present, * Ensures that the specified {@code nbf} exists in the parsed JWT. If missing or if the parsed
* an exception will be thrown indicating that the JWT is invalid and may not be used. * value does not equal the specified value, an exception will be thrown indicating that the
* JWT is invalid and may not be used.
* *
* @param notBefore * @param notBefore
* @return the parser for method chaining * @return the parser for method chaining
* @see MissingClaimException
* @see IncorrectClaimException
*/ */
JwtParser requireNotBefore(Date notBefore); JwtParser requireNotBefore(Date notBefore);
/** /**
* Ensures that the specified {@code claimName} value is present when parsing the JWT. If not present, * Ensures that the specified {@code claimName} exists in the parsed JWT. If missing or if the parsed
* an exception will be thrown indicating that the JWT is invalid and may not be used. * value does not equal the specified value, an exception will be thrown indicating that the
* * JWT is invalid and may not be used.
* If a particular claim is required and the JWT being parsed does not have that claim set,
* a {@Link MissingClaimException} will be thrown.
*
* If a particular claim is required and the JWT being parsed has a value that is different than
* the required value, a {@link IncorrectClaimException} will be thrown.
* *
* @param claimName * @param claimName
* @param value * @param value
* @return the parser for method chaining. * @return the parser for method chaining.
* @see MissingClaimException
* @see IncorrectClaimException
*/ */
JwtParser require(String claimName, Object value); JwtParser require(String claimName, Object value);