|
1 | 1 | package org.scribe.builder.api; |
2 | 2 |
|
3 | | -import org.scribe.model.OAuthConfig; |
4 | | -import org.scribe.oauth.OAuthService; |
| 3 | +import org.scribe.model.*; |
| 4 | +import org.scribe.oauth.*; |
5 | 5 |
|
6 | | -public class DefaultApi20 implements Api |
| 6 | +/** |
| 7 | + * Default implementation of the OAuth protocol, version 2.0 (draft 11) |
| 8 | + * |
| 9 | + * This class is meant to be extended by concrete implementations of the API, |
| 10 | + * providing the endpoints and endpoint-http-verbs. |
| 11 | + * |
| 12 | + * If your Api adheres to the 2.0 (draft 11) protocol correctly, you just need to extend |
| 13 | + * this class and define the getters for your endpoints. |
| 14 | + * |
| 15 | + * If your Api does something a bit different, you can override the different |
| 16 | + * extractors or services, in order to fine-tune the process. Please read the |
| 17 | + * javadocs of the interfaces to get an idea of what to do. |
| 18 | + * |
| 19 | + * @author Diego Silveira |
| 20 | + * |
| 21 | + */ |
| 22 | +public abstract class DefaultApi20 implements Api |
7 | 23 | { |
8 | 24 |
|
9 | | - @Override |
| 25 | + /** |
| 26 | + * Returns the URL where you should redirect your users to authenticate |
| 27 | + * your application. |
| 28 | + * |
| 29 | + * @param config OAuth 2.0 configuration param object |
| 30 | + * @return the URL where you should redirect your users |
| 31 | + */ |
| 32 | + public abstract String getAuthorizationUrl(OAuthConfig config); |
| 33 | + |
| 34 | + /** |
| 35 | + * {@inheritDoc} |
| 36 | + */ |
10 | 37 | public OAuthService createService(OAuthConfig config, String scope) |
11 | 38 | { |
12 | | - return null; |
| 39 | + return new OAuth20ServiceImpl(this, config); |
13 | 40 | } |
14 | 41 |
|
15 | 42 | } |
0 commit comments