We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/FAForever/faf-java-api/blob/v0.5.0/src/main/java/com/faforever/api/clan/ClanService.java#L117
@SneakyThrows // TODO @dragonfire don't manually read JSON values, deserialize into a Java object? public void acceptPlayerInvitationToken(String stringToken, Authentication authentication) { Jwt token = jwtService.decodeAndVerify(stringToken); JsonNode data = objectMapper.readTree(token.getClaims()); if (data.get(JwtKeys.EXPIRE_IN).asLong() < System.currentTimeMillis()) { throw new ApiException(new Error(ErrorCode.CLAN_ACCEPT_TOKEN_EXPIRE)); } Player player = playerService.getPlayer(authentication); Clan clan = clanRepository.findOne(data.get(JwtKeys.CLAN).get(JwtKeys.CLAN_ID).asInt()); if (clan == null) { throw new ApiException(new Error(ErrorCode.CLAN_NOT_EXISTS)); } Player newMember = playerRepository.findOne(data.get(JwtKeys.NEW_MEMBER_ID).asInt()); if (newMember == null) { throw new ProgrammingError("ClanMember does not exist: " + data.get(JwtKeys.NEW_MEMBER_ID).asInt()); } if (player.getId() != newMember.getId()) { throw new ApiException(new Error(ErrorCode.CLAN_ACCEPT_WRONG_PLAYER)); } if (newMember.getClan() != null) { throw new ApiException(new Error(ErrorCode.CLAN_ACCEPT_PLAYER_IN_A_CLAN)); } ClanMembership membership = new ClanMembership(); membership.setClan(clan); membership.setPlayer(newMember); clanMembershipRepository.save(membership); }
The text was updated successfully, but these errors were encountered:
Fix #66 Don't manually read JSON values, deserialize into a Java object
eac654c
02b52db
60a9635
b0a0bdf
IDragonfire
No branches or pull requests
https://github.com/FAForever/faf-java-api/blob/v0.5.0/src/main/java/com/faforever/api/clan/ClanService.java#L117
The text was updated successfully, but these errors were encountered: