Skip to content

Commit

Permalink
refactor(): simplified returning token from cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
ToastShaman committed Apr 15, 2017
1 parent 1da681c commit ef83c5a
Showing 1 changed file with 1 addition and 7 deletions.
Expand Up @@ -90,13 +90,7 @@ private JwtContext verifyToken(String rawToken) throws InvalidJwtException {

private Optional<String> getTokenFromCookieOrHeader(ContainerRequestContext requestContext) {
final Optional<String> headerToken = getTokenFromHeader(requestContext.getHeaders());

if (headerToken.isPresent()) {
return headerToken;
}

final Optional<String> cookieToken = getTokenFromCookie(requestContext);
return cookieToken.isPresent() ? cookieToken : Optional.empty();
return headerToken.isPresent() ? headerToken : getTokenFromCookie(requestContext);
}

private Optional<String> getTokenFromHeader(MultivaluedMap<String, String> headers) {
Expand Down

0 comments on commit ef83c5a

Please sign in to comment.