removed unused extractor (JsonTokenExtractor handles this)
This commit is contained in:
1 parent
8afb142b7f
commit
5f40e0dca0
1 file changed
-28
@@ -1,28 +0,0 @@
|
||||
package org.scribe.extractors;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.scribe.exceptions.OAuthException;
|
||||
import org.scribe.extractors.TokenExtractor20Impl;
|
||||
import org.scribe.model.Token;
|
||||
import org.scribe.utils.Preconditions;
|
||||
import org.scribe.utils.URLUtils;
|
||||
|
||||
public class FoursquareAccessTokenExtractor extends TokenExtractor20Impl {
|
||||
|
||||
private static final String TOKEN_REGEX = ".[\\s]+\"access_token\":\"(\\S*?)(&(\\S*))?\"[\\s]+.";
|
||||
private static final String EMPTY_SECRET = "";
|
||||
|
||||
public Token extract(String response) {
|
||||
Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string");
|
||||
|
||||
Matcher matcher = Pattern.compile(TOKEN_REGEX).matcher(response);
|
||||
if (matcher.matches()) {
|
||||
String token = URLUtils.formURLDecode(matcher.group(1));
|
||||
return new Token(token, EMPTY_SECRET);
|
||||
} else {
|
||||
throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user