Search in sources :

Example 1 with OA4MPIdentifierProvider

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider in project OA4MP by ncsa.

the class ClientManagerTest method testOA2Client.

@Test
public void testOA2Client() throws Exception {
    OA2ClientProvider clientProvider = new OA2ClientProvider(new OA4MPIdentifierProvider(OA4MPIdentifierProvider.CLIENT_ID));
    OA2ClientMemoryStore store = new OA2ClientMemoryStore(clientProvider);
    OA2ClientConverter converter = new OA2ClientConverter(clientProvider);
    OA2Client c = getOa2Client(store);
    JSONObject j = new JSONObject();
    converter.toJSON(c, j);
    System.out.println(j);
    Client c2 = converter.fromJSON(j);
    assert c2.equals(c);
}
Also used : OA2Client(edu.uiuc.ncsa.security.oauth_2_0.OA2Client) OA4MPIdentifierProvider(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider) OA2ClientProvider(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientProvider) JSONObject(net.sf.json.JSONObject) OA2ClientMemoryStore(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.storage.OA2ClientMemoryStore) Client(edu.uiuc.ncsa.security.delegation.storage.Client) OA2Client(edu.uiuc.ncsa.security.oauth_2_0.OA2Client) OA2ClientConverter(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientConverter) Test(org.junit.Test)

Example 2 with OA4MPIdentifierProvider

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider in project OA4MP by ncsa.

the class ClientManagerTest method testClient.

@Test
public void testClient() throws Exception {
    ClientProvider clientProvider = new ClientProvider(new OA4MPIdentifierProvider(OA4MPIdentifierProvider.CLIENT_ID));
    ClientMemoryStore store = new ClientMemoryStore(clientProvider);
    ClientConverter converter = new ClientConverter(clientProvider);
    Client c = getClient(store);
    JSONObject j = new JSONObject();
    converter.toJSON(c, j);
    Client c2 = converter.fromJSON(j);
    assert c2.equals(c);
}
Also used : OA2ClientConverter(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientConverter) ClientConverter(edu.uiuc.ncsa.security.delegation.storage.impl.ClientConverter) OA4MPIdentifierProvider(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider) JSONObject(net.sf.json.JSONObject) ClientProvider(edu.uiuc.ncsa.security.delegation.storage.ClientProvider) OA2ClientProvider(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientProvider) Client(edu.uiuc.ncsa.security.delegation.storage.Client) OA2Client(edu.uiuc.ncsa.security.oauth_2_0.OA2Client) ClientMemoryStore(edu.uiuc.ncsa.security.delegation.server.storage.impl.ClientMemoryStore) OA2ClientMemoryStore(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.storage.OA2ClientMemoryStore) Test(org.junit.Test)

Example 3 with OA4MPIdentifierProvider

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider in project OA4MP by ncsa.

the class ClientManagerTest method testThing.

@Test
public void testThing(ClientStore clientStore) throws Exception {
    // create a request and use the SATFactory to pull it apart.
    JSONObject request = new JSONObject();
    JSONObject requestContent = new JSONObject();
    OA2ClientProvider clientProvider = new OA2ClientProvider(new OA4MPIdentifierProvider(OA4MPIdentifierProvider.CLIENT_ID));
    OA2ClientConverter converter = new OA2ClientConverter(clientProvider);
    JSONObject jsonClient = new JSONObject();
    converter.toJSON(getOa2Client(clientStore), jsonClient);
    requestContent.put(KEYS_SUBJECT, jsonClient);
    JSONObject action = new JSONObject();
    action.put("type", "client");
    action.put("method", ACTION_APPROVE);
    requestContent.put(KEYS_ACTION, action);
    JSONObject jsonClient2 = new JSONObject();
    converter.toJSON(getOa2Client(clientStore), jsonClient2);
    requestContent.put(KEYS_TARGET, jsonClient2);
    request.put(KEYS_API, requestContent);
    System.out.println(SATFactory.getSubject(request));
    System.out.println(SATFactory.getMethod(request));
    System.out.println(SATFactory.getType(request));
    System.out.println(SATFactory.getTarget(request));
    System.out.println(SATFactory.getContent(request));
}
Also used : OA4MPIdentifierProvider(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider) JSONObject(net.sf.json.JSONObject) OA2ClientProvider(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientProvider) OA2ClientConverter(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientConverter) Test(org.junit.Test)

Example 4 with OA4MPIdentifierProvider

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider in project OA4MP by ncsa.

the class DDServerTests method getClientConverter.

protected OA2ClientConverter getClientConverter(CMTestStoreProvider tp2) throws Exception {
    BaseClientConverter bcc = tp2.getClientStore().getACConverter();
    if (bcc instanceof OA2ClientConverter) {
        return (OA2ClientConverter) bcc;
    }
    // In the weird chance something does not have one, the default is provided.
    OA2ClientProvider clientProvider = new OA2ClientProvider(new OA4MPIdentifierProvider(OA4MPIdentifierProvider.CLIENT_ID));
    OA2ClientConverter converter = new OA2ClientConverter(clientProvider);
    return converter;
}
Also used : BaseClientConverter(edu.uiuc.ncsa.security.delegation.storage.impl.BaseClientConverter) OA4MPIdentifierProvider(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider)

Example 5 with OA4MPIdentifierProvider

use of edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider in project OA4MP by ncsa.

the class ClientManagerTest method testGetSerialization.

@Test
public void testGetSerialization(CMTestStoreProvider tp2) throws Exception {
    JSONObject request = new JSONObject();
    JSONObject requestContent = new JSONObject();
    DDServerTests.CC cc = setupClients(tp2);
    OA2ClientProvider clientProvider = new OA2ClientProvider(new OA4MPIdentifierProvider(OA4MPIdentifierProvider.CLIENT_ID));
    JSONObject jsonClient = new JSONObject();
    getAdminClientConverter(tp2).toJSON(cc.adminClient, jsonClient);
    requestContent.put(KEYS_SUBJECT, jsonClient);
    JSONObject action = new JSONObject();
    action.put("type", SAT.TYPE_CLIENT);
    action.put("method", ACTION_GET);
    requestContent.put(KEYS_ACTION, action);
    JSONObject jsonClient2 = new JSONObject();
    getClientConverter(tp2).toJSON(cc.client, jsonClient2);
    requestContent.put(KEYS_TARGET, jsonClient2);
    request.put(KEYS_API, requestContent);
}
Also used : OA4MPIdentifierProvider(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider) JSONObject(net.sf.json.JSONObject) OA2ClientProvider(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientProvider) Test(org.junit.Test)

Aggregations

OA4MPIdentifierProvider (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.transactions.OA4MPIdentifierProvider)8 Test (org.junit.Test)6 OA2ClientProvider (edu.uiuc.ncsa.security.oauth_2_0.OA2ClientProvider)5 JSONObject (net.sf.json.JSONObject)5 OA2ClientConverter (edu.uiuc.ncsa.security.oauth_2_0.OA2ClientConverter)4 Client (edu.uiuc.ncsa.security.delegation.storage.Client)3 OA2ClientMemoryStore (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.storage.OA2ClientMemoryStore)2 ClientProvider (edu.uiuc.ncsa.security.delegation.storage.ClientProvider)2 ClientConverter (edu.uiuc.ncsa.security.delegation.storage.impl.ClientConverter)2 OA2Client (edu.uiuc.ncsa.security.oauth_2_0.OA2Client)2 OA2ServiceTransaction (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.OA2ServiceTransaction)1 MultiDSClientStoreProvider (edu.uiuc.ncsa.myproxy.oa4mp.server.storage.MultiDSClientStoreProvider)1 DSFSClientStoreProvider (edu.uiuc.ncsa.myproxy.oa4mp.server.storage.filestore.DSFSClientStoreProvider)1 DSClientSQLStoreProvider (edu.uiuc.ncsa.myproxy.oa4mp.server.storage.sql.provider.DSClientSQLStoreProvider)1 IdentifiableProvider (edu.uiuc.ncsa.security.core.IdentifiableProvider)1 ConfigTest (edu.uiuc.ncsa.security.core.configuration.ConfigTest)1 MyLoggingFacade (edu.uiuc.ncsa.security.core.util.MyLoggingFacade)1 ClientStore (edu.uiuc.ncsa.security.delegation.server.storage.ClientStore)1 ClientMemoryStore (edu.uiuc.ncsa.security.delegation.server.storage.impl.ClientMemoryStore)1 BaseClientConverter (edu.uiuc.ncsa.security.delegation.storage.impl.BaseClientConverter)1