@Test public void getAlgorithm_success() throws Exception { JSONObject header = new JSONObject(); header.put(JwtNames.HEADER_ALGORITHM, "HS256"); Jwt token = new Jwt(header, new JSONObject(), Clock.systemUTC(), Duration.ZERO); assertThat(token.getAlgorithm()).isEqualTo("HS256"); }
public String getAlgorithm() throws JwtExpiredException, JwtNotBeforeException { validateTimestampClaims(); try { return header.getString(JwtNames.HEADER_ALGORITHM); } catch (JSONException ex) { throw new IllegalStateException("an alg header is required, but not found", ex); } }
Jwt { public String getAlgorithm() throws JwtExpiredException, JwtNotBeforeException { validateTimestampClaims(); try { return header.getString(JwtNames.HEADER_ALGORITHM); } catch (JSONException ex) { throw new IllegalStateException("an alg header is required, but not found", ex); } } }
Jwt { public String getAlgorithm() throws JwtExpiredException, JwtNotBeforeException { validateTimestampClaims(); try { return header.getString(JwtNames.HEADER_ALGORITHM); } catch (JSONException ex) { throw new IllegalStateException("an alg header is required, but not found", ex); } } Jwt(JSONObject header, JSONObject payload, Clock clock, Duration clockSkew); }
Jwt { public String getAlgorithm() throws JwtExpiredException, JwtNotBeforeException { validateTimestampClaims(); try { return header.getString(JwtNames.HEADER_ALGORITHM); } catch (JSONException ex) { throw new IllegalStateException("an alg header is required, but not found", ex); } } Jwt(JSONObject header, JSONObject payload, Clock clock, Duration clockSkew); String getIssuer(); String getSubject(); List<String> getAudiences(); String getJwtId(); Instant getExpiration(); Instant getNotBefore(); Instant getIssuedAt(); Object getClaim(String name); String getType(); String getContentType(); String getAlgorithm(); String getKeyId(); }
Jwt { public String getAlgorithm() throws JwtExpiredException, JwtNotBeforeException { validateTimestampClaims(); try { return header.getString(JwtNames.HEADER_ALGORITHM); } catch (JSONException ex) { throw new IllegalStateException("an alg header is required, but not found", ex); } } Jwt(JSONObject header, JSONObject payload, Clock clock, Duration clockSkew); String getIssuer(); String getSubject(); List<String> getAudiences(); String getJwtId(); Instant getExpiration(); Instant getNotBefore(); Instant getIssuedAt(); Object getClaim(String name); String getType(); String getContentType(); String getAlgorithm(); String getKeyId();  }