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 import com.liferay.portal.kernel.security.pacl.DoPrivileged;
025
026
029 @DoPrivileged
030 public class OAuthFactoryImpl implements OAuthFactory {
031
032 public OAuthManager createOAuthManager(
033 String key, String secret, String accessURL, String requestURL,
034 String callbackURL, String scope)
035 throws OAuthException {
036
037 try {
038 return new OAuthManagerImpl(
039 key, secret, accessURL, requestURL, callbackURL, scope);
040 }
041 catch (Exception e) {
042 throw new OAuthException(e);
043 }
044 }
045
046 public OAuthRequest createOAuthRequest(Verb verb, String url)
047 throws OAuthException {
048
049 try {
050 return new OAuthRequestImpl(
051 new org.scribe.model.OAuthRequest(
052 VerbTranslator.translate(verb), url));
053 }
054 catch (Exception e) {
055 throw new OAuthException(e);
056 }
057 }
058
059 public Token createToken(String token, String secret)
060 throws OAuthException {
061
062 try {
063 return new TokenImpl(new org.scribe.model.Token(token, secret));
064 }
065 catch (Exception e) {
066 throw new OAuthException(e);
067 }
068 }
069
070 public Verifier createVerifier(String verifier) throws OAuthException {
071 try {
072 return new VerifierImpl(new org.scribe.model.Verifier(verifier));
073 }
074 catch (Exception e) {
075 throw new OAuthException(e);
076 }
077 }
078
079 }