TwitterProviderImpl.java
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Properties
* org.apache.felix.scr.annotations.Property
* org.apache.felix.scr.annotations.Reference
* org.apache.felix.scr.annotations.ReferenceCardinality
* org.apache.felix.scr.annotations.ReferencePolicy
* org.apache.felix.scr.annotations.Service
* org.scribe.builder.api.Api
* org.scribe.builder.api.TwitterApi
*/
package com.adobe.granite.auth.oauth.impl;
import com.adobe.granite.auth.oauth.Provider;
import com.adobe.granite.auth.oauth.ProviderExtension;
import com.adobe.granite.auth.oauth.ProviderType;
import com.adobe.granite.auth.oauth.impl.ProviderBase;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.ReferencePolicy;
import org.apache.felix.scr.annotations.Service;
import org.scribe.builder.api.Api;
import org.scribe.builder.api.TwitterApi;
@Service(value={Provider.class})
@Component(metatype=1, label="%auth.oauth.provider.twitter.name", description="%auth.oauth.provider.twitter.description")
@Properties(value={@Property(name="oauth.provider.id", value={"twitter"})})
@Reference(name="providerExtension", referenceInterface=ProviderExtension.class, bind="bindProviderExtension", unbind="unbindProviderExtension", cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE, policy=ReferencePolicy.DYNAMIC)
public class TwitterProviderImpl
extends ProviderBase {
public TwitterProviderImpl() {
super(ProviderType.OAUTH1A, (Api)new TwitterApi(), "http://api.twitter.com/1/account/verify_credentials.json");
}
public String mapProperty(String property) {
if ("name".equals(property)) {
return "profile/familyName";
}
if ("profile_image_url".equals(property)) {
return "profile/avatar";
}
if ("lang".equals(property)) {
return "preferences/language";
}
return super.mapProperty(property);
}
}