Added raw string to Token, for retrieving additional parameters
This commit is contained in:
1 parent
75bcb0013d
commit
1eb0b1003c
4 files changed
+22
-2
No files matched your search
@@ -26,7 +26,7 @@ public class TokenExtractor20Impl implements AccessTokenExtractor
|
||||
if (matcher.matches())
|
||||
{
|
||||
String token = URLUtils.formURLDecode(matcher.group(1));
|
||||
return new Token(token, EMPTY_SECRET);
|
||||
return new Token(token, EMPTY_SECRET, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TokenExtractorImpl implements RequestTokenExtractor, AccessTokenExt
|
||||
{
|
||||
String token = URLUtils.formURLDecode(matcher.group(1));
|
||||
String secret = URLUtils.formURLDecode(matcher.group(2));
|
||||
return new Token(token, secret);
|
||||
return new Token(token, secret, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ public class Token implements Serializable
|
||||
|
||||
private final String token;
|
||||
private final String secret;
|
||||
private final String rawResponse;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
@@ -21,9 +22,15 @@ public class Token implements Serializable
|
||||
* @param secret token secret
|
||||
*/
|
||||
public Token(String token, String secret)
|
||||
{
|
||||
this(token, secret, null);
|
||||
}
|
||||
|
||||
public Token(String token, String secret, String rawResponse)
|
||||
{
|
||||
this.token = token;
|
||||
this.secret = secret;
|
||||
this.rawResponse = rawResponse;
|
||||
}
|
||||
|
||||
public String getToken()
|
||||
@@ -36,6 +43,15 @@ public class Token implements Serializable
|
||||
return secret;
|
||||
}
|
||||
|
||||
public String getRawResponse()
|
||||
{
|
||||
if (rawResponse == null)
|
||||
{
|
||||
throw new IllegalStateException("This token object was not constructed by scribe and does not have a rawResponse");
|
||||
}
|
||||
return rawResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user