Skip to content

Commit 088fc5e

Browse files
Renamed OAuth 2.0 service class
1 parent 27bac50 commit 088fc5e

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

src/main/java/org/scribe/oauth/OAuth2ServiceImpl.java renamed to src/main/java/org/scribe/oauth/OAuth20ServiceImpl.java

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,71 @@
33
import org.scribe.builder.api.*;
44
import org.scribe.model.*;
55

6-
public class OAuth2ServiceImpl implements OAuthService
6+
public class OAuth20ServiceImpl implements OAuthService
77
{
8-
private final Api api;
8+
private static final String VERSION = "2.0";
9+
10+
private final DefaultApi20 api;
911
private final OAuthConfig config;
1012

11-
public OAuth2ServiceImpl(Api api, OAuthConfig config)
13+
/**
14+
* Default constructor
15+
*
16+
* @param api OAuth2.0 api information
17+
* @param config OAuth 2.0 configuration param object
18+
*/
19+
public OAuth20ServiceImpl(DefaultApi20 api, OAuthConfig config)
1220
{
1321
this.api = api;
1422
this.config = config;
1523
}
1624

17-
@Override
25+
/**
26+
* {@inheritDoc}
27+
*/
1828
public void addScope(String scope)
1929
{
2030
throw new UnsupportedOperationException("OAuth 2 does not use scopes");
2131
}
2232

23-
@Override
33+
/**
34+
* {@inheritDoc}
35+
*/
2436
public Token getAccessToken(Token requestToken, Verifier verifier)
2537
{
2638
throw new UnsupportedOperationException("Unsupported operation, please use 'getAuthorizationUrl' and redirect your users there");
2739
}
2840

29-
@Override
41+
/**
42+
* {@inheritDoc}
43+
*/
3044
public Token getRequestToken()
3145
{
3246
throw new UnsupportedOperationException("Unsupported operation, please use 'getAuthorizationUrl' and redirect your users there");
3347
}
3448

35-
@Override
49+
/**
50+
* {@inheritDoc}
51+
*/
3652
public String getVersion()
3753
{
38-
return "2.0";
54+
return VERSION;
3955
}
4056

41-
@Override
57+
/**
58+
* {@inheritDoc}
59+
*/
4260
public void signRequest(Token accessToken, OAuthRequest request)
4361
{
44-
62+
request.addParameter(OAuthConstants.ACCESS_TOKEN, accessToken.getToken());
4563
}
4664

47-
@Override
65+
/**
66+
* {@inheritDoc}
67+
*/
4868
public String getAuthorizationUrl(Token requestToken)
4969
{
50-
return null;
70+
return api.getAuthorizationUrl(config);
5171
}
5272

5373
}

0 commit comments

Comments
 (0)