blob: e72df5ecb9097124cbb00b51e54a862acb888be2 (
plain)
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
|
package com.p4square.f1oauth;
import com.codahale.metrics.MetricRegistry;
import com.p4square.grow.config.Config;
import com.p4square.grow.frontend.IntegrationDriver;
import org.restlet.Context;
import org.restlet.security.Verifier;
/**
* The FellowshipOneIntegrationDriver creates implementations of various
* objects to support integration with Fellowship One.
*/
public class FellowshipOneIntegrationDriver implements IntegrationDriver {
private final Context mContext;
private final MetricRegistry mMetricRegistry;
private final Config mConfig;
private final F1Access mAPI;
public FellowshipOneIntegrationDriver(final Context context) {
mContext = context;
mConfig = (Config) context.getAttributes().get("com.p4square.grow.config");
mMetricRegistry = (MetricRegistry) context.getAttributes().get("com.p4square.grow.metrics");
mAPI = new F1Access(context,
mConfig.getString("f1ConsumerKey", ""),
mConfig.getString("f1ConsumerSecret", ""),
mConfig.getString("f1BaseUrl", "staging.fellowshiponeapi.com"),
mConfig.getString("f1ChurchCode", "pfseawa"),
F1Access.UserType.WEBLINK);
mAPI.setMetricRegistry(mMetricRegistry);
}
/**
* @return An F1Access instance.
*/
public F1Access getF1Access() {
return mAPI;
}
@Override
public Verifier newUserAuthenticationVerifier() {
return new SecondPartyVerifier(mContext, mAPI);
}
}
|