Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32b08788c9 | ||
|
|
91c64ff08b | ||
|
|
ffb1042146 | ||
|
|
fbee85ec08 | ||
|
|
f59c9543d5 | ||
|
|
36aeaeed2f |
No files matched your search
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.scribe</groupId>
|
<groupId>org.scribe</groupId>
|
||||||
<artifactId>scribe</artifactId>
|
<artifactId>scribe</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.0.3</version>
|
<version>1.0.5</version>
|
||||||
<name>OAuth Library</name>
|
<name>OAuth Library</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ public class GoogleApi extends DefaultApi10a
|
|||||||
@Override
|
@Override
|
||||||
public String getAccessTokenEndpoint()
|
public String getAccessTokenEndpoint()
|
||||||
{
|
{
|
||||||
return "https://www.google.com/accounts/OAuthGetRequestToken";
|
return "https://www.google.com/accounts/OAuthGetAccessToken";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRequestTokenEndpoint()
|
public String getRequestTokenEndpoint()
|
||||||
{
|
{
|
||||||
return "https://www.google.com/accounts/OAuthGetAccessToken";
|
return "https://www.google.com/accounts/OAuthGetRequestToken";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
public class VimeoApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://vimeo.com/oauth/access_token";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://vimeo.com/oauth/request_token";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package org.scribe.utils;
|
package org.scribe.utils;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.scribe.model.OAuthConstants;
|
import org.scribe.model.OAuthConstants;
|
||||||
|
|
||||||
public class Preconditions
|
public class Preconditions
|
||||||
{
|
{
|
||||||
private static final String DEFAULT_MESSAGE = "Received an invalid parameter";
|
private static final String DEFAULT_MESSAGE = "Received an invalid parameter";
|
||||||
|
private static final Pattern URL_PATTERN = Pattern.compile("[a-zA-Z_-]+://\\S+");
|
||||||
|
|
||||||
public static void checkNotNull(Object object, String errorMsg)
|
public static void checkNotNull(Object object, String errorMsg)
|
||||||
{
|
{
|
||||||
@@ -33,7 +36,7 @@ public class Preconditions
|
|||||||
|
|
||||||
static boolean isUrl(String url)
|
static boolean isUrl(String url)
|
||||||
{
|
{
|
||||||
return url.startsWith("http://") || url.startsWith("https://");
|
return URL_PATTERN.matcher(url).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void check(boolean requirements, String error)
|
private static void check(boolean requirements, String error)
|
||||||
|
|||||||
@@ -53,6 +53,17 @@ public class PreconditionsTest
|
|||||||
Preconditions.checkValidUrl("https://www.example.com", ERROR_MSG);
|
Preconditions.checkValidUrl("https://www.example.com", ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void shouldAllowNonStandarProtocolsForAndroid()
|
||||||
|
{
|
||||||
|
Preconditions.checkValidUrl("x-url-custom://www.example.com", ERROR_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
public void shouldNotAllowStrangeProtocolNames()
|
||||||
|
{
|
||||||
|
Preconditions.checkValidUrl("$weird*://www.example.com", ERROR_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
public void shouldAllowOutOfBandAsValidCallbackValue()
|
public void shouldAllowOutOfBandAsValidCallbackValue()
|
||||||
{
|
{
|
||||||
Preconditions.checkValidOAuthCallback("oob", ERROR_MSG);
|
Preconditions.checkValidOAuthCallback("oob", ERROR_MSG);
|
||||||
|
|||||||
Reference in new issue
Block a user