Search in sources :

Example 1 with JsonMapObjectProvider

use of org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider in project testcases by coheigea.

the class KeysTest method setupProviders.

private static List<Object> setupProviders() {
    List<Object> providers = new ArrayList<Object>();
    JSONProvider<OAuthAuthorizationData> jsonP = new JSONProvider<OAuthAuthorizationData>();
    jsonP.setNamespaceMap(Collections.singletonMap("http://org.apache.cxf.rs.security.oauth", "ns2"));
    providers.add(jsonP);
    providers.add(new OAuthJSONProvider());
    providers.add(new JsonWebKeysProvider());
    providers.add(new JsonMapObjectProvider());
    return providers;
}
Also used : JsonWebKeysProvider(org.apache.cxf.rs.security.jose.jaxrs.JsonWebKeysProvider) ArrayList(java.util.ArrayList) OAuthJSONProvider(org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider) JSONProvider(org.apache.cxf.jaxrs.provider.json.JSONProvider) OAuthJSONProvider(org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider) JsonMapObjectProvider(org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider) OAuthAuthorizationData(org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData)

Example 2 with JsonMapObjectProvider

use of org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider in project testcases by coheigea.

the class UserInfoTest method setupProviders.

private static List<Object> setupProviders() {
    List<Object> providers = new ArrayList<Object>();
    JSONProvider<OAuthAuthorizationData> jsonP = new JSONProvider<OAuthAuthorizationData>();
    jsonP.setNamespaceMap(Collections.singletonMap("http://org.apache.cxf.rs.security.oauth", "ns2"));
    providers.add(jsonP);
    providers.add(new OAuthJSONProvider());
    providers.add(new JsonWebKeysProvider());
    providers.add(new JsonMapObjectProvider());
    return providers;
}
Also used : JsonWebKeysProvider(org.apache.cxf.rs.security.jose.jaxrs.JsonWebKeysProvider) ArrayList(java.util.ArrayList) JSONProvider(org.apache.cxf.jaxrs.provider.json.JSONProvider) OAuthJSONProvider(org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider) OAuthJSONProvider(org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider) JsonMapObjectProvider(org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider) OAuthAuthorizationData(org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData)

Example 3 with JsonMapObjectProvider

use of org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider in project cxf by apache.

the class BigQueryServer method main.

public static void main(String[] args) throws Exception {
    final String pc12File = args[0];
    final String keySecret = args[1];
    final String issuer = args[2];
    final String projectId = args[3];
    PrivateKey privateKey = loadPrivateKey(pc12File, keySecret);
    ClientAccessToken accessToken = getAccessToken(privateKey, issuer);
    WebClient bigQueryClient = WebClient.create("https://www.googleapis.com/bigquery/v2/projects/" + projectId + "/queries", Collections.singletonList(new JsonMapObjectProvider()));
    bigQueryClient.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);
    List<ShakespeareText> texts = BigQueryService.getMatchingTexts(bigQueryClient, accessToken, "brave", "10");
    System.out.println("Matching texts:");
    for (ShakespeareText text : texts) {
        System.out.println(text.getText() + ":" + text.getDate());
    }
}
Also used : PrivateKey(java.security.PrivateKey) ClientAccessToken(org.apache.cxf.rs.security.oauth2.common.ClientAccessToken) JsonMapObjectProvider(org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider) WebClient(org.apache.cxf.jaxrs.client.WebClient)

Example 4 with JsonMapObjectProvider

use of org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider in project cxf by apache.

the class OAuth2TestUtils method setupProviders.

public static List<Object> setupProviders() {
    JSONProvider<OAuthAuthorizationData> jsonP = new JSONProvider<>();
    jsonP.setNamespaceMap(Collections.singletonMap("http://org.apache.cxf.rs.security.oauth", "ns2"));
    return Arrays.asList(jsonP, new OAuthJSONProvider(), new JsonWebKeysProvider(), new JsonMapObjectProvider());
}
Also used : JsonWebKeysProvider(org.apache.cxf.rs.security.jose.jaxrs.JsonWebKeysProvider) JSONProvider(org.apache.cxf.jaxrs.provider.json.JSONProvider) OAuthJSONProvider(org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider) OAuthJSONProvider(org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider) JsonMapObjectProvider(org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider) OAuthAuthorizationData(org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData)

Example 5 with JsonMapObjectProvider

use of org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider in project cxf by apache.

the class JAXRSOAuth2TlsTest method createDynRegWebClient.

private WebClient createDynRegWebClient(String address) {
    JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
    bean.setAddress(address);
    bean.setProvider(new JsonMapObjectProvider());
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = JAXRSOAuth2TlsTest.class.getResource("client.xml");
    Bus springBus = bf.createBus(busFile.toString());
    bean.setBus(springBus);
    WebClient wc = bean.createWebClient();
    wc.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);
    return wc;
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) JAXRSClientFactoryBean(org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean) JsonMapObjectProvider(org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider) WebClient(org.apache.cxf.jaxrs.client.WebClient) URL(java.net.URL)

Aggregations

JsonMapObjectProvider (org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider)17 WebClient (org.apache.cxf.jaxrs.client.WebClient)10 URL (java.net.URL)9 JSONProvider (org.apache.cxf.jaxrs.provider.json.JSONProvider)7 JsonWebKeysProvider (org.apache.cxf.rs.security.jose.jaxrs.JsonWebKeysProvider)7 ClientAccessToken (org.apache.cxf.rs.security.oauth2.common.ClientAccessToken)7 OAuthAuthorizationData (org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData)7 OAuthJSONProvider (org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider)7 ArrayList (java.util.ArrayList)6 ClientRegistrationResponse (org.apache.cxf.rs.security.oauth2.services.ClientRegistrationResponse)6 ClientRegistration (org.apache.cxf.rs.security.oauth2.services.ClientRegistration)5 Response (javax.ws.rs.core.Response)2 PrivateKey (java.security.PrivateKey)1 Bus (org.apache.cxf.Bus)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 JAXRSClientFactoryBean (org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean)1 UserInfo (org.apache.cxf.rs.security.oidc.common.UserInfo)1