Skip to content

Commit

Permalink
Merge pull request #205 from jebbench/master
Browse files Browse the repository at this point in the history
Add an interface for JWTVerifier.
  • Loading branch information
lbalmaceda authored Nov 16, 2018
2 parents f2c601b + d7ec5ff commit a2e6c64
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/main/java/com/auth0/jwt/JWTVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* The JWTVerifier class holds the verify method to assert that a given Token has not only a proper JWT format, but also it's signature matches.
*/
@SuppressWarnings("WeakerAccess")
public final class JWTVerifier {
public final class JWTVerifier implements com.auth0.jwt.interfaces.JWTVerifier {
private final Algorithm algorithm;
final Map<String, Object> claims;
private final Clock clock;
Expand Down Expand Up @@ -348,6 +348,7 @@ private void requireClaim(String name, Object value) {
* @throws TokenExpiredException if the token has expired.
* @throws InvalidClaimException if a claim contained a different value than the expected one.
*/
@Override
public DecodedJWT verify(String token) throws JWTVerificationException {
DecodedJWT jwt = JWT.decode(token);
verifyAlgorithm(jwt, algorithm);
Expand Down
16 changes: 16 additions & 0 deletions lib/src/main/java/com/auth0/jwt/interfaces/JWTVerifier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.auth0.jwt.interfaces;

import com.auth0.jwt.exceptions.JWTVerificationException;


public interface JWTVerifier {

/**
* Performs the verification against the given Token
*
* @param token to verify.
* @return a verified and decoded JWT.
* @throws JWTVerificationException if any of the verification steps fail
*/
DecodedJWT verify(String token) throws JWTVerificationException;
}

0 comments on commit a2e6c64

Please sign in to comment.