public LastFmUser identifyLastFmUser(String token) throws ApplicationException {
LOG.debug("identifyLastFmUser(" + token + ")");
WSResponse wsResponse = authSessionClient.getAuthSession(token);
if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
AuthSessionParser authSessionParser =
new AuthSessionParserImpl(stringUtil.getInputStream());
return authSessionParser.getLastFmUser();
} else {
LOG.debug("wsResponse: " + wsResponse.getResponseBody());
throw new ApplicationException("Could not get session key for user! (code "
+ wsResponse.getErrorCode() + ", " + wsResponse.getErrorMessage() + ")");
}