001
014
015 package com.liferay.portal.oauth;
016
017 import com.liferay.portal.kernel.oauth.OAuthException;
018 import com.liferay.portal.kernel.oauth.OAuthFactory;
019 import com.liferay.portal.kernel.oauth.OAuthManager;
020 import com.liferay.portal.kernel.oauth.OAuthRequest;
021 import com.liferay.portal.kernel.oauth.Token;
022 import com.liferay.portal.kernel.oauth.Verb;
023 import com.liferay.portal.kernel.oauth.Verifier;
024
025
028 public class OAuthFactoryImpl implements OAuthFactory {
029
030 public OAuthManager createOAuthManager(
031 String key, String secret, String accessURL, String requestURL,
032 String callbackURL, String scope)
033 throws OAuthException {
034
035 try {
036 return new OAuthManagerImpl(
037 key, secret, accessURL, requestURL, callbackURL, scope);
038 }
039 catch (Exception e) {
040 throw new OAuthException(e);
041 }
042 }
043
044 public OAuthRequest createOAuthRequest(Verb verb, String url)
045 throws OAuthException {
046
047 try {
048 return new OAuthRequestImpl(
049 new org.scribe.model.OAuthRequest(
050 VerbTranslator.translate(verb), url));
051 }
052 catch (Exception e) {
053 throw new OAuthException(e);
054 }
055 }
056
057 public Token createToken(String token, String secret)
058 throws OAuthException {
059
060 try {
061 return new TokenImpl(new org.scribe.model.Token(token, secret));
062 }
063 catch (Exception e) {
064 throw new OAuthException(e);
065 }
066 }
067
068 public Verifier createVerifier(String verifier) throws OAuthException {
069 try {
070 return new VerifierImpl(new org.scribe.model.Verifier(verifier));
071 }
072 catch (Exception e) {
073 throw new OAuthException(e);
074 }
075 }
076
077 }