Search in sources :

Example 6 with OA2ClientKeys

use of edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys in project OA4MP by ncsa.

the class AttributeServerTest method testAttributeServerRemove.

public void testAttributeServerRemove(CMTestStoreProvider tp2) throws Exception {
    CC cc = setupClients(tp2);
    AttributeServer attributeServer = new AttributeServer(tp2.getCOSE());
    OA2ClientKeys keys = getClientKeys(tp2);
    JSONArray attributes = new JSONArray();
    attributes.add(keys.homeURL());
    attributes.add(keys.email());
    attributes.add(keys.rtLifetime());
    attributes.add(keys.scopes());
    AttributeRemoveRequest req = RequestFactory.createRequest(cc.adminClient, new TypeAttribute(), new ActionRemove(), cc.client, attributes);
    AttributeClientResponse resp = (AttributeClientResponse) attributeServer.process(req);
    OA2Client client = (OA2Client) resp.getClient();
    assert client.getScopes() == null || client.getScopes().isEmpty();
    assert client.getRtLifetime() == 0L;
    assert client.getHomeUri() == null;
    assert client.getEmail() == null;
}
Also used : OA2Client(edu.uiuc.ncsa.security.oauth_2_0.OA2Client) TypeAttribute(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeAttribute) OA2ClientKeys(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys) JSONArray(net.sf.json.JSONArray) ActionRemove(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionRemove)

Example 7 with OA2ClientKeys

use of edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys in project OA4MP by ncsa.

the class AttributeServerTest method testAttributeServerGet.

public void testAttributeServerGet(CMTestStoreProvider tp2) throws Exception {
    CC cc = setupClients(tp2);
    AttributeServer attributeServer = new AttributeServer(tp2.getCOSE());
    OA2ClientKeys keys = getClientKeys(tp2);
    JSONArray array = new JSONArray();
    array.add(keys.scopes());
    array.add(keys.callbackUri());
    array.add(keys.rtLifetime());
    array.add(keys.name());
    AttributeGetRequest req = RequestFactory.createRequest(cc.adminClient, new TypeAttribute(), new ActionGet(), cc.client, array);
    AttributeClientResponse r = (AttributeClientResponse) attributeServer.process(req);
    OA2Client reducedClient = (OA2Client) r.getClient();
    assert reducedClient.getIdentifier().equals(cc.client.getIdentifier());
    assert reducedClient.getScopes() != null;
    assert reducedClient.getCallbackURIs() != null;
    assert reducedClient.getRtLifetime() == cc.client.getRtLifetime();
    assert reducedClient.getName().equals(cc.client.getName());
    JSONObject json = new JSONObject();
    tp2.getClientStore().getACConverter().toJSON(r.getClient(), json);
    System.out.println(json);
}
Also used : OA2Client(edu.uiuc.ncsa.security.oauth_2_0.OA2Client) ActionGet(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionGet) TypeAttribute(edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeAttribute) JSONObject(net.sf.json.JSONObject) OA2ClientKeys(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys) JSONArray(net.sf.json.JSONArray)

Example 8 with OA2ClientKeys

use of edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys in project OA4MP by ncsa.

the class OA2ClientTable method createColumnDescriptors.

@Override
public void createColumnDescriptors() {
    super.createColumnDescriptors();
    OA2ClientKeys k = (OA2ClientKeys) keys;
    getColumnDescriptor().add(new ColumnDescriptorEntry(k.callbackUri(), LONGVARCHAR));
    getColumnDescriptor().add(new ColumnDescriptorEntry(k.scopes(), LONGVARCHAR));
    getColumnDescriptor().add(new ColumnDescriptorEntry(k.rtLifetime(), BIGINT));
    getColumnDescriptor().add(new ColumnDescriptorEntry(k.issuer(), LONGVARCHAR));
    getColumnDescriptor().add(new ColumnDescriptorEntry(k.ldap(), LONGVARCHAR));
    getColumnDescriptor().add(new ColumnDescriptorEntry(k.cfg(), LONGVARCHAR));
    getColumnDescriptor().add(new ColumnDescriptorEntry(k.signTokens(), BOOLEAN));
    getColumnDescriptor().add(new ColumnDescriptorEntry(k.publicClient(), BOOLEAN));
}
Also used : OA2ClientKeys(edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys) ColumnDescriptorEntry(edu.uiuc.ncsa.security.storage.sql.internals.ColumnDescriptorEntry)

Aggregations

OA2ClientKeys (edu.uiuc.ncsa.security.oauth_2_0.OA2ClientKeys)8 OA2Client (edu.uiuc.ncsa.security.oauth_2_0.OA2Client)7 JSONObject (net.sf.json.JSONObject)6 TypeAttribute (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeAttribute)3 TypeClient (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.types.TypeClient)2 OA2ClientConverter (edu.uiuc.ncsa.security.oauth_2_0.OA2ClientConverter)2 ColumnMap (edu.uiuc.ncsa.security.storage.sql.internals.ColumnMap)2 JSONArray (net.sf.json.JSONArray)2 ActionGet (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionGet)1 ActionRemove (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionRemove)1 ActionSet (edu.uiuc.ncsa.myproxy.oa4mp.server.admin.things.actions.ActionSet)1 ColumnDescriptorEntry (edu.uiuc.ncsa.security.storage.sql.internals.ColumnDescriptorEntry)1 PrintWriter (java.io.PrintWriter)1 LinkedList (java.util.LinkedList)1