Auth0Jwt extends DefaultOAuthJwtAccessToken { @Override public String getSubject() { String subject = this.body.getSubject(); if (subject == null) { return null; } return AthenzUtils.getPrincipalName(Auth0Jwt.userDomain, subject.replace('|', '-')); } Auth0Jwt(Jws<Claims> jws); @Override String getSubject(); @Override String getClientId(); @Override String getCertificateThumbprint(); static void setClaimClientId(String claimClientId); static void setClaimConfirm(String claimConfirm); static void setUserDomain(String userDomain); static String getClaimClientId(); static String getClaimConfirm(); static String getUserDomain();  }
@Test public void testGetSubject() { Auth0Jwt jwt; jwt = new Auth0Jwt(parser.parseClaimsJws(Jwts.builder().claim("null", "null").signWith(secretKey).compact())); assertNull(jwt.getSubject()); jwt = new Auth0Jwt(parser.parseClaimsJws(Jwts.builder().setSubject("github|1234567").signWith(secretKey).compact())); assertEquals(jwt.getSubject(), "user.github-1234567"); jwt = new Auth0Jwt(parser.parseClaimsJws(Jwts.builder().setSubject("GITHUB|1234567").signWith(secretKey).compact())); assertEquals(jwt.getSubject(), "user.github-1234567"); }